Merge "Fix the ActivityLifecycleTests#testLocalRecreate flakiness" into sc-dev
diff --git a/ProtoLibraries.bp b/ProtoLibraries.bp
index 14415db..7e3cc27 100644
--- a/ProtoLibraries.bp
+++ b/ProtoLibraries.bp
@@ -35,6 +35,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         ":libtombstone_proto-src",
         "core/proto/**/*.proto",
         "libs/incident/**/*.proto",
@@ -64,6 +65,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         "core/proto/**/*.proto",
         "libs/incident/**/*.proto",
         ":service-permission-protos",
@@ -78,6 +80,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         ":libstats_internal_protos",
         ":statsd_internal_protos",
         "cmds/am/proto/instrumentation_data.proto",
@@ -116,6 +119,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         "core/proto/**/*.proto",
         "libs/incident/proto/android/os/**/*.proto",
         ":service-permission-protos",
@@ -133,6 +137,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         "core/proto/**/*.proto",
         "libs/incident/proto/android/os/**/*.proto",
         ":service-permission-protos",
@@ -169,6 +174,7 @@
     srcs: [
         ":ipconnectivity-proto-src",
         ":libstats_atom_enum_protos",
+        ":libstats_atom_message_protos",
         "core/proto/**/*.proto",
         ":service-permission-protos",
     ],
diff --git a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
index 97768277..8af91b4 100644
--- a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
+++ b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
@@ -29,14 +29,16 @@
 /**
  * Provides access to the centralized AppSearch index maintained by the system.
  *
- * <p>AppSearch is a search library for managing structured data featuring:
+ * <p>AppSearch is an offline, on-device search library for managing structured data featuring:
  *
  * <ul>
- *   <li>A fully offline on-device solution
- *   <li>A set of APIs for applications to index documents and retrieve them via full-text search
- *   <li>APIs for applications to allow the System to display their content on system UI surfaces
- *   <li>Similarly, APIs for applications to allow the System to share their content with other
- *       specified applications.
+ *   <li>APIs to index and retrieve data via full-text search.
+ *   <li>An API for applications to explicitly grant read-access permission of their data to other
+ *   applications.
+ *   <b>See: {@link SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage}</b>
+ *   <li>An API for applications to opt into or out of having their data displayed on System UI
+ *   surfaces by the System-designated global querier.
+ *   <b>See: {@link SetSchemaRequest.Builder#setSchemaTypeDisplayedBySystem}</b>
  * </ul>
  *
  * <p>Applications create a database by opening an {@link AppSearchSession}.
diff --git a/apex/jobscheduler/framework/java/android/app/AlarmManager.java b/apex/jobscheduler/framework/java/android/app/AlarmManager.java
index 9ea6f79..01f31e4 100644
--- a/apex/jobscheduler/framework/java/android/app/AlarmManager.java
+++ b/apex/jobscheduler/framework/java/android/app/AlarmManager.java
@@ -19,6 +19,7 @@
 import android.Manifest;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SdkConstant;
 import android.annotation.SystemApi;
@@ -591,8 +592,8 @@
      *        in milliseconds.  The alarm will be delivered no later than this many
      *        milliseconds after {@code windowStartMillis}.  Note that this parameter
      *        is a <i>duration,</i> not the timestamp of the end of the window.
-     * @param tag string describing the alarm, used for logging and battery-use
-     *         attribution
+     * @param tag Optional. A string describing the alarm, used for logging and battery-use
+     *         attribution.
      * @param listener {@link OnAlarmListener} instance whose
      *         {@link OnAlarmListener#onAlarm() onAlarm()} method will be
      *         called when the alarm time is reached.  A given OnAlarmListener instance can
@@ -605,9 +606,8 @@
     @SystemApi
     @RequiresPermission(Manifest.permission.SCHEDULE_PRIORITIZED_ALARM)
     public void setPrioritized(@AlarmType int type, long windowStartMillis, long windowLengthMillis,
-            @NonNull String tag, @NonNull Executor executor, @NonNull OnAlarmListener listener) {
+            @Nullable String tag, @NonNull Executor executor, @NonNull OnAlarmListener listener) {
         Objects.requireNonNull(executor);
-        Objects.requireNonNull(tag);
         Objects.requireNonNull(listener);
         setImpl(type, windowStartMillis, windowLengthMillis, 0, FLAG_PRIORITIZE, null, listener,
                 tag, executor, null, null);
@@ -782,6 +782,50 @@
                 targetHandler, workSource, null);
     }
 
+    /**
+     * Exact version of {@link #set(int, long, long, long, OnAlarmListener, Handler, WorkSource)}.
+     * This equivalent to calling the aforementioned API with {@code windowMillis} and
+     * {@code intervalMillis} set to 0.
+     * One subtle difference is that this API requires {@code workSource} to be non-null. If you
+     * don't want to attribute this alarm to another app for battery consumption, you should use
+     * {@link #setExact(int, long, String, OnAlarmListener, Handler)} instead.
+     *
+     * <p>
+     * Note that using this API requires you to hold
+     * {@link Manifest.permission#SCHEDULE_EXACT_ALARM}, unless you are on the system's power
+     * allowlist. This can be set, for example, by marking the app as {@code <allow-in-power-save>}
+     * within the system config.
+     *
+     * @param type            type of alarm
+     * @param triggerAtMillis The exact time in milliseconds, that the alarm should be delivered,
+     *                        expressed in the appropriate clock's units (depending on the alarm
+     *                        type).
+     * @param listener        {@link OnAlarmListener} instance whose
+     *                        {@link OnAlarmListener#onAlarm() onAlarm()} method will be called when
+     *                        the alarm time is reached.
+     * @param executor        The {@link Executor} on which to execute the listener's onAlarm()
+     *                        callback.
+     * @param tag             Optional. A string tag used to identify this alarm in logs and
+     *                        battery-attribution.
+     * @param workSource      A {@link WorkSource} object to attribute this alarm to the app that
+     *                        requested this work.
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(allOf = {
+            Manifest.permission.UPDATE_DEVICE_STATS,
+            Manifest.permission.SCHEDULE_EXACT_ALARM}, conditional = true)
+    public void setExact(@AlarmType int type, long triggerAtMillis, @Nullable String tag,
+            @NonNull Executor executor, @NonNull WorkSource workSource,
+            @NonNull OnAlarmListener listener) {
+        Objects.requireNonNull(executor);
+        Objects.requireNonNull(workSource);
+        Objects.requireNonNull(listener);
+        setImpl(type, triggerAtMillis, WINDOW_EXACT, 0, 0, null, listener, tag, executor,
+                workSource, null);
+    }
+
+
     private void setImpl(@AlarmType int type, long triggerAtMillis, long windowMillis,
             long intervalMillis, int flags, PendingIntent operation, final OnAlarmListener listener,
             String listenerTag, Handler targetHandler, WorkSource workSource,
diff --git a/apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java b/apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java
index 44e87c3..93b6566 100644
--- a/apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java
+++ b/apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java
@@ -283,9 +283,10 @@
      */
     public static final int REASON_PACKAGE_REPLACED = 311;
     /**
-     * LocationProviderManager.
+     * LocationProvider.
      * @hide
      */
+    @SystemApi
     public static final int REASON_LOCATION_PROVIDER = 312;
     /**
      * MediaButtonReceiver.
diff --git a/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java b/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
index 29a5dee..4ce31e9 100644
--- a/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
+++ b/apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java
@@ -284,9 +284,10 @@
      */
     public static final int REASON_PACKAGE_REPLACED = PowerExemptionManager.REASON_PACKAGE_REPLACED;
     /**
-     * LocationProviderManager.
+     * LocationProvider.
      * @hide
      */
+    @SystemApi
     public static final int REASON_LOCATION_PROVIDER =
             PowerExemptionManager.REASON_LOCATION_PROVIDER;
     /**
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
index 131783f..366e174 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
@@ -798,7 +798,8 @@
     private void startJobLocked(@NonNull JobServiceContext worker, @NonNull JobStatus jobStatus,
             @WorkType final int workType) {
         final List<StateController> controllers = mService.mControllers;
-        for (int ic = 0; ic < controllers.size(); ic++) {
+        final int numControllers = controllers.size();
+        for (int ic = 0; ic < numControllers; ic++) {
             controllers.get(ic).prepareForExecutionLocked(jobStatus);
         }
         final PackageStats packageStats =
@@ -807,6 +808,9 @@
         if (!worker.executeRunnableJob(jobStatus, workType)) {
             Slog.e(TAG, "Error executing " + jobStatus);
             mWorkCountTracker.onStagedJobFailed(workType);
+            for (int ic = 0; ic < numControllers; ic++) {
+                controllers.get(ic).unprepareFromExecutionLocked(jobStatus);
+            }
         } else {
             mRunningJobs.add(jobStatus);
             mWorkCountTracker.onJobStarted(workType);
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java
index 500735b..2bdf656 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/ConnectivityController.java
@@ -77,7 +77,7 @@
             || Log.isLoggable(TAG, Log.DEBUG);
 
     // The networking stack has a hard limit so we can't make this configurable.
-    private static final int MAX_NETWORK_CALLBACKS = 50;
+    private static final int MAX_NETWORK_CALLBACKS = 125;
     /**
      * Minimum amount of time that should have elapsed before we'll update a {@link UidStats}
      * instance.
@@ -148,7 +148,8 @@
             //   9. Enqueue time
             // TODO: maybe consider number of jobs
             // TODO: consider IMPORTANT_WHILE_FOREGROUND bit
-            final int runningPriority = prioritizeExistenceOver(0, us1.numRunning, us2.numRunning);
+            final int runningPriority = prioritizeExistenceOver(0,
+                    us1.runningJobs.size(), us2.runningJobs.size());
             if (runningPriority != 0) {
                 return runningPriority;
             }
@@ -256,7 +257,18 @@
         if (jobStatus.hasConnectivityConstraint()) {
             final UidStats uidStats =
                     getUidStats(jobStatus.getSourceUid(), jobStatus.getSourcePackageName(), true);
-            uidStats.numRunning++;
+            uidStats.runningJobs.add(jobStatus);
+        }
+    }
+
+    @GuardedBy("mLock")
+    @Override
+    public void unprepareFromExecutionLocked(JobStatus jobStatus) {
+        if (jobStatus.hasConnectivityConstraint()) {
+            final UidStats uidStats =
+                    getUidStats(jobStatus.getSourceUid(), jobStatus.getSourcePackageName(), true);
+            uidStats.runningJobs.remove(jobStatus);
+            postAdjustCallbacks();
         }
     }
 
@@ -272,12 +284,7 @@
             final UidStats uidStats =
                     getUidStats(jobStatus.getSourceUid(), jobStatus.getSourcePackageName(), true);
             uidStats.numReadyWithConnectivity--;
-            if (jobStatus.madeActive != 0) {
-                // numRunning would be 0 if the UidStats object didn't exist before this method
-                // was called. getUidStats() handles logging, so just make sure we don't save a
-                // negative value.
-                uidStats.numRunning = Math.max(0, uidStats.numRunning - 1);
-            }
+            uidStats.runningJobs.remove(jobStatus);
             maybeRevokeStandbyExceptionLocked(jobStatus);
             postAdjustCallbacks();
         }
@@ -1151,7 +1158,7 @@
     private static class UidStats {
         public final int uid;
         public int basePriority;
-        public int numRunning;
+        public final ArraySet<JobStatus> runningJobs = new ArraySet<>();
         public int numReadyWithConnectivity;
         public int numRequestedNetworkAvailable;
         public int numEJs;
@@ -1168,7 +1175,7 @@
             pw.print("UidStats{");
             pw.print("uid", uid);
             pw.print("pri", basePriority);
-            pw.print("#run", numRunning);
+            pw.print("#run", runningJobs.size());
             pw.print("#readyWithConn", numReadyWithConnectivity);
             pw.print("#netAvail", numRequestedNetworkAvailable);
             pw.print("#EJs", numEJs);
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/ContentObserverController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/ContentObserverController.java
index 8b0da34..e64233f 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/ContentObserverController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/ContentObserverController.java
@@ -136,6 +136,29 @@
     }
 
     @Override
+    public void unprepareFromExecutionLocked(JobStatus taskStatus) {
+        if (taskStatus.hasContentTriggerConstraint()) {
+            if (taskStatus.contentObserverJobInstance != null) {
+                if (taskStatus.contentObserverJobInstance.mChangedUris == null) {
+                    taskStatus.contentObserverJobInstance.mChangedUris = taskStatus.changedUris;
+                } else {
+                    taskStatus.contentObserverJobInstance.mChangedUris
+                            .addAll(taskStatus.changedUris);
+                }
+                if (taskStatus.contentObserverJobInstance.mChangedAuthorities == null) {
+                    taskStatus.contentObserverJobInstance.mChangedAuthorities =
+                            taskStatus.changedAuthorities;
+                } else {
+                    taskStatus.contentObserverJobInstance.mChangedAuthorities
+                            .addAll(taskStatus.changedAuthorities);
+                }
+                taskStatus.changedUris = null;
+                taskStatus.changedAuthorities = null;
+            }
+        }
+    }
+
+    @Override
     public void maybeStopTrackingJobLocked(JobStatus taskStatus, JobStatus incomingJob,
             boolean forUpdate) {
         if (taskStatus.clearTrackingController(JobStatus.TRACKING_CONTENT)) {
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
index d4ce437..aace645 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/QuotaController.java
@@ -34,7 +34,6 @@
 import android.annotation.UserIdInt;
 import android.app.ActivityManager;
 import android.app.AlarmManager;
-import android.app.AppGlobals;
 import android.app.IUidObserver;
 import android.app.usage.UsageEvents;
 import android.app.usage.UsageStatsManagerInternal;
@@ -677,27 +676,30 @@
     }
 
     @Override
-    public void maybeStopTrackingJobLocked(JobStatus jobStatus, JobStatus incomingJob,
-            boolean forUpdate) {
-        if (jobStatus.clearTrackingController(JobStatus.TRACKING_QUOTA)) {
-            Timer timer = mPkgTimers.get(jobStatus.getSourceUserId(),
-                    jobStatus.getSourcePackageName());
+    public void unprepareFromExecutionLocked(JobStatus jobStatus) {
+        Timer timer = mPkgTimers.get(jobStatus.getSourceUserId(), jobStatus.getSourcePackageName());
+        if (timer != null) {
+            timer.stopTrackingJob(jobStatus);
+        }
+        if (jobStatus.isRequestedExpeditedJob()) {
+            timer = mEJPkgTimers.get(jobStatus.getSourceUserId(), jobStatus.getSourcePackageName());
             if (timer != null) {
                 timer.stopTrackingJob(jobStatus);
             }
-            if (jobStatus.isRequestedExpeditedJob()) {
-                timer = mEJPkgTimers.get(jobStatus.getSourceUserId(),
-                        jobStatus.getSourcePackageName());
-                if (timer != null) {
-                    timer.stopTrackingJob(jobStatus);
-                }
-            }
+        }
+        mTopStartedJobs.remove(jobStatus);
+    }
+
+    @Override
+    public void maybeStopTrackingJobLocked(JobStatus jobStatus, JobStatus incomingJob,
+            boolean forUpdate) {
+        if (jobStatus.clearTrackingController(JobStatus.TRACKING_QUOTA)) {
+            unprepareFromExecutionLocked(jobStatus);
             ArraySet<JobStatus> jobs = mTrackedJobs.get(jobStatus.getSourceUserId(),
                     jobStatus.getSourcePackageName());
             if (jobs != null) {
                 jobs.remove(jobStatus);
             }
-            mTopStartedJobs.remove(jobStatus);
         }
     }
 
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/StateController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/StateController.java
index 334876f..f0fc3b0 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/StateController.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/StateController.java
@@ -76,6 +76,12 @@
     }
 
     /**
+     * Optionally implement logic here for when a job that was about to be executed failed to start.
+     */
+    public void unprepareFromExecutionLocked(JobStatus jobStatus) {
+    }
+
+    /**
      * Remove task - this will happen if the task is cancelled, completed, etc.
      */
     public abstract void maybeStopTrackingJobLocked(JobStatus jobStatus, JobStatus incomingJob,
diff --git a/apex/jobscheduler/service/jni/Android.bp b/apex/jobscheduler/service/jni/Android.bp
index 333da74..34a1fa2 100644
--- a/apex/jobscheduler/service/jni/Android.bp
+++ b/apex/jobscheduler/service/jni/Android.bp
@@ -29,14 +29,3 @@
         "libbase",
     ],
 }
-
-filegroup {
-    name: "lib_alarmManagerService_native",
-    srcs: [
-        "com_android_server_alarm_AlarmManagerService.cpp",
-    ],
-    visibility: [
-        // TODO: remove this
-        "//vendor:__subpackages__",
-    ],
-}
diff --git a/core/api/current.txt b/core/api/current.txt
index 9856843..6889855 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -592,6 +592,7 @@
     field public static final int editTextStyle = 16842862; // 0x101006e
     field @Deprecated public static final int editable = 16843115; // 0x101016b
     field public static final int editorExtras = 16843300; // 0x1010224
+    field public static final int effectColor;
     field public static final int elegantTextHeight = 16843869; // 0x101045d
     field public static final int elevation = 16843840; // 0x1010440
     field public static final int ellipsize = 16842923; // 0x10100ab
@@ -12086,13 +12087,6 @@
     field public static final String ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED = "android.content.pm.action.CAN_INTERACT_ACROSS_PROFILES_CHANGED";
   }
 
-  public class DataLoaderParams {
-    method @NonNull public static final android.content.pm.DataLoaderParams forStreaming(@NonNull android.content.ComponentName, @NonNull String);
-    method @NonNull public final String getArguments();
-    method @NonNull public final android.content.ComponentName getComponentName();
-    method @NonNull public final int getType();
-  }
-
   public final class FeatureGroupInfo implements android.os.Parcelable {
     ctor public FeatureGroupInfo();
     ctor public FeatureGroupInfo(android.content.pm.FeatureGroupInfo);
@@ -12127,14 +12121,6 @@
     field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstallSourceInfo> CREATOR;
   }
 
-  public final class InstallationFile {
-    method public long getLengthBytes();
-    method public int getLocation();
-    method @Nullable public byte[] getMetadata();
-    method @NonNull public String getName();
-    method @Nullable public byte[] getSignature();
-  }
-
   public class InstrumentationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
     ctor public InstrumentationInfo();
     ctor public InstrumentationInfo(android.content.pm.InstrumentationInfo);
@@ -12331,9 +12317,6 @@
     field public static final String ACTION_SESSION_COMMITTED = "android.content.pm.action.SESSION_COMMITTED";
     field public static final String ACTION_SESSION_DETAILS = "android.content.pm.action.SESSION_DETAILS";
     field public static final String ACTION_SESSION_UPDATED = "android.content.pm.action.SESSION_UPDATED";
-    field public static final int DATA_LOADER_TYPE_NONE = 0; // 0x0
-    field public static final int DATA_LOADER_TYPE_STREAMING = 1; // 0x1
-    field public static final String EXTRA_DATA_LOADER_TYPE = "android.content.pm.extra.DATA_LOADER_TYPE";
     field public static final String EXTRA_OTHER_PACKAGE_NAME = "android.content.pm.extra.OTHER_PACKAGE_NAME";
     field public static final String EXTRA_PACKAGE_NAME = "android.content.pm.extra.PACKAGE_NAME";
     field public static final String EXTRA_SESSION = "android.content.pm.extra.SESSION";
@@ -12341,9 +12324,6 @@
     field public static final String EXTRA_STATUS = "android.content.pm.extra.STATUS";
     field public static final String EXTRA_STATUS_MESSAGE = "android.content.pm.extra.STATUS_MESSAGE";
     field public static final String EXTRA_STORAGE_PATH = "android.content.pm.extra.STORAGE_PATH";
-    field public static final int LOCATION_DATA_APP = 0; // 0x0
-    field public static final int LOCATION_MEDIA_DATA = 2; // 0x2
-    field public static final int LOCATION_MEDIA_OBB = 1; // 0x1
     field public static final int STATUS_FAILURE = 1; // 0x1
     field public static final int STATUS_FAILURE_ABORTED = 3; // 0x3
     field public static final int STATUS_FAILURE_BLOCKED = 2; // 0x2
@@ -12351,7 +12331,6 @@
     field public static final int STATUS_FAILURE_INCOMPATIBLE = 7; // 0x7
     field public static final int STATUS_FAILURE_INVALID = 4; // 0x4
     field public static final int STATUS_FAILURE_STORAGE = 6; // 0x6
-    field public static final int STATUS_PENDING_STREAMING = -2; // 0xfffffffe
     field public static final int STATUS_PENDING_USER_ACTION = -1; // 0xffffffff
     field public static final int STATUS_SUCCESS = 0; // 0x0
   }
@@ -12359,12 +12338,10 @@
   public static class PackageInstaller.Session implements java.io.Closeable {
     method public void abandon();
     method public void addChildSessionId(int);
-    method public void addFile(int, @NonNull String, long, @NonNull byte[], @Nullable byte[]);
     method public void close();
     method public void commit(@NonNull android.content.IntentSender);
     method public void fsync(@NonNull java.io.OutputStream) throws java.io.IOException;
     method @NonNull public int[] getChildSessionIds();
-    method @Nullable public android.content.pm.DataLoaderParams getDataLoaderParams();
     method @NonNull public String[] getNames() throws java.io.IOException;
     method public int getParentSessionId();
     method public boolean isMultiPackage();
@@ -12372,7 +12349,6 @@
     method @NonNull public java.io.InputStream openRead(@NonNull String) throws java.io.IOException;
     method @NonNull public java.io.OutputStream openWrite(@NonNull String, long, long) throws java.io.IOException;
     method public void removeChildSessionId(int);
-    method public void removeFile(int, @NonNull String);
     method public void removeSplit(@NonNull String) throws java.io.IOException;
     method @Deprecated public void setChecksums(@NonNull String, @NonNull java.util.List<android.content.pm.Checksum>, @Nullable byte[]) throws java.io.IOException;
     method public void setStagingProgress(float);
@@ -12443,7 +12419,6 @@
     method public void setAppLabel(@Nullable CharSequence);
     method public void setAppPackageName(@Nullable String);
     method @Deprecated public void setAutoRevokePermissionsMode(boolean);
-    method public void setDataLoaderParams(@NonNull android.content.pm.DataLoaderParams);
     method public void setInstallLocation(int);
     method public void setInstallReason(int);
     method public void setInstallScenario(int);
@@ -16817,8 +16792,10 @@
 
   public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
     ctor public RippleDrawable(@NonNull android.content.res.ColorStateList, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method @NonNull public android.content.res.ColorStateList getEffectColor();
     method public int getRadius();
-    method public void setColor(android.content.res.ColorStateList);
+    method public void setColor(@NonNull android.content.res.ColorStateList);
+    method public void setEffectColor(@NonNull android.content.res.ColorStateList);
     method public void setRadius(int);
     field public static final int RADIUS_AUTO = -1; // 0xffffffff
   }
@@ -24637,7 +24614,6 @@
 package android.media.metrics {
 
   public abstract class Event {
-    ctor protected Event(long);
     method @NonNull public android.os.Bundle getMetricsBundle();
     method @IntRange(from=0xffffffff) public long getTimeSinceCreatedMillis();
   }
@@ -24647,7 +24623,7 @@
     field @NonNull public static final android.media.metrics.LogSessionId LOG_SESSION_ID_NONE;
   }
 
-  public class MediaMetricsManager {
+  public final class MediaMetricsManager {
     method @NonNull public android.media.metrics.PlaybackSession createPlaybackSession();
     method @NonNull public android.media.metrics.RecordingSession createRecordingSession();
     field public static final long INVALID_TIMESTAMP = -1L; // 0xffffffffffffffffL
@@ -38369,25 +38345,6 @@
 
 }
 
-package android.service.dataloader {
-
-  public abstract class DataLoaderService extends android.app.Service {
-    ctor public DataLoaderService();
-    method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
-    method @Nullable public android.service.dataloader.DataLoaderService.DataLoader onCreateDataLoader(@NonNull android.content.pm.DataLoaderParams);
-  }
-
-  public static interface DataLoaderService.DataLoader {
-    method public boolean onCreate(@NonNull android.content.pm.DataLoaderParams, @NonNull android.service.dataloader.DataLoaderService.FileSystemConnector);
-    method public boolean onPrepareImage(@NonNull java.util.Collection<android.content.pm.InstallationFile>, @NonNull java.util.Collection<java.lang.String>);
-  }
-
-  public static final class DataLoaderService.FileSystemConnector {
-    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void writeData(@NonNull String, long, long, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
-  }
-
-}
-
 package android.service.dreams {
 
   public class DreamService extends android.app.Service implements android.view.Window.Callback {
@@ -40334,7 +40291,6 @@
     field public static final int DURATION_MEDIUM = 2; // 0x2
     field public static final int DURATION_SHORT = 1; // 0x1
     field public static final int DURATION_VERY_SHORT = 0; // 0x0
-    field public static final long ENABLE_GET_CALL_STATE_PERMISSION_PROTECTION = 157233955L; // 0x95f3323L
     field public static final String EXTRA_CALL_BACK_NUMBER = "android.telecom.extra.CALL_BACK_NUMBER";
     field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecom.extra.CALL_DISCONNECT_CAUSE";
     field public static final String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecom.extra.CALL_DISCONNECT_MESSAGE";
@@ -43105,18 +43061,11 @@
   public final class TrafficDescriptor implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public String getDataNetworkName();
-    method @Nullable public String getOsAppId();
+    method @Nullable public byte[] getOsAppId();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
     field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.TrafficDescriptor> CREATOR;
   }
 
-  public static final class TrafficDescriptor.Builder {
-    ctor public TrafficDescriptor.Builder();
-    method @NonNull public android.telephony.data.TrafficDescriptor build();
-    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setDataNetworkName(@NonNull String);
-    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setOsAppId(@NonNull String);
-  }
-
   public final class UrspRule implements android.os.Parcelable {
     method public int describeContents();
     method @IntRange(from=0x0, to=0xff) public int getPrecedence();
@@ -48570,7 +48519,7 @@
     method public android.view.View focusSearch(int);
     method public void forceHasOverlappingRendering(boolean);
     method public void forceLayout();
-    method @Nullable public void generateDisplayHash(@NonNull String, @Nullable android.graphics.Rect, @NonNull java.util.concurrent.Executor, @NonNull android.view.displayhash.DisplayHashResultCallback);
+    method public void generateDisplayHash(@NonNull String, @Nullable android.graphics.Rect, @NonNull java.util.concurrent.Executor, @NonNull android.view.displayhash.DisplayHashResultCallback);
     method public static int generateViewId();
     method public CharSequence getAccessibilityClassName();
     method public android.view.View.AccessibilityDelegate getAccessibilityDelegate();
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 93572cf..adbf18f 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -40,6 +40,7 @@
     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_DISPLAY_HASHING_SERVICE = "android.permission.BIND_DISPLAY_HASHING_SERVICE";
     field public static final String BIND_DOMAIN_VERIFICATION_AGENT = "android.permission.BIND_DOMAIN_VERIFICATION_AGENT";
     field public static final String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
     field public static final String BIND_EXTERNAL_STORAGE_SERVICE = "android.permission.BIND_EXTERNAL_STORAGE_SERVICE";
@@ -437,7 +438,8 @@
   public class AlarmManager {
     method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void set(int, long, long, long, android.app.PendingIntent, android.os.WorkSource);
     method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public void set(int, long, long, long, android.app.AlarmManager.OnAlarmListener, android.os.Handler, android.os.WorkSource);
-    method @RequiresPermission(android.Manifest.permission.SCHEDULE_PRIORITIZED_ALARM) public void setPrioritized(int, long, long, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.app.AlarmManager.OnAlarmListener);
+    method @RequiresPermission(allOf={android.Manifest.permission.UPDATE_DEVICE_STATS, android.Manifest.permission.SCHEDULE_EXACT_ALARM}, conditional=true) public void setExact(int, long, @Nullable String, @NonNull java.util.concurrent.Executor, @NonNull android.os.WorkSource, @NonNull android.app.AlarmManager.OnAlarmListener);
+    method @RequiresPermission(android.Manifest.permission.SCHEDULE_PRIORITIZED_ALARM) public void setPrioritized(int, long, long, @Nullable String, @NonNull java.util.concurrent.Executor, @NonNull android.app.AlarmManager.OnAlarmListener);
   }
 
   public class AppOpsManager {
@@ -2527,6 +2529,18 @@
 
   public class DataLoaderParams {
     method @NonNull public static final android.content.pm.DataLoaderParams forIncremental(@NonNull android.content.ComponentName, @NonNull String);
+    method @NonNull public static final android.content.pm.DataLoaderParams forStreaming(@NonNull android.content.ComponentName, @NonNull String);
+    method @NonNull public final String getArguments();
+    method @NonNull public final android.content.ComponentName getComponentName();
+    method @NonNull public final int getType();
+  }
+
+  public final class InstallationFile {
+    method public long getLengthBytes();
+    method public int getLocation();
+    method @Nullable public byte[] getMetadata();
+    method @NonNull public String getName();
+    method @Nullable public byte[] getSignature();
   }
 
   public final class InstantAppInfo implements android.os.Parcelable {
@@ -2620,10 +2634,19 @@
   public class PackageInstaller {
     method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setPermissionsResult(int, boolean);
     field public static final int DATA_LOADER_TYPE_INCREMENTAL = 2; // 0x2
+    field public static final int DATA_LOADER_TYPE_NONE = 0; // 0x0
+    field public static final int DATA_LOADER_TYPE_STREAMING = 1; // 0x1
+    field public static final String EXTRA_DATA_LOADER_TYPE = "android.content.pm.extra.DATA_LOADER_TYPE";
+    field public static final int LOCATION_DATA_APP = 0; // 0x0
+    field public static final int LOCATION_MEDIA_DATA = 2; // 0x2
+    field public static final int LOCATION_MEDIA_OBB = 1; // 0x1
   }
 
   public static class PackageInstaller.Session implements java.io.Closeable {
+    method @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public void addFile(int, @NonNull String, long, @NonNull byte[], @Nullable byte[]);
     method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void commitTransferred(@NonNull android.content.IntentSender);
+    method @Nullable @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public android.content.pm.DataLoaderParams getDataLoaderParams();
+    method @RequiresPermission("com.android.permission.USE_INSTALLER_V2") public void removeFile(int, @NonNull String);
   }
 
   public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
@@ -2644,6 +2667,7 @@
   public static class PackageInstaller.SessionParams implements android.os.Parcelable {
     method @RequiresPermission(android.Manifest.permission.ALLOCATE_AGGRESSIVE) public void setAllocateAggressive(boolean);
     method @Deprecated public void setAllowDowngrade(boolean);
+    method @RequiresPermission(allOf={android.Manifest.permission.INSTALL_PACKAGES, "com.android.permission.USE_INSTALLER_V2"}) public void setDataLoaderParams(@NonNull android.content.pm.DataLoaderParams);
     method public void setDontKillApp(boolean);
     method public void setEnableRollback(boolean);
     method public void setEnableRollback(boolean, int);
@@ -8368,6 +8392,7 @@
     field public static final int REASON_ACCOUNT_TRANSFER = 104; // 0x68
     field public static final int REASON_ACTIVITY_RECOGNITION = 103; // 0x67
     field public static final int REASON_GEOFENCING = 100; // 0x64
+    field public static final int REASON_LOCATION_PROVIDER = 312; // 0x138
     field public static final int REASON_OTHER = 1; // 0x1
     field public static final int REASON_PUSH_MESSAGING = 101; // 0x65
     field public static final int REASON_PUSH_MESSAGING_OVER_QUOTA = 102; // 0x66
@@ -8420,6 +8445,7 @@
     field @Deprecated public static final int EVENT_UNSPECIFIED = 0; // 0x0
     field @Deprecated public static final int REASON_ACTIVITY_RECOGNITION = 103; // 0x67
     field @Deprecated public static final int REASON_GEOFENCING = 100; // 0x64
+    field @Deprecated public static final int REASON_LOCATION_PROVIDER = 312; // 0x138
     field @Deprecated public static final int REASON_OTHER = 1; // 0x1
     field @Deprecated public static final int REASON_PUSH_MESSAGING = 101; // 0x65
     field @Deprecated public static final int REASON_PUSH_MESSAGING_OVER_QUOTA = 102; // 0x66
@@ -9815,12 +9841,30 @@
 
 }
 
+package android.service.dataloader {
+
+  public abstract class DataLoaderService extends android.app.Service {
+    ctor public DataLoaderService();
+    method @Nullable public android.service.dataloader.DataLoaderService.DataLoader onCreateDataLoader(@NonNull android.content.pm.DataLoaderParams);
+  }
+
+  public static interface DataLoaderService.DataLoader {
+    method public boolean onCreate(@NonNull android.content.pm.DataLoaderParams, @NonNull android.service.dataloader.DataLoaderService.FileSystemConnector);
+    method public boolean onPrepareImage(@NonNull java.util.Collection<android.content.pm.InstallationFile>, @NonNull java.util.Collection<java.lang.String>);
+  }
+
+  public static final class DataLoaderService.FileSystemConnector {
+    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void writeData(@NonNull String, long, long, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
+  }
+
+}
+
 package android.service.displayhash {
 
   public final class DisplayHashParams implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public android.util.Size getBufferSize();
-    method public boolean isGrayscaleBuffer();
+    method public boolean isUseGrayscale();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
     field @NonNull public static final android.os.Parcelable.Creator<android.service.displayhash.DisplayHashParams> CREATOR;
   }
@@ -9829,17 +9873,17 @@
     ctor public DisplayHashParams.Builder();
     method @NonNull public android.service.displayhash.DisplayHashParams build();
     method @NonNull public android.service.displayhash.DisplayHashParams.Builder setBufferSize(int, int);
-    method @NonNull public android.service.displayhash.DisplayHashParams.Builder setGrayscaleBuffer(boolean);
+    method @NonNull public android.service.displayhash.DisplayHashParams.Builder setUseGrayscale(boolean);
   }
 
-  public abstract class DisplayHasherService extends android.app.Service {
-    ctor public DisplayHasherService();
+  public abstract class DisplayHashingService extends android.app.Service {
+    ctor public DisplayHashingService();
     method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
-    method @Nullable public abstract void onGenerateDisplayHash(@NonNull byte[], @NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String, @NonNull android.view.displayhash.DisplayHashResultCallback);
+    method public abstract void onGenerateDisplayHash(@NonNull byte[], @NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String, @NonNull android.view.displayhash.DisplayHashResultCallback);
     method @NonNull public abstract java.util.Map<java.lang.String,android.service.displayhash.DisplayHashParams> onGetDisplayHashAlgorithms();
     method @Nullable public abstract android.view.displayhash.VerifiedDisplayHash onVerifyDisplayHash(@NonNull byte[], @NonNull android.view.displayhash.DisplayHash);
-    field public static final String SERVICE_INTERFACE = "android.service.displayhash.DisplayHasherService";
-    field public static final String SERVICE_META_DATA = "android.displayhash.display_hasher_service";
+    field public static final String SERVICE_INTERFACE = "android.service.displayhash.DisplayHashingService";
+    field public static final String SERVICE_META_DATA = "android.displayhash.display_hashing_service";
   }
 
 }
@@ -10181,7 +10225,7 @@
     ctor public RotationResolutionRequest(@NonNull String, int, int, boolean, long);
     method public int describeContents();
     method public int getCurrentRotation();
-    method @NonNull public String getPackageName();
+    method @NonNull public String getForegroundPackageName();
     method public int getProposedRotation();
     method public long getTimeoutMillis();
     method public boolean shouldUseCamera();
@@ -11065,10 +11109,6 @@
     field public static final String KEY_SUPPORT_CDMA_1X_VOICE_CALLS_BOOL = "support_cdma_1x_voice_calls_bool";
   }
 
-  public static final class CarrierConfigManager.Ims {
-    field public static final String KEY_PUBLISH_SERVICE_DESC_FEATURE_TAG_MAP_OVERRIDE_STRING_ARRAY = "ims.publish_service_desc_feature_tag_map_override_string_array";
-  }
-
   public static final class CarrierConfigManager.Wifi {
     field public static final String KEY_AVOID_5GHZ_SOFTAP_FOR_LAA_BOOL = "wifi.avoid_5ghz_softap_for_laa_bool";
     field public static final String KEY_AVOID_5GHZ_WIFI_DIRECT_FOR_LAA_BOOL = "wifi.avoid_5ghz_wifi_direct_for_laa_bool";
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 62922db..3ce2df8 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -657,6 +657,16 @@
     ctor public UsageStats();
   }
 
+  public static final class UsageStats.Builder {
+    ctor public UsageStats.Builder();
+    method @NonNull public android.app.usage.UsageStats build();
+    method @NonNull public android.app.usage.UsageStats.Builder setFirstTimeStamp(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setLastTimeStamp(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setLastTimeUsed(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setPackageName(@Nullable String);
+    method @NonNull public android.app.usage.UsageStats.Builder setTotalTimeInForeground(long);
+  }
+
   public final class UsageStatsManager {
     method public void forceUsageSourceSettingRead();
   }
@@ -1902,6 +1912,16 @@
     method public String getPath();
   }
 
+  public static final class StorageVolume.Builder {
+    ctor public StorageVolume.Builder(@NonNull String, @NonNull java.io.File, @NonNull String, @NonNull android.os.UserHandle, @NonNull String);
+    method @NonNull public android.os.storage.StorageVolume build();
+    method @NonNull public android.os.storage.StorageVolume.Builder setEmulated(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setPrimary(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setRemovable(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setStorageUuid(@Nullable java.util.UUID);
+    method @NonNull public android.os.storage.StorageVolume.Builder setUuid(@Nullable String);
+  }
+
 }
 
 package android.os.strictmode {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 45120b6..77f0cf8 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -8792,11 +8792,11 @@
      * @hide
      */
     public void updateUiTranslationState(int state, TranslationSpec sourceSpec,
-            TranslationSpec destSpec, List<AutofillId> viewIds) {
+            TranslationSpec targetSpec, List<AutofillId> viewIds) {
         if (mUiTranslationController == null) {
             mUiTranslationController = new UiTranslationController(this, getApplicationContext());
         }
-        mUiTranslationController.updateUiTranslationState(state, sourceSpec, destSpec, viewIds);
+        mUiTranslationController.updateUiTranslationState(state, sourceSpec, targetSpec, viewIds);
     }
 
     class HostCallbacks extends FragmentHostCallback<Activity> {
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 98fee9c..0acc4b3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1835,12 +1835,12 @@
 
         @Override
         public void updateUiTranslationState(IBinder activityToken, int state,
-                TranslationSpec sourceSpec, TranslationSpec destSpec, List<AutofillId> viewIds) {
+                TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds) {
             SomeArgs args = SomeArgs.obtain();
             args.arg1 = activityToken;
             args.arg2 = state;
             args.arg3 = sourceSpec;
-            args.arg4 = destSpec;
+            args.arg4 = targetSpec;
             args.arg5 = viewIds;
             sendMessage(H.UPDATE_UI_TRANSLATION_STATE, args);
         }
@@ -4169,13 +4169,13 @@
     }
 
     private void updateUiTranslationState(IBinder activityToken, int state,
-            TranslationSpec sourceSpec, TranslationSpec destSpec, List<AutofillId> viewIds) {
+            TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds) {
         final ActivityClientRecord r = mActivities.get(activityToken);
         if (r == null) {
             Log.w(TAG, "updateUiTranslationState(): no activity for " + activityToken);
             return;
         }
-        r.activity.updateUiTranslationState(state, sourceSpec, destSpec, viewIds);
+        r.activity.updateUiTranslationState(state, sourceSpec, targetSpec, viewIds);
     }
 
     private static final ThreadLocal<Intent> sCurrentBroadcastIntent = new ThreadLocal<Intent>();
diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl
index 78e7ce8..918309e 100644
--- a/core/java/android/app/IApplicationThread.aidl
+++ b/core/java/android/app/IApplicationThread.aidl
@@ -160,5 +160,5 @@
             IUiAutomationConnection instrumentationUiConnection,
             in ApplicationInfo targetInfo);
     void updateUiTranslationState(IBinder activityToken, int state, in TranslationSpec sourceSpec,
-            in TranslationSpec destSpec, in List<AutofillId> viewIds);
+            in TranslationSpec targetSpec, in List<AutofillId> viewIds);
 }
diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl
index e83557c..4f7c684 100644
--- a/core/java/android/app/IWallpaperManager.aidl
+++ b/core/java/android/app/IWallpaperManager.aidl
@@ -190,4 +190,18 @@
      * Called from SystemUI when it shows the AoD UI.
      */
     oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration);
+
+    /**
+     * Called from SystemUI when the device is waking up.
+     *
+     * @hide
+     */
+    oneway void notifyWakingUp(int x, int y, in Bundle extras);
+
+    /**
+     * Called from SystemUI when the device is going to sleep.
+     *
+     * @hide
+     */
+    void notifyGoingToSleep(int x, int y, in Bundle extras);
 }
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 6a71c92..8d332ab 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -190,6 +190,30 @@
     public static final String COMMAND_DROP = "android.home.drop";
 
     /**
+     * Command for {@link #sendWallpaperCommand}: reported by System UI when the device is waking
+     * up. The x and y arguments are a location (possibly very roughly) corresponding to the action
+     * that caused the device to wake up. For example, if the power button was pressed, this will be
+     * the location on the screen nearest the power button.
+     *
+     * If the location is unknown or not applicable, x and y will be -1.
+     *
+     * @hide
+     */
+    public static final String COMMAND_WAKING_UP = "android.wallpaper.wakingup";
+
+    /**
+     * Command for {@link #sendWallpaperCommand}: reported by System UI when the device is going to
+     * sleep. The x and y arguments are a location (possibly very roughly) corresponding to the
+     * action that caused the device to go to sleep. For example, if the power button was pressed,
+     * this will be the location on the screen nearest the power button.
+     *
+     * If the location is unknown or not applicable, x and y will be -1.
+     *
+     * @hide
+     */
+    public static final String COMMAND_GOING_TO_SLEEP = "android.wallpaper.goingtosleep";
+
+    /**
      * Command for {@link #sendWallpaperCommand}: reported when the wallpaper that was already
      * set is re-applied by the user.
      * @hide
diff --git a/core/java/android/app/timedetector/TimeDetector.java b/core/java/android/app/timedetector/TimeDetector.java
index 52016b6..a356230 100644
--- a/core/java/android/app/timedetector/TimeDetector.java
+++ b/core/java/android/app/timedetector/TimeDetector.java
@@ -32,6 +32,18 @@
 public interface TimeDetector {
 
     /**
+     * The name of the service for shell commands.
+     * @hide
+     */
+    String SHELL_COMMAND_SERVICE_NAME = "time_detector";
+
+    /**
+     * A shell command that prints the current "auto time detection" global setting value.
+     * @hide
+     */
+    String SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED = "is_auto_detection_enabled";
+
+    /**
      * A shared utility method to create a {@link ManualTimeSuggestion}.
      *
      * @hide
diff --git a/core/java/android/app/usage/UsageStats.java b/core/java/android/app/usage/UsageStats.java
index cda4634..b723140 100644
--- a/core/java/android/app/usage/UsageStats.java
+++ b/core/java/android/app/usage/UsageStats.java
@@ -31,6 +31,8 @@
 import static android.app.usage.UsageEvents.Event.USER_INTERACTION;
 
 import android.annotation.CurrentTimeMillisLong;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.compat.annotation.UnsupportedAppUsage;
@@ -760,4 +762,48 @@
             return new UsageStats[size];
         }
     };
+
+    /** @hide */
+    // This class is used by the mainline test suite, so we have to keep these APIs around across
+    // releases. Consider making this class public to help external developers to write tests as
+    // well.
+    @TestApi
+    public static final class Builder {
+        private final UsageStats mUsageStats = new UsageStats();
+
+        @NonNull
+        public UsageStats build() {
+            return mUsageStats;
+        }
+
+        @NonNull
+        public Builder setPackageName(@Nullable String packageName) {
+            mUsageStats.mPackageName = packageName;
+            return this;
+        }
+
+        @NonNull
+        public Builder setFirstTimeStamp(long firstTimeStamp) {
+            mUsageStats.mBeginTimeStamp = firstTimeStamp;
+            return this;
+        }
+
+        @NonNull
+        public Builder setLastTimeStamp(long lastTimeStamp) {
+            mUsageStats.mEndTimeStamp = lastTimeStamp;
+            return this;
+        }
+
+        @NonNull
+        public Builder setTotalTimeInForeground(long totalTimeInForeground) {
+            mUsageStats.mTotalTimeInForeground = totalTimeInForeground;
+            return this;
+        }
+
+        @NonNull
+        public Builder setLastTimeUsed(long lastTimeUsed) {
+            mUsageStats.mLastTimeUsed = lastTimeUsed;
+            return this;
+        }
+    }
 }
diff --git a/core/java/android/bluetooth/BluetoothA2dpSink.java b/core/java/android/bluetooth/BluetoothA2dpSink.java
index 6aba483..280e8bc 100755
--- a/core/java/android/bluetooth/BluetoothA2dpSink.java
+++ b/core/java/android/bluetooth/BluetoothA2dpSink.java
@@ -187,6 +187,8 @@
      * @hide
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public List<BluetoothDevice> getConnectedDevices() {
         if (VDBG) log("getConnectedDevices()");
         final IBluetoothA2dpSink service = getService();
@@ -208,6 +210,8 @@
      * @hide
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
         if (VDBG) log("getDevicesMatchingStates()");
         final IBluetoothA2dpSink service = getService();
@@ -229,6 +233,8 @@
      * @hide
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getConnectionState(BluetoothDevice device) {
         if (VDBG) log("getState(" + device + ")");
         final IBluetoothA2dpSink service = getService();
@@ -256,6 +262,8 @@
      * @hide
      */
     @RequiresLegacyBluetoothPermission
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public BluetoothAudioConfig getAudioConfig(BluetoothDevice device) {
         if (VDBG) log("getAudioConfig(" + device + ")");
         final IBluetoothA2dpSink service = getService();
diff --git a/core/java/android/bluetooth/BluetoothAvrcpController.java b/core/java/android/bluetooth/BluetoothAvrcpController.java
index 887cf3f..5148d5b 100644
--- a/core/java/android/bluetooth/BluetoothAvrcpController.java
+++ b/core/java/android/bluetooth/BluetoothAvrcpController.java
@@ -117,6 +117,8 @@
      * {@inheritDoc}
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public List<BluetoothDevice> getConnectedDevices() {
         if (VDBG) log("getConnectedDevices()");
         final IBluetoothAvrcpController service =
@@ -137,6 +139,8 @@
      * {@inheritDoc}
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
         if (VDBG) log("getDevicesMatchingStates()");
         final IBluetoothAvrcpController service =
@@ -157,6 +161,8 @@
      * {@inheritDoc}
      */
     @Override
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getConnectionState(BluetoothDevice device) {
         if (VDBG) log("getState(" + device + ")");
         final IBluetoothAvrcpController service =
@@ -178,6 +184,8 @@
      *
      * @return the {@link BluetoothAvrcpPlayerSettings} or {@link null} if there is an error.
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public BluetoothAvrcpPlayerSettings getPlayerSettings(BluetoothDevice device) {
         if (DBG) Log.d(TAG, "getPlayerSettings");
         BluetoothAvrcpPlayerSettings settings = null;
@@ -198,6 +206,8 @@
      * Sets the player app setting for current player.
      * returns true in case setting is supported by remote, false otherwise
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public boolean setPlayerApplicationSetting(BluetoothAvrcpPlayerSettings plAppSetting) {
         if (DBG) Log.d(TAG, "setPlayerApplicationSetting");
         final IBluetoothAvrcpController service =
@@ -218,6 +228,8 @@
      * Send Group Navigation Command to Remote.
      * possible keycode values: next_grp, previous_grp defined above
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public void sendGroupNavigationCmd(BluetoothDevice device, int keyCode, int keyState) {
         Log.d(TAG, "sendGroupNavigationCmd dev = " + device + " key " + keyCode + " State = "
                 + keyState);
diff --git a/core/java/android/bluetooth/BluetoothHeadsetClient.java b/core/java/android/bluetooth/BluetoothHeadsetClient.java
index 5816500d..eef42d1 100644
--- a/core/java/android/bluetooth/BluetoothHeadsetClient.java
+++ b/core/java/android/bluetooth/BluetoothHeadsetClient.java
@@ -1038,6 +1038,8 @@
      * #EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT}. This method invocation will fail silently when
      * feature is not supported.</p>
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public boolean getLastVoiceTagNumber(BluetoothDevice device) {
         if (DBG) log("getLastVoiceTagNumber()");
         final IBluetoothHeadsetClient service =
@@ -1059,6 +1061,8 @@
      * Note: This is an internal function and shouldn't be exposed
      */
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getAudioState(BluetoothDevice device) {
         if (VDBG) log("getAudioState");
         final IBluetoothHeadsetClient service =
@@ -1083,6 +1087,8 @@
      * @param allowed if routing is allowed to the device Note: This is an internal function and
      * shouldn't be exposed
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public void setAudioRouteAllowed(BluetoothDevice device, boolean allowed) {
         if (VDBG) log("setAudioRouteAllowed");
         final IBluetoothHeadsetClient service =
@@ -1106,6 +1112,8 @@
      * @return whether the command succeeded Note: This is an internal function and shouldn't be
      * exposed
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public boolean getAudioRouteAllowed(BluetoothDevice device) {
         if (VDBG) log("getAudioRouteAllowed");
         final IBluetoothHeadsetClient service =
diff --git a/core/java/android/bluetooth/BluetoothHearingAid.java b/core/java/android/bluetooth/BluetoothHearingAid.java
index 1fd779a..fa52eda 100644
--- a/core/java/android/bluetooth/BluetoothHearingAid.java
+++ b/core/java/android/bluetooth/BluetoothHearingAid.java
@@ -497,6 +497,8 @@
      * @param volume Absolute volume to be set on remote
      * @hide
      */
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public void setVolume(int volume) {
         if (DBG) Log.d(TAG, "setVolume(" + volume + ")");
 
@@ -556,6 +558,8 @@
      * @hide
      */
     @RequiresLegacyBluetoothPermission
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getDeviceSide(BluetoothDevice device) {
         if (VDBG) {
             log("getDeviceSide(" + device + ")");
@@ -582,6 +586,8 @@
      * @hide
      */
     @RequiresLegacyBluetoothPermission
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getDeviceMode(BluetoothDevice device) {
         if (VDBG) {
             log("getDeviceMode(" + device + ")");
diff --git a/core/java/android/bluetooth/BluetoothLeAudio.java b/core/java/android/bluetooth/BluetoothLeAudio.java
index c12b1f7..462c7b7 100644
--- a/core/java/android/bluetooth/BluetoothLeAudio.java
+++ b/core/java/android/bluetooth/BluetoothLeAudio.java
@@ -325,6 +325,8 @@
      */
     @NonNull
     @RequiresLegacyBluetoothPermission
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public List<BluetoothDevice> getActiveDevices() {
         if (VDBG) log("getActiveDevices()");
         try {
@@ -348,6 +350,8 @@
      * @hide
      */
     @RequiresLegacyBluetoothPermission
+    @RequiresBluetoothConnectPermission
+    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
     public int getGroupId(@NonNull BluetoothDevice device) {
         if (VDBG) log("getGroupId()");
         try {
diff --git a/core/java/android/bluetooth/le/BluetoothLeScanner.java b/core/java/android/bluetooth/le/BluetoothLeScanner.java
index 09cd11d..f27f22b 100644
--- a/core/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/core/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -442,6 +442,7 @@
             }
         }
 
+        @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN)
         public void stopLeScan() {
             synchronized (this) {
                 if (mScannerId <= 0) {
@@ -458,6 +459,7 @@
             }
         }
 
+        @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN)
         void flushPendingBatchResults() {
             synchronized (this) {
                 if (mScannerId <= 0) {
@@ -588,6 +590,7 @@
         }
     }
 
+    @SuppressLint("AndroidFrameworkBluetoothPermission")
     private void postCallbackError(final ScanCallback callback, final int errorCode) {
         mHandler.post(new Runnable() {
             @Override
diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java
index 368d1ee..f3e971a 100644
--- a/core/java/android/bluetooth/le/ScanSettings.java
+++ b/core/java/android/bluetooth/le/ScanSettings.java
@@ -20,6 +20,7 @@
 import android.bluetooth.BluetoothDevice;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.provider.DeviceConfig;
 
 /**
  * Bluetooth LE scan settings are passed to {@link BluetoothLeScanner#startScan} to define the
@@ -141,6 +142,12 @@
      */
     public static final int PHY_LE_ALL_SUPPORTED = 255;
 
+    /**
+     * The default floor value for report delays greater than 0 in
+     * {@link Builder#setReportDelay(long)}.
+     */
+    private static final long DEFAULT_REPORT_DELAY_FLOOR = 5000;
+
     // Bluetooth LE scan mode.
     private int mScanMode;
 
@@ -345,18 +352,28 @@
         }
 
         /**
-         * Set report delay timestamp for Bluetooth LE scan.
+         * Set report delay timestamp for Bluetooth LE scan. If set to 0, you will be notified of
+         * scan results immediately. If &gt; 0, scan results are queued up and delivered after the
+         * requested delay or 5000 milliseconds (whichever is higher). Note scan results may be
+         * delivered sooner if the internal buffers fill up.
          *
-         * @param reportDelayMillis Delay of report in milliseconds. Set to 0 to be notified of
-         * results immediately. Values &gt; 0 causes the scan results to be queued up and delivered
-         * after the requested delay or when the internal buffers fill up.
-         * @throws IllegalArgumentException If {@code reportDelayMillis} &lt; 0.
+         * @param reportDelayMillis         how frequently scan results should be delivered in
+         *                                  milliseconds
+         * @throws IllegalArgumentException if {@code reportDelayMillis} &lt; 0
          */
         public Builder setReportDelay(long reportDelayMillis) {
             if (reportDelayMillis < 0) {
                 throw new IllegalArgumentException("reportDelay must be > 0");
             }
-            mReportDelayMillis = reportDelayMillis;
+
+            long floor = DeviceConfig.getLong(DeviceConfig.NAMESPACE_BLUETOOTH, "report_delay",
+                    DEFAULT_REPORT_DELAY_FLOOR);
+
+            if (reportDelayMillis > 0 && reportDelayMillis < floor) {
+                mReportDelayMillis = floor;
+            } else {
+                mReportDelayMillis = reportDelayMillis;
+            }
             return this;
         }
 
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index f8d407d..3cc7ff8 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -5368,8 +5368,8 @@
     public static final String EXTRA_ATTRIBUTION_TAGS = "android.intent.extra.ATTRIBUTION_TAGS";
 
     /**
-     * A long representing the start timestamp (in millis) of the permission usage when used with
-     * {@link #ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD}
+     * A long representing the start timestamp (epoch time in millis) of the permission usage
+     * when used with {@link #ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD}
      *
      * @hide
      */
@@ -5377,8 +5377,8 @@
     public static final String EXTRA_START_TIME = "android.intent.extra.START_TIME";
 
     /**
-     * A long representing the end timestamp (in millis) of the permission usage when used with
-     * {@link #ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD}
+     * A long representing the end timestamp (epoch time in millis) of the permission usage when
+     * used with {@link #ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD}
      *
      * @hide
      */
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 6ad204e..9934b2a 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -2130,6 +2130,7 @@
      *
      * @hide
      */
+    @SuppressWarnings("AutoBoxing")
     @SystemApi
     @Nullable
     public Boolean hasRequestRawExternalStorageAccess() {
diff --git a/core/java/android/content/pm/DataLoaderParams.java b/core/java/android/content/pm/DataLoaderParams.java
index f808cfd..a6d3b45 100644
--- a/core/java/android/content/pm/DataLoaderParams.java
+++ b/core/java/android/content/pm/DataLoaderParams.java
@@ -24,7 +24,9 @@
  * This class represents the parameters used to configure a DataLoader.
  *
  * {@see android.service.dataloader.DataLoaderService.DataLoader}
+ * @hide
  */
+@SystemApi
 public class DataLoaderParams {
     @NonNull
     private final DataLoaderParamsParcel mData;
diff --git a/core/java/android/content/pm/InstallationFile.java b/core/java/android/content/pm/InstallationFile.java
index e764020..7e07c45 100644
--- a/core/java/android/content/pm/InstallationFile.java
+++ b/core/java/android/content/pm/InstallationFile.java
@@ -18,16 +18,18 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.SystemApi;
 
 /**
  * Definition of a file in a streaming installation session.
  * You can use this class to retrieve the information of such a file, such as its name, size and
  * metadata. These file attributes will be consistent with those used in:
- * {@code android.content.pm.PackageInstaller.Session#addFile}, when the file was first added
- * into the session.
+ * {@code PackageInstaller.Session#addFile}, when the file was first added into the session.
  *
  * @see android.content.pm.PackageInstaller.Session#addFile
+ * @hide
  */
+@SystemApi
 public final class InstallationFile {
     private final @NonNull InstallationFileParcel mParcel;
 
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 8b380b7..5157e08 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -229,12 +229,15 @@
 
     /**
      * Type of DataLoader for this session. Will be one of
-     * {@link #DATA_LOADER_TYPE_NONE}, {@link #DATA_LOADER_TYPE_STREAMING}.
+     * {@link #DATA_LOADER_TYPE_NONE}, {@link #DATA_LOADER_TYPE_STREAMING},
+     * {@link #DATA_LOADER_TYPE_INCREMENTAL}.
      * <p>
      * See the individual types documentation for details.
      *
      * @see Intent#getIntExtra(String, int)
+     * {@hide}
      */
+    @SystemApi
     public static final String EXTRA_DATA_LOADER_TYPE = "android.content.pm.extra.DATA_LOADER_TYPE";
 
     /**
@@ -242,6 +245,7 @@
      * Caller should make sure DataLoader is able to prepare image and reinitiate the operation.
      *
      * @see #EXTRA_SESSION_ID
+     * {@hide}
      */
     public static final int STATUS_PENDING_STREAMING = -2;
 
@@ -344,21 +348,25 @@
      * Default value, non-streaming installation session.
      *
      * @see #EXTRA_DATA_LOADER_TYPE
+     * {@hide}
      */
+    @SystemApi
     public static final int DATA_LOADER_TYPE_NONE = DataLoaderType.NONE;
 
     /**
      * Streaming installation using data loader.
      *
      * @see #EXTRA_DATA_LOADER_TYPE
+     * {@hide}
      */
+    @SystemApi
     public static final int DATA_LOADER_TYPE_STREAMING = DataLoaderType.STREAMING;
 
     /**
      * Streaming installation using Incremental FileSystem.
      *
      * @see #EXTRA_DATA_LOADER_TYPE
-     * @hide
+     * {@hide}
      */
     @SystemApi
     public static final int DATA_LOADER_TYPE_INCREMENTAL = DataLoaderType.INCREMENTAL;
@@ -366,13 +374,18 @@
     /**
      * Target location for the file in installation session is /data/app/<packageName>-<id>.
      * This is the intended location for APKs.
+     * Requires permission to install packages.
+     * {@hide}
      */
+    @SystemApi
     public static final int LOCATION_DATA_APP = InstallationFileLocation.DATA_APP;
 
     /**
      * Target location for the file in installation session is
      * /data/media/<userid>/Android/obb/<packageName>. This is the intended location for OBBs.
+     * {@hide}
      */
+    @SystemApi
     public static final int LOCATION_MEDIA_OBB = InstallationFileLocation.MEDIA_OBB;
 
     /**
@@ -380,7 +393,9 @@
      * /data/media/<userid>/Android/data/<packageName>.
      * This is the intended location for application data.
      * Can only be used by an app itself running under specific user.
+     * {@hide}
      */
+    @SystemApi
     public static final int LOCATION_MEDIA_DATA = InstallationFileLocation.MEDIA_DATA;
 
     /** @hide */
@@ -1152,7 +1167,10 @@
 
         /**
          * @return data loader params or null if the session is not using one.
+         * {@hide}
          */
+        @SystemApi
+        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
         public @Nullable DataLoaderParams getDataLoaderParams() {
             try {
                 DataLoaderParamsParcel data = mSession.getDataLoaderParams();
@@ -1189,7 +1207,11 @@
          * @throws IllegalStateException if called for non-streaming session
          *
          * @see android.content.pm.InstallationFile
+         *
+         * {@hide}
          */
+        @SystemApi
+        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
         public void addFile(@FileLocation int location, @NonNull String name, long lengthBytes,
                 @NonNull byte[] metadata, @Nullable byte[] signature) {
             try {
@@ -1209,8 +1231,11 @@
          * @param name name of a file, e.g. split.
          * @throws SecurityException if called after the session has been
          *             sealed or abandoned
-         * @throws IllegalStateException if called for non-streaming session
+         * @throws IllegalStateException if called for non-DataLoader session
+         * {@hide}
          */
+        @SystemApi
+        @RequiresPermission(android.Manifest.permission.USE_INSTALLER_V2)
         public void removeFile(@FileLocation int location, @NonNull String name) {
             try {
                 mSession.removeFile(location, name);
@@ -2026,7 +2051,13 @@
          * staging folder.
          *
          * @see android.service.dataloader.DataLoaderService.DataLoader
+         *
+         * {@hide}
          */
+        @SystemApi
+        @RequiresPermission(allOf = {
+                Manifest.permission.INSTALL_PACKAGES,
+                Manifest.permission.USE_INSTALLER_V2})
         public void setDataLoaderParams(@NonNull DataLoaderParams dataLoaderParams) {
             this.dataLoaderParams = dataLoaderParams;
         }
diff --git a/core/java/android/content/pm/parsing/component/ParsedAttribution.java b/core/java/android/content/pm/parsing/component/ParsedAttribution.java
index 3a4aae1..4ec2e73 100644
--- a/core/java/android/content/pm/parsing/component/ParsedAttribution.java
+++ b/core/java/android/content/pm/parsing/component/ParsedAttribution.java
@@ -40,7 +40,7 @@
     public static final int MAX_ATTRIBUTION_TAG_LEN = 50;
 
     /** Maximum amount of attributions per package */
-    private static final int MAX_NUM_ATTRIBUTIONS = 1000;
+    private static final int MAX_NUM_ATTRIBUTIONS = 10000;
 
     /** Tag of the attribution */
     public final @NonNull String tag;
@@ -100,7 +100,7 @@
 
 
 
-    // Code below generated by codegen v1.0.22.
+    // Code below generated by codegen v1.0.23.
     //
     // DO NOT MODIFY!
     // CHECKSTYLE:OFF Generated code
@@ -215,8 +215,8 @@
     };
 
     @DataClass.Generated(
-            time = 1607463855175L,
-            codegenVersion = "1.0.22",
+            time = 1618351459610L,
+            codegenVersion = "1.0.23",
             sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedAttribution.java",
             inputSignatures = "public static final  int MAX_ATTRIBUTION_TAG_LEN\nprivate static final  int MAX_NUM_ATTRIBUTIONS\npublic final @android.annotation.NonNull java.lang.String tag\npublic final @android.annotation.StringRes int label\npublic final @android.annotation.NonNull java.util.List<java.lang.String> inheritFrom\npublic static  boolean isCombinationValid(java.util.List<android.content.pm.parsing.component.ParsedAttribution>)\nclass ParsedAttribution extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genAidl=false)")
     @Deprecated
diff --git a/core/java/android/hardware/hdmi/HdmiAudioSystemClient.java b/core/java/android/hardware/hdmi/HdmiAudioSystemClient.java
index bdd5ab6..e7d76f6 100644
--- a/core/java/android/hardware/hdmi/HdmiAudioSystemClient.java
+++ b/core/java/android/hardware/hdmi/HdmiAudioSystemClient.java
@@ -63,7 +63,6 @@
      *
      * @hide
      */
-    // TODO(b/110094868): unhide and add @SystemApi for Q
     public interface SetSystemAudioModeCallback {
         /**
          * Called when the input was changed.
@@ -74,7 +73,6 @@
     }
 
     /** @hide */
-    // TODO(b/110094868): unhide and add @SystemApi for Q
     @Override
     public int getDeviceType() {
         return HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM;
@@ -143,7 +141,6 @@
      *
      * @hide
      */
-    // TODO(b/110094868): unhide and add @SystemApi for Q
     public void setSystemAudioMode(boolean state, @NonNull SetSystemAudioModeCallback callback) {
         // TODO(amyjojo): implement this when needed.
     }
@@ -156,7 +153,6 @@
      *
      * @hide
      */
-    // TODO(b/110094868): unhide and add @SystemApi for Q
     public void setSystemAudioModeOnForAudioOnlySource() {
         try {
             mService.setSystemAudioModeOnForAudioOnlySource();
diff --git a/core/java/android/hardware/hdmi/HdmiClient.java b/core/java/android/hardware/hdmi/HdmiClient.java
index a921215..0c21746 100644
--- a/core/java/android/hardware/hdmi/HdmiClient.java
+++ b/core/java/android/hardware/hdmi/HdmiClient.java
@@ -65,7 +65,6 @@
      * @param isPressed true if this is key press event
      *
      * @hide
-     * TODO(b/110094868): unhide for Q
      */
     public void sendVolumeKeyEvent(int keyCode, boolean isPressed) {
         try {
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index ad71f15..6079c57 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -1009,7 +1009,6 @@
      *
      * @return {@link HdmiAudioSystemClient} instance. {@code null} on failure.
      *
-     * TODO(b/110094868): unhide for Q
      * @hide
      */
     @Nullable
diff --git a/core/java/android/hardware/hdmi/HdmiUtils.java b/core/java/android/hardware/hdmi/HdmiUtils.java
index 8c94b78..2f4378e 100644
--- a/core/java/android/hardware/hdmi/HdmiUtils.java
+++ b/core/java/android/hardware/hdmi/HdmiUtils.java
@@ -24,7 +24,6 @@
 /**
  * Various utilities related to HDMI CEC.
  *
- * TODO(b/110094868): unhide for Q
  * @hide
  */
 public final class HdmiUtils {
@@ -84,7 +83,6 @@
     }
 
     /**
-     * TODO(b/110094868): unhide for Q
      * @hide
      */
     @Retention(RetentionPolicy.SOURCE)
@@ -95,49 +93,49 @@
     public @interface HdmiAddressRelativePosition {}
     /**
      * HDMI relative position is not determined.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_UNKNOWN = 0;
     /**
      * HDMI relative position: directly blow the device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_DIRECTLY_BELOW = 1;
     /**
      * HDMI relative position: indirectly below the device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_BELOW = 2;
     /**
      * HDMI relative position: the same device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_SAME = 3;
     /**
      * HDMI relative position: directly above the device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_DIRECTLY_ABOVE = 4;
     /**
      * HDMI relative position: indirectly above the device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_ABOVE = 5;
     /**
      * HDMI relative position: directly below a same device.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_SIBLING = 6;
     /**
      * HDMI relative position: different branch.
-     * TODO(b/110094868): unhide for Q
+     *
      * @hide
      */
     public static final int HDMI_RELATIVE_POSITION_DIFFERENT_BRANCH = 7;
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index f03da7c..4b8e37c 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -819,10 +819,9 @@
             if (dispatchOnShowInputRequested(flags, false)) {
                 showWindow(true);
                 applyVisibilityInInsetsConsumerIfNecessary(true /* setVisible */);
-            } else {
-                // If user uses hard keyboard, IME button should always be shown.
-                setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition);
             }
+            setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition);
+
             final boolean isVisible = isInputViewShown();
             final boolean visibilityChanged = isVisible != wasVisible;
             if (resultReceiver != null) {
diff --git a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
index 9d3462c..8950c4b 100644
--- a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
+++ b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
@@ -83,7 +83,7 @@
     /** Serializes an IkeSessionParams to a PersistableBundle. */
     @NonNull
     public static PersistableBundle toPersistableBundle(@NonNull IkeSessionParams params) {
-        if (params.getConfiguredNetwork() != null || params.getIke3gppExtension() != null) {
+        if (params.getNetwork() != null || params.getIke3gppExtension() != null) {
             throw new IllegalStateException(
                     "Cannot convert a IkeSessionParams with a caller configured network or with"
                             + " 3GPP extension enabled");
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index c47fc576..043a22b 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -21,6 +21,7 @@
 import static android.os.BatteryStatsManager.NUM_WIFI_SUPPL_STATES;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.ActivityManager;
 import android.app.job.JobParameters;
@@ -2622,6 +2623,15 @@
      */
     public abstract @Nullable long[] getCustomConsumerMeasuredBatteryConsumptionUC();
 
+    /**
+     * Returns the names of all {@link android.hardware.power.stats.EnergyConsumer}'s
+     * of (custom) energy consumer type
+     * {@link android.hardware.power.stats.EnergyConsumerType#OTHER}).
+     *
+     * {@hide}
+     */
+    public abstract @NonNull String[] getCustomEnergyConsumerNames();
+
     public static final BitDescription[] HISTORY_STATE_DESCRIPTIONS = new BitDescription[] {
         new BitDescription(HistoryItem.STATE_CPU_RUNNING_FLAG, "running", "r"),
         new BitDescription(HistoryItem.STATE_WAKE_LOCK_FLAG, "wake_lock", "w"),
diff --git a/core/java/android/os/CountDownTimer.java b/core/java/android/os/CountDownTimer.java
index c7bf0fd..51faa85 100644
--- a/core/java/android/os/CountDownTimer.java
+++ b/core/java/android/os/CountDownTimer.java
@@ -22,7 +22,22 @@
  *
  * Example of showing a 30 second countdown in a text field:
  *
- * <pre class="prettyprint">
+ * <div>
+ * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
+ * <pre class="prettyprint lang-kotlin">
+ * object : CountDownTimer(30000, 1000) {
+ *
+ *     override fun onTick(millisUntilFinished: Long) {
+ *         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000)
+ *     }
+ *
+ *     override fun onFinish() {
+ *         mTextField.setText("done!")
+ *     }
+ * }.start()
+ * </pre>
+ * </section><section><h3 id="java">Java</h3>
+ * <pre class="prettyprint lang-java">
  * new CountDownTimer(30000, 1000) {
  *
  *     public void onTick(long millisUntilFinished) {
@@ -32,8 +47,8 @@
  *     public void onFinish() {
  *         mTextField.setText("done!");
  *     }
- *  }.start();
- * </pre>
+ * }.start();
+ * </pre></section></div></div>
  *
  * The calls to {@link #onTick(long)} are synchronized to this object so that
  * one call to {@link #onTick(long)} won't ever occur before the previous
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index e3b13f4..b8bb353 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -623,7 +623,7 @@
        *         </tr>
        *         <tr>
        *             <td>summary.total-pss</td>
-       *             <td>Total PPS memory usage in kB.</td>
+       *             <td>Total PSS memory usage in kB.</td>
        *             <td>{@code 1442}</td>
        *             <td>23</td>
        *         </tr>
diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java
index 7a624e1..a537c98 100644
--- a/core/java/android/os/Parcelable.java
+++ b/core/java/android/os/Parcelable.java
@@ -27,10 +27,39 @@
  * and restored from a {@link Parcel}.  Classes implementing the Parcelable
  * interface must also have a non-null static field called <code>CREATOR</code>
  * of a type that implements the {@link Parcelable.Creator} interface.
- * 
+ *
  * <p>A typical implementation of Parcelable is:</p>
- * 
- * <pre>
+ *
+ * <div>
+ * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
+ * <pre class="prettyprint lang-kotlin">
+ * class MyParcelable private constructor(`in`: Parcel) : Parcelable {
+ *     private val mData: Int = `in`.readInt()
+ *
+ *     override fun describeContents(): Int {
+ *         return 0
+ *     }
+ *
+ *     override fun writeToParcel(out: Parcel, flags: Int) {
+ *         out.writeInt(mData)
+ *     }
+ *
+ *     companion object {
+ *         val CREATOR: Parcelable.Creator&lt;MyParcelable?&gt;
+ *                 = object : Parcelable.Creator&lt;MyParcelable?&gt; {
+ *             override fun createFromParcel(`in`: Parcel): MyParcelable? {
+ *                 return MyParcelable(`in`)
+ *             }
+ *
+ *             override fun newArray(size: Int): Array&lt;MyParcelable?&gt; {
+ *                 return arrayOfNulls(size)
+ *             }
+ *         }
+ *     }
+ * }
+ * </pre>
+ * </section><section><h3 id="java">Java</h3>
+ * <pre class="prettyprint lang-java">
  * public class MyParcelable implements Parcelable {
  *     private int mData;
  *
@@ -52,11 +81,11 @@
  *             return new MyParcelable[size];
  *         }
  *     };
- *     
+ *
  *     private MyParcelable(Parcel in) {
  *         mData = in.readInt();
  *     }
- * }</pre>
+ * }</pre></section></div></div>
  */
 public interface Parcelable {
     /** @hide */
diff --git a/core/java/android/os/incremental/V4Signature.java b/core/java/android/os/incremental/V4Signature.java
index 77d8664..688e3e9 100644
--- a/core/java/android/os/incremental/V4Signature.java
+++ b/core/java/android/os/incremental/V4Signature.java
@@ -41,6 +41,8 @@
     public static final int HASHING_ALGORITHM_SHA256 = 1;
     public static final byte LOG2_BLOCK_SIZE_4096_BYTES = 12;
 
+    public static final int INCFS_MAX_SIGNATURE_SIZE = 8096;  // incrementalfs.h
+
     /**
      * IncFS hashing data.
      */
@@ -191,8 +193,12 @@
 
     private static V4Signature readFrom(InputStream stream) throws IOException {
         final int version = readIntLE(stream);
-        final byte[] hashingInfo = readBytes(stream);
-        final byte[] signingInfo = readBytes(stream);
+        int maxSize = INCFS_MAX_SIGNATURE_SIZE;
+        final byte[] hashingInfo = readBytes(stream, maxSize);
+        if (hashingInfo != null) {
+            maxSize -= hashingInfo.length;
+        }
+        final byte[] signingInfo = readBytes(stream, maxSize);
         return new V4Signature(version, hashingInfo, signingInfo);
     }
 
@@ -231,9 +237,13 @@
         stream.write(buffer);
     }
 
-    private static byte[] readBytes(InputStream stream) throws IOException {
+    private static byte[] readBytes(InputStream stream, int maxSize) throws IOException {
         try {
             final int size = readIntLE(stream);
+            if (size > maxSize) {
+                throw new IOException(
+                        "Signature is too long. Max allowed is " + INCFS_MAX_SIGNATURE_SIZE);
+            }
             final byte[] bytes = new byte[size];
             readFully(stream, bytes);
             return bytes;
diff --git a/core/java/android/os/storage/StorageVolume.java b/core/java/android/os/storage/StorageVolume.java
index 36177c4..2adcbc3 100644
--- a/core/java/android/os/storage/StorageVolume.java
+++ b/core/java/android/os/storage/StorageVolume.java
@@ -20,6 +20,7 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.SuppressLint;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.compat.annotation.UnsupportedAppUsage;
@@ -551,4 +552,82 @@
         parcel.writeString8(mFsUuid);
         parcel.writeString8(mState);
     }
+
+    /** @hide */
+    // This class is used by the mainline test suite, so we have to keep these APIs around across
+    // releases. Consider making this class public to help external developers to write tests as
+    // well.
+    @TestApi
+    public static final class Builder {
+        private String mId;
+        private File mPath;
+        private String mDescription;
+        private boolean mPrimary;
+        private boolean mRemovable;
+        private boolean mEmulated;
+        private UserHandle mOwner;
+        private UUID mStorageUuid;
+        private String mUuid;
+        private String mState;
+
+        @SuppressLint("StreamFiles")
+        public Builder(
+                @NonNull String id, @NonNull File path, @NonNull String description,
+                @NonNull UserHandle owner, @NonNull String state) {
+            mId = id;
+            mPath = path;
+            mDescription = description;
+            mOwner = owner;
+            mState = state;
+        }
+
+        @NonNull
+        public Builder setStorageUuid(@Nullable UUID storageUuid) {
+            mStorageUuid = storageUuid;
+            return this;
+        }
+
+        @NonNull
+        public Builder setUuid(@Nullable String uuid) {
+            mUuid = uuid;
+            return this;
+        }
+
+        @NonNull
+        public Builder setPrimary(boolean primary) {
+            mPrimary = primary;
+            return this;
+        }
+
+        @NonNull
+        public Builder setRemovable(boolean removable) {
+            mRemovable = removable;
+            return this;
+        }
+
+        @NonNull
+        public Builder setEmulated(boolean emulated) {
+            mEmulated = emulated;
+            return this;
+        }
+
+        @NonNull
+        public StorageVolume build() {
+            return new StorageVolume(
+                    mId,
+                    mPath,
+                    /* internalPath= */ mPath,
+                    mDescription,
+                    mPrimary,
+                    mRemovable,
+                    mEmulated,
+                    /* allowMassStorage= */ false,
+                    /* maxFileSize= */ 0,
+                    mOwner,
+                    mStorageUuid,
+                    mUuid,
+                    mState);
+        }
+    }
+
 }
diff --git a/core/java/android/service/dataloader/DataLoaderService.java b/core/java/android/service/dataloader/DataLoaderService.java
index 63ec252..7e8acde 100644
--- a/core/java/android/service/dataloader/DataLoaderService.java
+++ b/core/java/android/service/dataloader/DataLoaderService.java
@@ -19,6 +19,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
+import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
 import android.content.pm.DataLoaderParams;
@@ -48,14 +49,19 @@
  *
  * @see android.content.pm.DataLoaderParams
  * @see android.content.pm.PackageInstaller.SessionParams#setDataLoaderParams
+ *
+ * @hide
  */
+@SystemApi
 public abstract class DataLoaderService extends Service {
     private static final String TAG = "DataLoaderService";
     private final DataLoaderBinderService mBinder = new DataLoaderBinderService();
 
     /**
      * DataLoader interface. Each instance corresponds to a single installation session.
+     * @hide
      */
+    @SystemApi
     public interface DataLoader {
         /**
          * A virtual constructor.
@@ -112,7 +118,9 @@
     /**
      * DataLoader factory method.
      * An installation session uses it to create an instance of DataLoader.
+     * @hide
      */
+    @SystemApi
     public @Nullable DataLoader onCreateDataLoader(@NonNull DataLoaderParams dataLoaderParams) {
         return null;
     }
@@ -178,7 +186,10 @@
 
     /**
      * Provides access to the installation image.
+     *
+     * @hide
      */
+    @SystemApi
     public static final class FileSystemConnector {
         /**
          * Create a wrapper for a native instance.
diff --git a/core/java/android/service/displayhash/DisplayHashParams.java b/core/java/android/service/displayhash/DisplayHashParams.java
index fcce91a..2ec9d5d 100644
--- a/core/java/android/service/displayhash/DisplayHashParams.java
+++ b/core/java/android/service/displayhash/DisplayHashParams.java
@@ -28,7 +28,7 @@
 import com.android.internal.util.DataClass;
 
 /**
- * Information passed from the {@link DisplayHasherService} to system server about how to get the
+ * Information passed from the {@link DisplayHashingService} to system server about how to get the
  * display data that will be used to generate the {@link android.view.displayhash.DisplayHash}
  *
  * @hide
@@ -38,9 +38,9 @@
 public final class DisplayHashParams implements Parcelable {
     /**
      * The size to scale the buffer to so the hash algorithm can properly generate the hash. The
-     * buffer given to the {@link DisplayHasherService#onGenerateDisplayHash(byte[], HardwareBuffer,
-     * Rect, String, DisplayHashResultCallback)} will be stretched based on the value set here.
-     * If {@code null}, the buffer size will not be changed.
+     * buffer given to the {@link DisplayHashingService#onGenerateDisplayHash(byte[],
+     * HardwareBuffer, Rect, String, DisplayHashResultCallback)} will be stretched based on the
+     * value set here. If {@code null}, the buffer size will not be changed.
      */
     @Nullable
     private final Size mBufferSize;
@@ -48,7 +48,7 @@
     /**
      * Whether the content will be captured in grayscale or color.
      */
-    private final boolean mGrayscaleBuffer;
+    private final boolean mUseGrayscale;
 
     /**
      * A builder for {@link DisplayHashParams}
@@ -56,7 +56,7 @@
     public static final class Builder {
         @Nullable
         private Size mBufferSize;
-        private boolean mGrayscaleBuffer;
+        private boolean mUseGrayscale;
 
         /**
          * Creates a new Builder.
@@ -68,8 +68,8 @@
          * The size to scale the buffer to so the hash algorithm can properly generate the hash.
          */
         @NonNull
-        public Builder setBufferSize(int w, int h) {
-            mBufferSize = new Size(w, h);
+        public Builder setBufferSize(int width, int height) {
+            mBufferSize = new Size(width, height);
             return this;
         }
 
@@ -77,15 +77,15 @@
          * Whether the content will be captured in grayscale or color.
          */
         @NonNull
-        public Builder setGrayscaleBuffer(boolean value) {
-            mGrayscaleBuffer = value;
+        public Builder setUseGrayscale(boolean useGrayscale) {
+            mUseGrayscale = useGrayscale;
             return this;
         }
 
         /** Builds the instance. This builder should not be touched after calling this! */
         @NonNull
         public DisplayHashParams build() {
-            return new DisplayHashParams(mBufferSize, mGrayscaleBuffer);
+            return new DisplayHashParams(mBufferSize, mUseGrayscale);
         }
     }
 
@@ -109,28 +109,28 @@
      *
      * @param bufferSize
      *   The size to scale the buffer to so the hash algorithm can properly generate the hash. The
-     *   buffer given to the {@link DisplayHasherService#onGenerateDisplayHash(byte[], HardwareBuffer,
-     *   Rect, String, DisplayHashResultCallback)} will be stretched based on the value set here.
-     *   If {@code null}, the buffer size will not be changed.
-     * @param grayscaleBuffer
+     *   buffer given to the {@link DisplayHashingService#onGenerateDisplayHash(byte[],
+     *   HardwareBuffer, Rect, String, DisplayHashResultCallback)} will be stretched based on the
+     *   value set here. If {@code null}, the buffer size will not be changed.
+     * @param useGrayscale
      *   Whether the content will be captured in grayscale or color.
      * @hide
      */
     @DataClass.Generated.Member
     public DisplayHashParams(
             @Nullable Size bufferSize,
-            boolean grayscaleBuffer) {
+            boolean useGrayscale) {
         this.mBufferSize = bufferSize;
-        this.mGrayscaleBuffer = grayscaleBuffer;
+        this.mUseGrayscale = useGrayscale;
 
         // onConstructed(); // You can define this method to get a callback
     }
 
     /**
      * The size to scale the buffer to so the hash algorithm can properly generate the hash. The
-     * buffer given to the {@link DisplayHasherService#onGenerateDisplayHash(byte[], HardwareBuffer,
-     * Rect, String, DisplayHashResultCallback)} will be stretched based on the value set here.
-     * If {@code null}, the buffer size will not be changed.
+     * buffer given to the {@link DisplayHashingService#onGenerateDisplayHash(byte[],
+     * HardwareBuffer, Rect, String, DisplayHashResultCallback)} will be stretched based on the
+     * value set here. If {@code null}, the buffer size will not be changed.
      */
     @DataClass.Generated.Member
     public @Nullable Size getBufferSize() {
@@ -141,8 +141,8 @@
      * Whether the content will be captured in grayscale or color.
      */
     @DataClass.Generated.Member
-    public boolean isGrayscaleBuffer() {
-        return mGrayscaleBuffer;
+    public boolean isUseGrayscale() {
+        return mUseGrayscale;
     }
 
     @Override
@@ -153,7 +153,7 @@
 
         return "DisplayHashParams { " +
                 "bufferSize = " + mBufferSize + ", " +
-                "grayscaleBuffer = " + mGrayscaleBuffer +
+                "useGrayscale = " + mUseGrayscale +
         " }";
     }
 
@@ -164,7 +164,7 @@
         // void parcelFieldName(Parcel dest, int flags) { ... }
 
         byte flg = 0;
-        if (mGrayscaleBuffer) flg |= 0x2;
+        if (mUseGrayscale) flg |= 0x2;
         if (mBufferSize != null) flg |= 0x1;
         dest.writeByte(flg);
         if (mBufferSize != null) dest.writeSize(mBufferSize);
@@ -182,11 +182,11 @@
         // static FieldType unparcelFieldName(Parcel in) { ... }
 
         byte flg = in.readByte();
-        boolean grayscaleBuffer = (flg & 0x2) != 0;
+        boolean useGrayscale = (flg & 0x2) != 0;
         Size bufferSize = (flg & 0x1) == 0 ? null : (Size) in.readSize();
 
         this.mBufferSize = bufferSize;
-        this.mGrayscaleBuffer = grayscaleBuffer;
+        this.mUseGrayscale = useGrayscale;
 
         // onConstructed(); // You can define this method to get a callback
     }
@@ -206,10 +206,10 @@
     };
 
     @DataClass.Generated(
-            time = 1617735166254L,
+            time = 1618436855096L,
             codegenVersion = "1.0.23",
             sourceFile = "frameworks/base/core/java/android/service/displayhash/DisplayHashParams.java",
-            inputSignatures = "private final @android.annotation.Nullable android.util.Size mBufferSize\nprivate final  boolean mGrayscaleBuffer\nclass DisplayHashParams extends java.lang.Object implements [android.os.Parcelable]\nprivate @android.annotation.Nullable android.util.Size mBufferSize\nprivate  boolean mGrayscaleBuffer\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams.Builder setBufferSize(int,int)\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams.Builder setGrayscaleBuffer(boolean)\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams build()\nclass Builder extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genAidl=true, genToString=true, genParcelable=true, genHiddenConstructor=true)")
+            inputSignatures = "private final @android.annotation.Nullable android.util.Size mBufferSize\nprivate final  boolean mUseGrayscale\nclass DisplayHashParams extends java.lang.Object implements [android.os.Parcelable]\nprivate @android.annotation.Nullable android.util.Size mBufferSize\nprivate  boolean mUseGrayscale\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams.Builder setBufferSize(int,int)\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams.Builder setUseGrayscale(boolean)\npublic @android.annotation.NonNull android.service.displayhash.DisplayHashParams build()\nclass Builder extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genAidl=true, genToString=true, genParcelable=true, genHiddenConstructor=true)")
     @Deprecated
     private void __metadata() {}
 
diff --git a/core/java/android/service/displayhash/DisplayHasherService.java b/core/java/android/service/displayhash/DisplayHashingService.java
similarity index 84%
rename from core/java/android/service/displayhash/DisplayHasherService.java
rename to core/java/android/service/displayhash/DisplayHashingService.java
index d300cf1..e8bb485 100644
--- a/core/java/android/service/displayhash/DisplayHasherService.java
+++ b/core/java/android/service/displayhash/DisplayHashingService.java
@@ -45,21 +45,21 @@
  * @hide
  */
 @SystemApi
-public abstract class DisplayHasherService extends Service {
+public abstract class DisplayHashingService extends Service {
 
     /** @hide **/
     public static final String EXTRA_VERIFIED_DISPLAY_HASH =
             "android.service.displayhash.extra.VERIFIED_DISPLAY_HASH";
 
     /**
-     * Name under which a DisplayHasherService component publishes information
+     * Name under which a DisplayHashingService component publishes information
      * about itself.  This meta-data must reference an XML resource containing a
-     * {@link com.android.internal.R.styleable#DisplayHasherService} tag.
+     * {@link com.android.internal.R.styleable#DisplayHashingService} tag.
      *
      * @hide
      */
     @SystemApi
-    public static final String SERVICE_META_DATA = "android.displayhash.display_hasher_service";
+    public static final String SERVICE_META_DATA = "android.displayhash.display_hashing_service";
 
     /**
      * The {@link Intent} action that must be declared as handled by a service in its manifest
@@ -69,18 +69,18 @@
      */
     @SystemApi
     public static final String SERVICE_INTERFACE =
-            "android.service.displayhash.DisplayHasherService";
+            "android.service.displayhash.DisplayHashingService";
 
-    private DisplayHasherServiceWrapper mWrapper;
+    private DisplayHashingServiceWrapper mWrapper;
     private Handler mHandler;
 
-    public DisplayHasherService() {
+    public DisplayHashingService() {
     }
 
     @Override
     public void onCreate() {
         super.onCreate();
-        mWrapper = new DisplayHasherServiceWrapper();
+        mWrapper = new DisplayHashingServiceWrapper();
         mHandler = new Handler(Looper.getMainLooper(), null, true);
     }
 
@@ -105,7 +105,6 @@
      *                      if successfully generated a DisplayHash or {@link
      *                      DisplayHashResultCallback#onDisplayHashError(int)} if failed.
      */
-    @Nullable
     public abstract void onGenerateDisplayHash(@NonNull byte[] salt,
             @NonNull HardwareBuffer buffer, @NonNull Rect bounds,
             @NonNull String hashAlgorithm, @NonNull DisplayHashResultCallback callback);
@@ -125,8 +124,8 @@
      *                    HardwareBuffer, Rect, String, DisplayHashResultCallback)} to
      *                    generate the token.
      * @param displayHash The token to verify that it was generated by the system.
-     * @return a {@link VerifiedDisplayHash} if the token was generated by the system or null
-     * if the token cannot be verified.
+     * @return a {@link VerifiedDisplayHash} if the provided display hash was originally generated
+     * by the system or null if the system did not generate the display hash.
      */
     @Nullable
     public abstract VerifiedDisplayHash onVerifyDisplayHash(@NonNull byte[] salt,
@@ -150,13 +149,13 @@
         callback.sendResult(data);
     }
 
-    private final class DisplayHasherServiceWrapper extends IDisplayHasherService.Stub {
+    private final class DisplayHashingServiceWrapper extends IDisplayHashingService.Stub {
         @Override
         public void generateDisplayHash(byte[] salt, HardwareBuffer buffer, Rect bounds,
                 String hashAlgorithm, RemoteCallback callback) {
             mHandler.sendMessage(
-                    obtainMessage(DisplayHasherService::onGenerateDisplayHash,
-                            DisplayHasherService.this, salt, buffer, bounds,
+                    obtainMessage(DisplayHashingService::onGenerateDisplayHash,
+                            DisplayHashingService.this, salt, buffer, bounds,
                             hashAlgorithm, new DisplayHashResultCallback() {
                                 @Override
                                 public void onDisplayHashResult(
@@ -179,14 +178,14 @@
         public void verifyDisplayHash(byte[] salt, DisplayHash displayHash,
                 RemoteCallback callback) {
             mHandler.sendMessage(
-                    obtainMessage(DisplayHasherService::verifyDisplayHash,
-                            DisplayHasherService.this, salt, displayHash, callback));
+                    obtainMessage(DisplayHashingService::verifyDisplayHash,
+                            DisplayHashingService.this, salt, displayHash, callback));
         }
 
         @Override
         public void getDisplayHashAlgorithms(RemoteCallback callback) {
-            mHandler.sendMessage(obtainMessage(DisplayHasherService::getDisplayHashAlgorithms,
-                    DisplayHasherService.this, callback));
+            mHandler.sendMessage(obtainMessage(DisplayHashingService::getDisplayHashAlgorithms,
+                    DisplayHashingService.this, callback));
         }
     }
 }
diff --git a/core/java/android/service/displayhash/IDisplayHasherService.aidl b/core/java/android/service/displayhash/IDisplayHashingService.aidl
similarity index 98%
rename from core/java/android/service/displayhash/IDisplayHasherService.aidl
rename to core/java/android/service/displayhash/IDisplayHashingService.aidl
index d9dcdca..56e1e0a 100644
--- a/core/java/android/service/displayhash/IDisplayHasherService.aidl
+++ b/core/java/android/service/displayhash/IDisplayHashingService.aidl
@@ -26,7 +26,7 @@
  *
  * @hide
  */
-oneway interface IDisplayHasherService {
+oneway interface IDisplayHashingService {
     /**
      * Generates the DisplayHash that can be used to validate that the system generated the token.
      *
diff --git a/core/java/android/service/rotationresolver/RotationResolutionRequest.java b/core/java/android/service/rotationresolver/RotationResolutionRequest.java
index 8c7db40..9b9244bd 100644
--- a/core/java/android/service/rotationresolver/RotationResolutionRequest.java
+++ b/core/java/android/service/rotationresolver/RotationResolutionRequest.java
@@ -42,7 +42,7 @@
 )
 public final class RotationResolutionRequest implements Parcelable {
     /** The Name of the package of the current fore-ground activity. */
-    @NonNull private final String mPackageName;
+    @NonNull private final String mForegroundPackageName;
 
     /** The current rotation of the screen. */
     @Surface.Rotation private final int mCurrentRotation;
@@ -75,7 +75,7 @@
     /**
      * Creates a new RotationResolutionRequest.
      *
-     * @param packageName
+     * @param foregroundPackageName
      *   The Name of the package of the current fore-ground activity.
      * @param currentRotation
      *   The current rotation of the screen.
@@ -88,14 +88,14 @@
      */
     @DataClass.Generated.Member
     public RotationResolutionRequest(
-            @NonNull String packageName,
+            @NonNull String foregroundPackageName,
             @Surface.Rotation int currentRotation,
             @Surface.Rotation int proposedRotation,
             boolean shouldUseCamera,
             @DurationMillisLong long timeoutMillis) {
-        this.mPackageName = packageName;
+        this.mForegroundPackageName = foregroundPackageName;
         com.android.internal.util.AnnotationValidations.validate(
-                NonNull.class, null, mPackageName);
+                NonNull.class, null, mForegroundPackageName);
         this.mCurrentRotation = currentRotation;
         com.android.internal.util.AnnotationValidations.validate(
                 Surface.Rotation.class, null, mCurrentRotation);
@@ -114,8 +114,8 @@
      * The Name of the package of the current fore-ground activity.
      */
     @DataClass.Generated.Member
-    public @NonNull String getPackageName() {
-        return mPackageName;
+    public @NonNull String getForegroundPackageName() {
+        return mForegroundPackageName;
     }
 
     /**
@@ -157,7 +157,7 @@
         // String fieldNameToString() { ... }
 
         return "RotationResolutionRequest { " +
-                "packageName = " + mPackageName + ", " +
+                "foregroundPackageName = " + mForegroundPackageName + ", " +
                 "currentRotation = " + mCurrentRotation + ", " +
                 "proposedRotation = " + mProposedRotation + ", " +
                 "shouldUseCamera = " + mShouldUseCamera + ", " +
@@ -174,7 +174,7 @@
         byte flg = 0;
         if (mShouldUseCamera) flg |= 0x8;
         dest.writeByte(flg);
-        dest.writeString(mPackageName);
+        dest.writeString(mForegroundPackageName);
         dest.writeInt(mCurrentRotation);
         dest.writeInt(mProposedRotation);
         dest.writeLong(mTimeoutMillis);
@@ -193,14 +193,14 @@
 
         byte flg = in.readByte();
         boolean shouldUseCamera = (flg & 0x8) != 0;
-        String packageName = in.readString();
+        String foregroundPackageName = in.readString();
         int currentRotation = in.readInt();
         int proposedRotation = in.readInt();
         long timeoutMillis = in.readLong();
 
-        this.mPackageName = packageName;
+        this.mForegroundPackageName = foregroundPackageName;
         com.android.internal.util.AnnotationValidations.validate(
-                NonNull.class, null, mPackageName);
+                NonNull.class, null, mForegroundPackageName);
         this.mCurrentRotation = currentRotation;
         com.android.internal.util.AnnotationValidations.validate(
                 Surface.Rotation.class, null, mCurrentRotation);
@@ -230,10 +230,10 @@
     };
 
     @DataClass.Generated(
-            time = 1617213094231L,
+            time = 1618447759819L,
             codegenVersion = "1.0.23",
             sourceFile = "frameworks/base/core/java/android/service/rotationresolver/RotationResolutionRequest.java",
-            inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.view.Surface.Rotation int mCurrentRotation\nprivate final @android.view.Surface.Rotation int mProposedRotation\nprivate final  boolean mShouldUseCamera\nprivate final @android.annotation.DurationMillisLong long mTimeoutMillis\nclass RotationResolutionRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genToString=true)")
+            inputSignatures = "private final @android.annotation.NonNull java.lang.String mForegroundPackageName\nprivate final @android.view.Surface.Rotation int mCurrentRotation\nprivate final @android.view.Surface.Rotation int mProposedRotation\nprivate final  boolean mShouldUseCamera\nprivate final @android.annotation.DurationMillisLong long mTimeoutMillis\nclass RotationResolutionRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genToString=true)")
     @Deprecated
     private void __metadata() {}
 
diff --git a/core/java/android/service/textservice/SpellCheckerService.java b/core/java/android/service/textservice/SpellCheckerService.java
index e492584..45f9743 100644
--- a/core/java/android/service/textservice/SpellCheckerService.java
+++ b/core/java/android/service/textservice/SpellCheckerService.java
@@ -421,7 +421,8 @@
             final ArrayList<SentenceWordItem> wordItems = new ArrayList<SentenceWordItem>();
             wordIterator.setCharSequence(originalText, 0, originalText.length());
             int wordEnd = wordIterator.following(start);
-            int wordStart = wordIterator.getBeginning(wordEnd);
+            int wordStart = wordEnd == BreakIterator.DONE ? BreakIterator.DONE
+                    : wordIterator.getBeginning(wordEnd);
             if (DBG) {
                 Log.d(TAG, "iterator: break: ---- 1st word start = " + wordStart + ", end = "
                         + wordEnd + "\n" + originalText);
diff --git a/core/java/android/service/translation/TranslationService.java b/core/java/android/service/translation/TranslationService.java
index a3bbdb9..b79e692 100644
--- a/core/java/android/service/translation/TranslationService.java
+++ b/core/java/android/service/translation/TranslationService.java
@@ -283,6 +283,5 @@
                         resultReceiver.send(TranslationManager.STATUS_SYNC_CALL_SUCCESS, bundle);
                     }
                 });
-
     }
 }
diff --git a/core/java/android/service/voice/HotwordDetectionService.java b/core/java/android/service/voice/HotwordDetectionService.java
index 23b2103..ea854e8 100644
--- a/core/java/android/service/voice/HotwordDetectionService.java
+++ b/core/java/android/service/voice/HotwordDetectionService.java
@@ -24,8 +24,11 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SdkConstant;
+import android.annotation.SuppressLint;
 import android.annotation.SystemApi;
 import android.app.Service;
+import android.content.ContentCaptureOptions;
+import android.content.Context;
 import android.content.Intent;
 import android.media.AudioFormat;
 import android.os.Bundle;
@@ -38,6 +41,8 @@
 import android.os.RemoteException;
 import android.os.SharedMemory;
 import android.util.Log;
+import android.view.contentcapture.ContentCaptureManager;
+import android.view.contentcapture.IContentCaptureManager;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.Retention;
@@ -122,6 +127,9 @@
 
     private Handler mHandler;
 
+    @Nullable
+    private ContentCaptureManager mContentCaptureManager;
+
     private final IHotwordDetectionService mInterface = new IHotwordDetectionService.Stub() {
         @Override
         public void detectFromDspSource(
@@ -187,6 +195,13 @@
                     Log.i(TAG, "Unsupported audio source " + audioSource);
             }
         }
+
+        @Override
+        public void updateContentCaptureManager(IContentCaptureManager manager,
+                ContentCaptureOptions options) {
+            mContentCaptureManager = new ContentCaptureManager(
+                    HotwordDetectionService.this, manager, options);
+        }
     };
 
     @CallSuper
@@ -207,6 +222,16 @@
         return null;
     }
 
+    @Override
+    @SuppressLint("OnNameExpected")
+    public @Nullable Object getSystemService(@ServiceName @NonNull String name) {
+        if (Context.CONTENT_CAPTURE_MANAGER_SERVICE.equals(name)) {
+            return mContentCaptureManager;
+        } else {
+            return super.getSystemService(name);
+        }
+    }
+
     /**
      * Called when the device hardware (such as a DSP) detected the hotword, to request second stage
      * validation before handing over the audio to the {@link AlwaysOnHotwordDetector}.
diff --git a/core/java/android/service/voice/IHotwordDetectionService.aidl b/core/java/android/service/voice/IHotwordDetectionService.aidl
index d242160..2ffe787 100644
--- a/core/java/android/service/voice/IHotwordDetectionService.aidl
+++ b/core/java/android/service/voice/IHotwordDetectionService.aidl
@@ -22,6 +22,8 @@
 import android.os.PersistableBundle;
 import android.os.SharedMemory;
 import android.service.voice.IDspHotwordDetectionCallback;
+import android.view.contentcapture.IContentCaptureManager;
+import android.content.ContentCaptureOptions;
 
 /**
  * Provide the interface to communicate with hotword detection service.
@@ -42,6 +44,12 @@
         in PersistableBundle options,
         in IDspHotwordDetectionCallback callback);
 
-    void updateState(in PersistableBundle options, in SharedMemory sharedMemory,
-            in IRemoteCallback callback);
+    void updateState(
+        in PersistableBundle options,
+        in SharedMemory sharedMemory,
+        in IRemoteCallback callback);
+
+    void updateContentCaptureManager(
+        in IContentCaptureManager contentCaptureManager,
+        in ContentCaptureOptions options);
 }
diff --git a/core/java/android/text/method/TranslationTransformationMethod.java b/core/java/android/text/method/TranslationTransformationMethod.java
index 7db999a8..54c0ffc 100644
--- a/core/java/android/text/method/TranslationTransformationMethod.java
+++ b/core/java/android/text/method/TranslationTransformationMethod.java
@@ -78,24 +78,11 @@
         if (TextUtils.isEmpty(translatedText) || isWhitespace(translatedText.toString())) {
             return source;
         } else {
-            // TODO(b/179693024): Remove this once we have the fix to pad the view text instead.
-            translatedText = ellipsize(translatedText, ((TextView) view).getText().length());
             // TODO(b/174283799): apply the spans to the text
             return translatedText;
         }
     }
 
-    private static CharSequence ellipsize(CharSequence text, int newLength) {
-        if (text.length() <= newLength) {
-            return text;
-        }
-        String ellipsis = String.valueOf('\u2026');
-        if (newLength == 1) {
-            return ellipsis;
-        }
-        return TextUtils.concat(TextUtils.trimToSize(text, newLength - 1), ellipsis);
-    }
-
     @Override
     public void onFocusChanged(View view, CharSequence sourceText,
             boolean focused, int direction,
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 2c81e89..83669fa 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -34,6 +34,7 @@
 import android.annotation.TestApi;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.graphics.Bitmap;
+import android.graphics.BLASTBufferQueue;
 import android.graphics.ColorSpace;
 import android.graphics.GraphicBuffer;
 import android.graphics.Matrix;
@@ -95,6 +96,7 @@
     private static native void nativeWriteToParcel(long nativeObject, Parcel out);
     private static native void nativeRelease(long nativeObject);
     private static native void nativeDisconnect(long nativeObject);
+    private static native void nativeUpdateDefaultBufferSize(long nativeObject, int width, int height);
     private static native int nativeCaptureDisplay(DisplayCaptureArgs captureArgs,
             ScreenCaptureListener captureListener);
     private static native int nativeCaptureLayers(LayerCaptureArgs captureArgs,
@@ -1083,6 +1085,11 @@
                 throw new IllegalStateException(
                         "Only buffer layers can set a valid buffer size.");
             }
+            boolean isBqLayer = isBufferQueueLayer();
+            if (isBqLayer) {
+                setBLASTLayer();
+            }
+
             return new SurfaceControl(
                     mSession, mName, mWidth, mHeight, mFormat, mFlags, mParent, mMetadata,
                     mLocalOwnerView, mCallsite);
@@ -1139,9 +1146,6 @@
             return setFlags(FX_SURFACE_NORMAL, FX_SURFACE_MASK);
         }
 
-        /**
-         * Set the initial size of the controlled surface's buffers in pixels.
-         */
         private void unsetBufferSize() {
             mWidth = 0;
             mHeight = 0;
@@ -1306,11 +1310,14 @@
             return  (mFlags & FX_SURFACE_EFFECT) == FX_SURFACE_EFFECT;
         }
 
+        private boolean isBufferQueueLayer() {
+            return (mFlags & FX_SURFACE_NORMAL) == FX_SURFACE_NORMAL;
+        }
+
         /**
          * @hide
          */
         public Builder setBLASTLayer() {
-            unsetBufferSize();
             return setFlags(FX_SURFACE_BLAST, FX_SURFACE_MASK);
         }
 
@@ -2595,6 +2602,16 @@
                 = sRegistry.registerNativeAllocation(this, mNativeObject);
         }
 
+        /**
+         * Create a transaction object that wraps a native peer.
+         * @hide
+         */
+        Transaction(long nativeObject) {
+            mNativeObject = nativeObject;
+            mFreeNativeResources =
+                sRegistry.registerNativeAllocation(this, mNativeObject);
+        }
+
         private Transaction(Parcel in) {
             readFromParcel(in);
         }
@@ -2649,8 +2666,7 @@
                 final Point size = mResizedSurfaces.valueAt(i);
                 final SurfaceControl surfaceControl = mResizedSurfaces.keyAt(i);
                 synchronized (surfaceControl.mLock) {
-                    surfaceControl.mWidth = size.x;
-                    surfaceControl.mHeight = size.y;
+                    surfaceControl.resize(size.x, size.y);
                 }
             }
             mResizedSurfaces.clear();
@@ -3566,4 +3582,13 @@
     public static Transaction getGlobalTransaction() {
         return sGlobalTransaction;
     }
+
+    /**
+     * @hide
+     */
+    public void resize(int w, int h) {
+        mWidth = w;
+        mHeight = h;
+        nativeUpdateDefaultBufferSize(mNativeObject, w, h);
+    }
 }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index d6b5a2c..a757295 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -30927,7 +30927,6 @@
      * @param executor The executor that the callback should be invoked on.
      * @param callback The callback to handle the results of generating the display hash
      */
-    @Nullable
     public void generateDisplayHash(@NonNull String hashAlgorithm,
             @Nullable Rect bounds, @NonNull Executor executor,
             @NonNull DisplayHashResultCallback callback) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index be8e519..3cfda57 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1355,6 +1355,16 @@
         }
     }
 
+    private void addASurfaceTransactionCallback() {
+        HardwareRenderer.ASurfaceTransactionCallback callback = (nativeTransactionObj,
+                                                                 nativeSurfaceControlObj,
+                                                                 frameNr) -> {
+            Transaction t = new Transaction(nativeTransactionObj);
+            mergeWithNextTransaction(t, frameNr);
+        };
+        mAttachInfo.mThreadedRenderer.setASurfaceTransactionCallback(callback);
+    }
+
     @UnsupportedAppUsage
     private void enableHardwareAcceleration(WindowManager.LayoutParams attrs) {
         mAttachInfo.mHardwareAccelerated = false;
@@ -1391,6 +1401,7 @@
                 final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets;
                 mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent,
                         attrs.getTitle().toString());
+                addASurfaceTransactionCallback();
                 mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                 updateColorModeIfNeeded(attrs.getColorMode());
                 updateForceDarkMode();
diff --git a/core/java/android/view/contentcapture/ContentCaptureEvent.java b/core/java/android/view/contentcapture/ContentCaptureEvent.java
index ce01469..ac45541 100644
--- a/core/java/android/view/contentcapture/ContentCaptureEvent.java
+++ b/core/java/android/view/contentcapture/ContentCaptureEvent.java
@@ -428,10 +428,11 @@
         }
         if (mNode != null) {
             final String className = mNode.getClassName();
-            if (mNode != null) {
-                string.append(", class=").append(className);
-            }
+            string.append(", class=").append(className);
             string.append(", id=").append(mNode.getAutofillId());
+            if (mNode.getText() != null) {
+                string.append(", text=").append(getSanitizedString(mNode.getText()));
+            }
         }
         if (mText != null) {
             string.append(", text=").append(getSanitizedString(mText));
diff --git a/core/java/android/view/displayhash/DisplayHash.java b/core/java/android/view/displayhash/DisplayHash.java
index 4148486..4ec0a59 100644
--- a/core/java/android/view/displayhash/DisplayHash.java
+++ b/core/java/android/view/displayhash/DisplayHash.java
@@ -16,6 +16,7 @@
 
 package android.view.displayhash;
 
+import android.annotation.CurrentTimeMillisLong;
 import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.graphics.Rect;
@@ -31,6 +32,7 @@
     /**
      * The timestamp when the hash was generated.
      */
+    @CurrentTimeMillisLong
     private final long mTimeMillis;
 
     /**
@@ -73,7 +75,7 @@
      * @hide
      */
     @SystemApi
-    public DisplayHash(long timeMillis, @NonNull Rect boundsInWindow,
+    public DisplayHash(@CurrentTimeMillisLong long timeMillis, @NonNull Rect boundsInWindow,
             @NonNull String hashAlgorithm, @NonNull byte[] imageHash, @NonNull byte[] hmac) {
         mTimeMillis = timeMillis;
         mBoundsInWindow = boundsInWindow;
@@ -92,6 +94,7 @@
      * @hide
      */
     @SystemApi
+    @CurrentTimeMillisLong
     public long getTimeMillis() {
         return mTimeMillis;
     }
diff --git a/core/java/android/view/displayhash/DisplayHashManager.java b/core/java/android/view/displayhash/DisplayHashManager.java
index 69dfc38..4f5fef6 100644
--- a/core/java/android/view/displayhash/DisplayHashManager.java
+++ b/core/java/android/view/displayhash/DisplayHashManager.java
@@ -35,7 +35,8 @@
 import java.util.Set;
 
 /**
- * Utility class for DisplayHash requests.
+ * Manages DisplayHash requests. The manager object can be retrieved by calling
+ * {@code Context.getSystemService(Context.DISPLAY_HASH_SERVICE)}
  */
 @SystemService(DISPLAY_HASH_SERVICE)
 public final class DisplayHashManager {
@@ -75,7 +76,7 @@
                 return sSupportedHashAlgorithms;
             } catch (RemoteException e) {
                 Log.e(TAG, "Failed to send request getSupportedHashingAlgorithms", e);
-                return Collections.emptySet();
+                throw e.rethrowFromSystemServer();
             }
         }
     }
@@ -93,7 +94,7 @@
             return WindowManagerGlobal.getWindowManagerService().verifyDisplayHash(displayHash);
         } catch (RemoteException e) {
             Log.e(TAG, "Failed to send request verifyImpressionToken", e);
-            return null;
+            throw e.rethrowFromSystemServer();
         }
     }
 
diff --git a/core/java/android/view/displayhash/VerifiedDisplayHash.java b/core/java/android/view/displayhash/VerifiedDisplayHash.java
index 16a428e..b17c068 100644
--- a/core/java/android/view/displayhash/VerifiedDisplayHash.java
+++ b/core/java/android/view/displayhash/VerifiedDisplayHash.java
@@ -16,6 +16,7 @@
 
 package android.view.displayhash;
 
+import android.annotation.CurrentTimeMillisLong;
 import android.annotation.NonNull;
 import android.graphics.Rect;
 import android.os.Parcelable;
@@ -30,6 +31,7 @@
     /**
      * The timestamp when the hash was generated.
      */
+    @CurrentTimeMillisLong
     private final long mTimeMillis;
 
     /**
@@ -78,7 +80,7 @@
 
 
 
-    // Code below generated by codegen v1.0.22.
+    // Code below generated by codegen v1.0.23.
     //
     // DO NOT MODIFY!
     // CHECKSTYLE:OFF Generated code
@@ -106,11 +108,13 @@
      */
     @DataClass.Generated.Member
     public VerifiedDisplayHash(
-            long timeMillis,
+            @CurrentTimeMillisLong long timeMillis,
             @NonNull Rect boundsInWindow,
             @NonNull String hashAlgorithm,
             @NonNull byte[] imageHash) {
         this.mTimeMillis = timeMillis;
+        com.android.internal.util.AnnotationValidations.validate(
+                CurrentTimeMillisLong.class, null, mTimeMillis);
         this.mBoundsInWindow = boundsInWindow;
         com.android.internal.util.AnnotationValidations.validate(
                 NonNull.class, null, mBoundsInWindow);
@@ -128,7 +132,7 @@
      * The timestamp when the hash was generated.
      */
     @DataClass.Generated.Member
-    public long getTimeMillis() {
+    public @CurrentTimeMillisLong long getTimeMillis() {
         return mTimeMillis;
     }
 
@@ -200,6 +204,8 @@
         byte[] imageHash = in.createByteArray();
 
         this.mTimeMillis = timeMillis;
+        com.android.internal.util.AnnotationValidations.validate(
+                CurrentTimeMillisLong.class, null, mTimeMillis);
         this.mBoundsInWindow = boundsInWindow;
         com.android.internal.util.AnnotationValidations.validate(
                 NonNull.class, null, mBoundsInWindow);
@@ -228,10 +234,10 @@
     };
 
     @DataClass.Generated(
-            time = 1613168749684L,
-            codegenVersion = "1.0.22",
+            time = 1617747271440L,
+            codegenVersion = "1.0.23",
             sourceFile = "frameworks/base/core/java/android/view/displayhash/VerifiedDisplayHash.java",
-            inputSignatures = "private final  long mTimeMillis\nprivate final @android.annotation.NonNull android.graphics.Rect mBoundsInWindow\nprivate final @android.annotation.NonNull java.lang.String mHashAlgorithm\nprivate final @android.annotation.NonNull byte[] mImageHash\nprivate  java.lang.String imageHashToString()\nprivate  java.lang.String byteArrayToString(byte[])\nclass VerifiedDisplayHash extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genAidl=true)")
+            inputSignatures = "private final @android.annotation.CurrentTimeMillisLong long mTimeMillis\nprivate final @android.annotation.NonNull android.graphics.Rect mBoundsInWindow\nprivate final @android.annotation.NonNull java.lang.String mHashAlgorithm\nprivate final @android.annotation.NonNull byte[] mImageHash\nprivate  java.lang.String imageHashToString()\nprivate  java.lang.String byteArrayToString(byte[])\nclass VerifiedDisplayHash extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genAidl=true)")
     @Deprecated
     private void __metadata() {}
 
diff --git a/core/java/android/view/translation/TranslationResponse.java b/core/java/android/view/translation/TranslationResponse.java
index f9b7012..eef283d 100644
--- a/core/java/android/view/translation/TranslationResponse.java
+++ b/core/java/android/view/translation/TranslationResponse.java
@@ -87,7 +87,7 @@
         /**
          * Adds {@link TranslationResponseValue} to be translated. The input
          * TranslationResponseValue format should match those provided by the
-         * {@link android.view.translation.Translator}'s destSpec.
+         * {@link android.view.translation.Translator}'s targetSpec.
          *
          * @param value the translated value.
          * @return this Builder.
@@ -109,7 +109,7 @@
         /**
          * Sets the list of {@link ViewTranslationResponse} to be translated. The input
          * ViewTranslationResponse contains {@link TranslationResponseValue}s whose  format should
-         * match those provided by the {@link android.view.translation.Translator}'s destSpec.
+         * match those provided by the {@link android.view.translation.Translator}'s targetSpec.
          *
          * @param response the translated response.
          * @return this Builder.
diff --git a/core/java/android/view/translation/UiTranslationController.java b/core/java/android/view/translation/UiTranslationController.java
index c09e8bd..b6d3d09 100644
--- a/core/java/android/view/translation/UiTranslationController.java
+++ b/core/java/android/view/translation/UiTranslationController.java
@@ -100,7 +100,7 @@
      * Update the Ui translation state.
      */
     public void updateUiTranslationState(@UiTranslationState int state, TranslationSpec sourceSpec,
-            TranslationSpec destSpec, List<AutofillId> views) {
+            TranslationSpec targetSpec, List<AutofillId> views) {
         if (!mActivity.isResumed() && (state == STATE_UI_TRANSLATION_STARTED
                 || state == STATE_UI_TRANSLATION_RESUMED)) {
             return;
@@ -113,11 +113,11 @@
         switch (state) {
             case STATE_UI_TRANSLATION_STARTED:
                 final Pair<TranslationSpec, TranslationSpec> specs =
-                        new Pair<>(sourceSpec, destSpec);
+                        new Pair<>(sourceSpec, targetSpec);
                 if (!mTranslators.containsKey(specs)) {
                     mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
                             UiTranslationController::createTranslatorAndStart,
-                            UiTranslationController.this, sourceSpec, destSpec, views));
+                            UiTranslationController.this, sourceSpec, targetSpec, views));
                 } else {
                     onUiTranslationStarted(mTranslators.get(specs), views);
                 }
@@ -362,17 +362,20 @@
                     continue;
                 }
                 mActivity.runOnUiThread(() -> {
-                    if (view.getViewTranslationCallback() == null) {
+                    final ViewTranslationCallback callback = view.getViewTranslationCallback();
+                    if (callback == null) {
                         if (DEBUG) {
                             Log.d(TAG, view + " doesn't support showing translation because of "
                                     + "null ViewTranslationCallback.");
                         }
                         return;
                     }
+
+                    // TODO: Do this for specific views on request only.
+                    callback.enableContentPadding();
+
                     view.onTranslationResponse(response);
-                    if (view.getViewTranslationCallback() != null) {
-                        view.getViewTranslationCallback().onShowTranslation(view);
-                    }
+                    callback.onShowTranslation(view);
                 });
             }
         }
@@ -383,12 +386,13 @@
      * translation when the Translator is created successfully.
      */
     @WorkerThread
-    private void createTranslatorAndStart(TranslationSpec sourceSpec, TranslationSpec destSpec,
+    private void createTranslatorAndStart(TranslationSpec sourceSpec, TranslationSpec targetSpec,
             List<AutofillId> views) {
-        final Translator translator = createTranslatorIfNeeded(sourceSpec, destSpec);
+        // Create Translator
+        final Translator translator = createTranslatorIfNeeded(sourceSpec, targetSpec);
         if (translator == null) {
-            Log.w(TAG, "Can not create Translator for sourceSpec:" + sourceSpec + " destSpec:"
-                    + destSpec);
+            Log.w(TAG, "Can not create Translator for sourceSpec:" + sourceSpec + " targetSpec:"
+                    + targetSpec);
             return;
         }
         onUiTranslationStarted(translator, views);
diff --git a/core/java/android/view/translation/UiTranslationManager.java b/core/java/android/view/translation/UiTranslationManager.java
index 62868ac..130e078 100644
--- a/core/java/android/view/translation/UiTranslationManager.java
+++ b/core/java/android/view/translation/UiTranslationManager.java
@@ -124,7 +124,7 @@
      * ActivityId)} instead.
      *
      * @param sourceSpec {@link TranslationSpec} for the data to be translated.
-     * @param destSpec {@link TranslationSpec} for the translated data.
+     * @param targetSpec {@link TranslationSpec} for the translated data.
      * @param viewIds A list of the {@link View}'s {@link AutofillId} which needs to be translated
      * @param taskId the Activity Task id which needs ui translation
      * @deprecated Use {@code startTranslation(TranslationSpec, TranslationSpec, List<AutofillId>,
@@ -137,17 +137,17 @@
     @RequiresPermission(android.Manifest.permission.MANAGE_UI_TRANSLATION)
     @SystemApi
     public void startTranslation(@NonNull TranslationSpec sourceSpec,
-            @NonNull TranslationSpec destSpec, @NonNull List<AutofillId> viewIds,
+            @NonNull TranslationSpec targetSpec, @NonNull List<AutofillId> viewIds,
             int taskId) {
         Objects.requireNonNull(sourceSpec);
-        Objects.requireNonNull(destSpec);
+        Objects.requireNonNull(targetSpec);
         Objects.requireNonNull(viewIds);
         if (viewIds.size() == 0) {
             throw new IllegalArgumentException("Invalid empty views: " + viewIds);
         }
         try {
             mService.updateUiTranslationStateByTaskId(STATE_UI_TRANSLATION_STARTED, sourceSpec,
-                    destSpec, viewIds, taskId, mContext.getUserId());
+                    targetSpec, viewIds, taskId, mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -157,11 +157,11 @@
      * Request ui translation for a given Views.
      *
      * @param sourceSpec {@link TranslationSpec} for the data to be translated.
-     * @param destSpec {@link TranslationSpec} for the translated data.
+     * @param targetSpec {@link TranslationSpec} for the translated data.
      * @param viewIds A list of the {@link View}'s {@link AutofillId} which needs to be translated
      * @param activityId the identifier for the Activity which needs ui translation
      * @throws IllegalArgumentException if the no {@link View}'s {@link AutofillId} in the list
-     * @throws NullPointerException the sourceSpec, destSpec, viewIds, activityId or
+     * @throws NullPointerException the sourceSpec, targetSpec, viewIds, activityId or
      *         {@link android.app.assist.ActivityId#getToken()} is {@code null}
      *
      * @hide
@@ -169,11 +169,11 @@
     @RequiresPermission(android.Manifest.permission.MANAGE_UI_TRANSLATION)
     @SystemApi
     public void startTranslation(@NonNull TranslationSpec sourceSpec,
-            @NonNull TranslationSpec destSpec, @NonNull List<AutofillId> viewIds,
+            @NonNull TranslationSpec targetSpec, @NonNull List<AutofillId> viewIds,
             @NonNull ActivityId activityId) {
         // TODO(b/177789967): Return result code or find a way to notify the status.
         Objects.requireNonNull(sourceSpec);
-        Objects.requireNonNull(destSpec);
+        Objects.requireNonNull(targetSpec);
         Objects.requireNonNull(viewIds);
         Objects.requireNonNull(activityId);
         Objects.requireNonNull(activityId.getToken());
@@ -182,7 +182,7 @@
         }
         try {
             mService.updateUiTranslationState(STATE_UI_TRANSLATION_STARTED, sourceSpec,
-                    destSpec, viewIds, activityId.getToken(), activityId.getTaskId(),
+                    targetSpec, viewIds, activityId.getToken(), activityId.getTaskId(),
                     mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -208,7 +208,7 @@
     public void finishTranslation(int taskId) {
         try {
             mService.updateUiTranslationStateByTaskId(STATE_UI_TRANSLATION_FINISHED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */, taskId,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */, taskId,
                     mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -232,7 +232,7 @@
             Objects.requireNonNull(activityId);
             Objects.requireNonNull(activityId.getToken());
             mService.updateUiTranslationState(STATE_UI_TRANSLATION_FINISHED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */,
                     activityId.getToken(), activityId.getTaskId(), mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -257,7 +257,7 @@
     public void pauseTranslation(int taskId) {
         try {
             mService.updateUiTranslationStateByTaskId(STATE_UI_TRANSLATION_PAUSED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */, taskId,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */, taskId,
                     mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -281,7 +281,7 @@
             Objects.requireNonNull(activityId);
             Objects.requireNonNull(activityId.getToken());
             mService.updateUiTranslationState(STATE_UI_TRANSLATION_PAUSED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */,
                     activityId.getToken(), activityId.getTaskId(), mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -306,7 +306,7 @@
     public void resumeTranslation(int taskId) {
         try {
             mService.updateUiTranslationStateByTaskId(STATE_UI_TRANSLATION_RESUMED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */,
                     taskId, mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -330,7 +330,7 @@
             Objects.requireNonNull(activityId);
             Objects.requireNonNull(activityId.getToken());
             mService.updateUiTranslationState(STATE_UI_TRANSLATION_RESUMED,
-                    null /* sourceSpec */, null /* destSpec*/, null /* viewIds */,
+                    null /* sourceSpec */, null /* targetSpec */, null /* viewIds */,
                     activityId.getToken(), activityId.getTaskId(), mContext.getUserId());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
diff --git a/core/java/android/view/translation/ViewTranslationCallback.java b/core/java/android/view/translation/ViewTranslationCallback.java
index c895984..78b4855 100644
--- a/core/java/android/view/translation/ViewTranslationCallback.java
+++ b/core/java/android/view/translation/ViewTranslationCallback.java
@@ -48,4 +48,16 @@
      * @return {@code true} if the View handles clearing the translation.
      */
     boolean onClearTranslation(@NonNull View view);
+
+    /**
+     * Enables padding on the view's original content.
+     * <p>
+     * This is useful when we do not modify the content directly, rather use a mechanism like
+     * {@link android.text.method.TransformationMethod}. If the app misbehaves when the displayed
+     * translation and the underlying content have different sizes, the platform intelligence can
+     * request that the original content be padded to make the sizes match.
+     *
+     * @hide
+     */
+    default void enableContentPadding() {}
 }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 40c79cf..1953a76 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -770,6 +770,8 @@
     private final boolean mUseInternationalizedInput;
     // True if fallback fonts that end up getting used should be allowed to affect line spacing.
     /* package */ boolean mUseFallbackLineSpacing;
+    // True if the view text can be padded for compat reasons, when the view is translated.
+    private final boolean mUseTextPaddingForUiTranslation;
 
     @ViewDebug.ExportedProperty(category = "text")
     @UnsupportedAppUsage
@@ -1480,6 +1482,8 @@
         final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion;
         mUseInternationalizedInput = targetSdkVersion >= VERSION_CODES.O;
         mUseFallbackLineSpacing = targetSdkVersion >= VERSION_CODES.P;
+        // TODO(b/179693024): Use a ChangeId instead.
+        mUseTextPaddingForUiTranslation = targetSdkVersion <= Build.VERSION_CODES.R;
 
         if (inputMethod != null) {
             Class<?> c;
@@ -2372,6 +2376,12 @@
     @ViewDebug.CapturedViewProperty
     @InspectableProperty
     public CharSequence getText() {
+        if (mUseTextPaddingForUiTranslation
+                && mDefaultTranslationCallback != null
+                && mDefaultTranslationCallback.isTextPaddingEnabled()
+                && mDefaultTranslationCallback.isShowingTranslation()) {
+            return mDefaultTranslationCallback.getPaddedText(mText, mTransformed);
+        }
         return mText;
     }
 
diff --git a/core/java/android/widget/TextViewTranslationCallback.java b/core/java/android/widget/TextViewTranslationCallback.java
index a479b8a..73f19a7 100644
--- a/core/java/android/widget/TextViewTranslationCallback.java
+++ b/core/java/android/widget/TextViewTranslationCallback.java
@@ -17,6 +17,7 @@
 package android.widget;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.os.Build;
 import android.text.method.TranslationTransformationMethod;
 import android.util.Log;
@@ -33,7 +34,7 @@
  */
 public class TextViewTranslationCallback implements ViewTranslationCallback {
 
-    private static final String TAG = "TextViewTranslationCallback";
+    private static final String TAG = "TextViewTranslationCb";
 
     // TODO(b/182433547): remove Build.IS_DEBUGGABLE before ship. Enable the logging in debug build
     //  to help the debug during the development phase
@@ -41,6 +42,9 @@
             || Build.IS_DEBUGGABLE;
 
     private TranslationTransformationMethod mTranslationTransformation;
+    private boolean mIsShowingTranslation = false;
+    private boolean mIsTextPaddingEnabled = false;
+    private CharSequence mPaddedText;
 
     /**
      * Invoked by the platform when receiving the successful {@link ViewTranslationResponse} for the
@@ -74,6 +78,7 @@
      */
     @Override
     public boolean onShowTranslation(@NonNull View view) {
+        mIsShowingTranslation = true;
         if (mTranslationTransformation != null) {
             ((TextView) view).setTransformationMethod(mTranslationTransformation);
         } else {
@@ -90,6 +95,7 @@
      */
     @Override
     public boolean onHideTranslation(@NonNull View view) {
+        mIsShowingTranslation = false;
         // Restore to original text content.
         if (mTranslationTransformation != null) {
             ((TextView) view).setTransformationMethod(
@@ -110,9 +116,9 @@
     public boolean onClearTranslation(@NonNull View view) {
         // Restore to original text content and clear TranslationTransformation
         if (mTranslationTransformation != null) {
-            ((TextView) view).setTransformationMethod(
-                    mTranslationTransformation.getOriginalTransformationMethod());
+            onHideTranslation(view);
             clearTranslationTransformation();
+            mPaddedText = null;
         } else {
             if (DEBUG) {
                 // TODO(b/182433547): remove before S release
@@ -121,4 +127,59 @@
         }
         return true;
     }
+
+    boolean isShowingTranslation() {
+        return mIsShowingTranslation;
+    }
+
+    @Override
+    public void enableContentPadding() {
+        mIsTextPaddingEnabled = true;
+    }
+
+    /**
+     * Returns whether readers of the view text should receive padded text for compatibility
+     * reasons. The view's original text will be padded to match the length of the translated text.
+     */
+    boolean isTextPaddingEnabled() {
+        return mIsTextPaddingEnabled;
+    }
+
+    /**
+     * Returns the view's original text with padding added. If the translated text isn't longer than
+     * the original text, returns the original text itself.
+     *
+     * @param text the view's original text
+     * @param translatedText the view's translated text
+     * @see #isTextPaddingEnabled()
+     */
+    @Nullable
+    CharSequence getPaddedText(CharSequence text, CharSequence translatedText) {
+        if (text == null) {
+            return null;
+        }
+        if (mPaddedText == null) {
+            mPaddedText = computePaddedText(text, translatedText);
+        }
+        return mPaddedText;
+    }
+
+    @NonNull
+    private CharSequence computePaddedText(CharSequence text, CharSequence translatedText) {
+        if (translatedText == null) {
+            return text;
+        }
+        int newLength = translatedText.length();
+        if (newLength <= text.length()) {
+            return text;
+        }
+        StringBuilder sb = new StringBuilder(newLength);
+        sb.append(text);
+        for (int i = text.length(); i < newLength; i++) {
+            sb.append(COMPAT_PAD_CHARACTER);
+        }
+        return sb;
+    }
+
+    private static final char COMPAT_PAD_CHARACTER = '\u2002';
 }
diff --git a/core/java/android/window/StartingWindowInfo.java b/core/java/android/window/StartingWindowInfo.java
index 08bb1a9..385d6cff 100644
--- a/core/java/android/window/StartingWindowInfo.java
+++ b/core/java/android/window/StartingWindowInfo.java
@@ -142,6 +142,12 @@
      */
     public boolean isKeyguardOccluded = false;
 
+    /**
+     * TaskSnapshot.
+     * @hide
+     */
+    public TaskSnapshot mTaskSnapshot;
+
     public StartingWindowInfo() {
 
     }
@@ -164,6 +170,7 @@
         dest.writeTypedObject(mainWindowLayoutParams, flags);
         dest.writeInt(splashScreenThemeResId);
         dest.writeBoolean(isKeyguardOccluded);
+        dest.writeTypedObject(mTaskSnapshot, flags);
     }
 
     void readFromParcel(@NonNull Parcel source) {
@@ -175,6 +182,7 @@
         mainWindowLayoutParams = source.readTypedObject(WindowManager.LayoutParams.CREATOR);
         splashScreenThemeResId = source.readInt();
         isKeyguardOccluded = source.readBoolean();
+        mTaskSnapshot = source.readTypedObject(TaskSnapshot.CREATOR);
     }
 
     @Override
diff --git a/core/java/com/android/internal/accessibility/dialog/AccessibilityTargetHelper.java b/core/java/com/android/internal/accessibility/dialog/AccessibilityTargetHelper.java
index 0854955..9d06bb9 100644
--- a/core/java/com/android/internal/accessibility/dialog/AccessibilityTargetHelper.java
+++ b/core/java/com/android/internal/accessibility/dialog/AccessibilityTargetHelper.java
@@ -230,6 +230,7 @@
                 context.getDrawable(R.drawable.ic_accessibility_color_inversion),
                 Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
 
+        // TODO: Update with shortcut icon
         final ToggleAllowListingFeatureTarget reduceBrightColors =
                 new ToggleAllowListingFeatureTarget(context,
                         shortcutType,
@@ -237,7 +238,7 @@
                                 REDUCE_BRIGHT_COLORS_COMPONENT_NAME.flattenToString()),
                         REDUCE_BRIGHT_COLORS_COMPONENT_NAME.flattenToString(),
                         context.getString(R.string.reduce_bright_colors_feature_name),
-                        context.getDrawable(R.drawable.ic_accessibility_reduce_bright_colors),
+                        null,
                         Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED);
 
         targets.add(magnification);
diff --git a/core/java/com/android/internal/app/IAppOpsCallback.aidl b/core/java/com/android/internal/app/IAppOpsCallback.aidl
index 15221b1..024ff66 100644
--- a/core/java/com/android/internal/app/IAppOpsCallback.aidl
+++ b/core/java/com/android/internal/app/IAppOpsCallback.aidl
@@ -17,7 +17,7 @@
 package com.android.internal.app;
 
 // This interface is also used by native code, so must
-// be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsCallback.h
+// be kept in sync with frameworks/native/libs/permission/include/binder/IAppOpsCallback.h
 oneway interface IAppOpsCallback {
     void opChanged(int op, int uid, String packageName);
 }
diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl
index 8a6856e..281702e 100644
--- a/core/java/com/android/internal/app/IAppOpsService.aidl
+++ b/core/java/com/android/internal/app/IAppOpsService.aidl
@@ -33,7 +33,7 @@
 
 interface IAppOpsService {
     // These methods are also called by native code, so must
-    // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h
+    // be kept in sync with frameworks/native/libs/permission/include/binder/IAppOpsService.h
     // and not be reordered
     int checkOperation(int code, int uid, String packageName);
     SyncNotedAppOp noteOperation(int code, int uid, String packageName, @nullable String attributionTag,
diff --git a/core/java/com/android/internal/infra/AbstractRemoteService.java b/core/java/com/android/internal/infra/AbstractRemoteService.java
index f63ac2e..8b24f64 100644
--- a/core/java/com/android/internal/infra/AbstractRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractRemoteService.java
@@ -88,7 +88,7 @@
     private final int mBindingFlags;
     protected I mService;
 
-    private boolean mBinding;
+    private boolean mConnecting;
     private boolean mDestroyed;
     private boolean mServiceDied;
     private boolean mCompleted;
@@ -228,7 +228,7 @@
         if (mService != null) {
             mService.asBinder().unlinkToDeath(this, 0);
         }
-        mBinding = false;
+        mConnecting = true;
         mService = null;
         mServiceDied = true;
         cancelScheduledUnbind();
@@ -435,10 +435,10 @@
     }
 
     private void handleEnsureBound() {
-        if (handleIsBound() || mBinding) return;
+        if (handleIsBound() || mConnecting) return;
 
         if (mVerbose) Slog.v(mTag, "ensureBound()");
-        mBinding = true;
+        mConnecting = true;
 
         final int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
                 | Context.BIND_INCLUDE_CAPABILITIES | mBindingFlags;
@@ -448,7 +448,7 @@
 
         if (!willBind) {
             Slog.w(mTag, "could not bind to " + mIntent + " using flags " + flags);
-            mBinding = false;
+            mConnecting = false;
 
             if (!mServiceDied) {
                 handleBinderDied();
@@ -457,10 +457,10 @@
     }
 
     private void handleEnsureUnbound() {
-        if (!handleIsBound() && !mBinding) return;
+        if (!handleIsBound() && !mConnecting) return;
 
         if (mVerbose) Slog.v(mTag, "ensureUnbound()");
-        mBinding = false;
+        mConnecting = false;
         if (handleIsBound()) {
             handleOnConnectedStateChangedInternal(false);
             if (mService != null) {
@@ -476,12 +476,12 @@
         @Override
         public void onServiceConnected(ComponentName name, IBinder service) {
             if (mVerbose) Slog.v(mTag, "onServiceConnected()");
-            if (mDestroyed || !mBinding) {
+            if (mDestroyed || !mConnecting) {
                 // This is abnormal. Unbinding the connection has been requested already.
                 Slog.wtf(mTag, "onServiceConnected() was dispatched after unbindService.");
                 return;
             }
-            mBinding = false;
+            mConnecting = false;
             try {
                 service.linkToDeath(AbstractRemoteService.this, 0);
             } catch (RemoteException re) {
@@ -496,7 +496,7 @@
         @Override
         public void onServiceDisconnected(ComponentName name) {
             if (mVerbose) Slog.v(mTag, "onServiceDisconnected()");
-            mBinding = true;
+            mConnecting = true;
             mService = null;
         }
 
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index cb1900f..b05a9f8 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -6951,7 +6951,8 @@
     /**
      * Returns the names of custom power components.
      */
-    public @NonNull String[] getCustomPowerComponentNames() {
+    @Override
+    public @NonNull String[] getCustomEnergyConsumerNames() {
         if (mGlobalMeasuredEnergyStats == null) {
             return new String[0];
         }
diff --git a/core/java/com/android/internal/os/BatteryUsageStatsProvider.java b/core/java/com/android/internal/os/BatteryUsageStatsProvider.java
index c3986c2..9ad7c15 100644
--- a/core/java/com/android/internal/os/BatteryUsageStatsProvider.java
+++ b/core/java/com/android/internal/os/BatteryUsageStatsProvider.java
@@ -21,6 +21,7 @@
 import android.os.BatteryStats;
 import android.os.BatteryUsageStats;
 import android.os.BatteryUsageStatsQuery;
+import android.os.SystemClock;
 import android.os.UidBatteryConsumer;
 import android.util.SparseArray;
 
@@ -36,12 +37,12 @@
  */
 public class BatteryUsageStatsProvider {
     private final Context mContext;
-    private final BatteryStatsImpl mStats;
+    private final BatteryStats mStats;
     private final PowerProfile mPowerProfile;
     private final Object mLock = new Object();
     private List<PowerCalculator> mPowerCalculators;
 
-    public BatteryUsageStatsProvider(Context context, BatteryStatsImpl stats) {
+    public BatteryUsageStatsProvider(Context context, BatteryStats stats) {
         mContext = context;
         mStats = stats;
         mPowerProfile = new PowerProfile(mContext);
@@ -97,7 +98,7 @@
             allowableStatsAge = Math.min(allowableStatsAge, query.getMaxStatsAge());
         }
 
-        return mStats.mClocks.elapsedRealtime() - lastUpdateTimeStampMs > allowableStatsAge;
+        return elapsedRealtime() - lastUpdateTimeStampMs > allowableStatsAge;
     }
 
     /**
@@ -120,10 +121,10 @@
      */
     @VisibleForTesting
     public BatteryUsageStats getBatteryUsageStats(BatteryUsageStatsQuery query) {
-        final long realtimeUs = mStats.mClocks.elapsedRealtime() * 1000;
-        final long uptimeUs = mStats.mClocks.uptimeMillis() * 1000;
+        final long realtimeUs = elapsedRealtime() * 1000;
+        final long uptimeUs = uptimeMillis() * 1000;
 
-        final String[] customPowerComponentNames = mStats.getCustomPowerComponentNames();
+        final String[] customPowerComponentNames = mStats.getCustomEnergyConsumerNames();
 
         // TODO(b/174186358): read extra time component number from configuration
         final int customTimeComponentCount = 0;
@@ -154,16 +155,22 @@
 
         if ((query.getFlags()
                 & BatteryUsageStatsQuery.FLAG_BATTERY_USAGE_STATS_INCLUDE_HISTORY) != 0) {
+            if (!(mStats instanceof BatteryStatsImpl)) {
+                throw new UnsupportedOperationException(
+                        "History cannot be included for " + getClass().getName());
+            }
+
+            BatteryStatsImpl batteryStatsImpl = (BatteryStatsImpl) mStats;
             ArrayList<BatteryStats.HistoryTag> tags = new ArrayList<>(
-                    mStats.mHistoryTagPool.size());
+                    batteryStatsImpl.mHistoryTagPool.size());
             for (Map.Entry<BatteryStats.HistoryTag, Integer> entry :
-                    mStats.mHistoryTagPool.entrySet()) {
+                    batteryStatsImpl.mHistoryTagPool.entrySet()) {
                 final BatteryStats.HistoryTag tag = entry.getKey();
                 tag.poolIdx = entry.getValue();
                 tags.add(tag);
             }
 
-            batteryUsageStatsBuilder.setBatteryHistory(mStats.mHistoryBuffer, tags);
+            batteryUsageStatsBuilder.setBatteryHistory(batteryStatsImpl.mHistoryBuffer, tags);
         }
 
         return batteryUsageStatsBuilder.build();
@@ -199,4 +206,20 @@
         return uid.getProcessStateTime(BatteryStats.Uid.PROCESS_STATE_BACKGROUND, realtimeUs,
                 BatteryStats.STATS_SINCE_CHARGED) / 1000;
     }
+
+    private long elapsedRealtime() {
+        if (mStats instanceof BatteryStatsImpl) {
+            return ((BatteryStatsImpl) mStats).mClocks.elapsedRealtime();
+        } else {
+            return SystemClock.elapsedRealtime();
+        }
+    }
+
+    private long uptimeMillis() {
+        if (mStats instanceof BatteryStatsImpl) {
+            return ((BatteryStatsImpl) mStats).mClocks.uptimeMillis();
+        } else {
+            return SystemClock.uptimeMillis();
+        }
+    }
 }
diff --git a/core/java/com/android/internal/os/BinderLatencyObserver.java b/core/java/com/android/internal/os/BinderLatencyObserver.java
index 4ca59be..0079801 100644
--- a/core/java/com/android/internal/os/BinderLatencyObserver.java
+++ b/core/java/com/android/internal/os/BinderLatencyObserver.java
@@ -157,7 +157,10 @@
                 FrameworkStatsLog.BINDER_LATENCY_REPORTED,
                 atom.getBytes(),
                 mPeriodicSamplingInterval,
-                1);
+                1,
+                mBucketCount,
+                mFirstBucketSize,
+                mBucketScaleFactor);
     }
 
     private void noteLatencyDelayed() {
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index 1673362..993e4e7 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -149,8 +149,11 @@
                     return null;
                 }
 
-                if (parsedArgs.mUsapPoolStatusSpecified) {
-                    // Handle this once we've released the argBuffer, to avoid opening a second one.
+                if (parsedArgs.mUsapPoolStatusSpecified
+                        || parsedArgs.mApiDenylistExemptions != null
+                        || parsedArgs.mHiddenApiAccessLogSampleRate != -1
+                        || parsedArgs.mHiddenApiAccessStatslogSampleRate != -1) {
+                    // Handle these once we've released argBuffer, to avoid opening a second one.
                     break;
                 }
 
@@ -183,18 +186,6 @@
                     return null;
                 }
 
-                if (parsedArgs.mApiDenylistExemptions != null) {
-                    return handleApiDenylistExemptions(zygoteServer,
-                            parsedArgs.mApiDenylistExemptions);
-                }
-
-                if (parsedArgs.mHiddenApiAccessLogSampleRate != -1
-                        || parsedArgs.mHiddenApiAccessStatslogSampleRate != -1) {
-                    return handleHiddenApiAccessLogSampleRate(zygoteServer,
-                            parsedArgs.mHiddenApiAccessLogSampleRate,
-                            parsedArgs.mHiddenApiAccessStatslogSampleRate);
-                }
-
                 if (parsedArgs.mPermittedCapabilities != 0
                         || parsedArgs.mEffectiveCapabilities != 0) {
                     throw new ZygoteSecurityException("Client may not specify capabilities: "
@@ -311,10 +302,20 @@
                 }
             }
         }
+        // Handle anything that may need a ZygoteCommandBuffer after we've released ours.
         if (parsedArgs.mUsapPoolStatusSpecified) {
-            // Now that we've released argBuffer:
             return handleUsapPoolStatusChange(zygoteServer, parsedArgs.mUsapPoolEnabled);
         }
+        if (parsedArgs.mApiDenylistExemptions != null) {
+            return handleApiDenylistExemptions(zygoteServer,
+                    parsedArgs.mApiDenylistExemptions);
+        }
+        if (parsedArgs.mHiddenApiAccessLogSampleRate != -1
+                || parsedArgs.mHiddenApiAccessStatslogSampleRate != -1) {
+            return handleHiddenApiAccessLogSampleRate(zygoteServer,
+                    parsedArgs.mHiddenApiAccessLogSampleRate,
+                    parsedArgs.mHiddenApiAccessStatslogSampleRate);
+        }
         throw new AssertionError("Shouldn't get here");
     }
 
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 4194acb..27f82f1 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -394,6 +394,14 @@
     }
 }
 
+static void nativeSetDefaultBufferSize(JNIEnv* env, jclass clazz, jlong nativeObject,
+                                       jint width, jint height) {
+    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
+    if (ctrl != NULL) {
+        ctrl->updateDefaultBufferSize(width, height);
+    }
+}
+
 static Rect rectFromObj(JNIEnv* env, jobject rectObj) {
     int left = env->GetIntField(rectObj, gRectClassInfo.left);
     int top = env->GetIntField(rectObj, gRectClassInfo.top);
@@ -1771,6 +1779,8 @@
             (void*)nativeRelease },
     {"nativeDisconnect", "(J)V",
             (void*)nativeDisconnect },
+    {"nativeUpdateDefaultBufferSize", "(JII)V",
+            (void*)nativeSetDefaultBufferSize},
     {"nativeCreateTransaction", "()J",
             (void*)nativeCreateTransaction },
     {"nativeApplyTransaction", "(JZ)V",
diff --git a/core/proto/android/internal/binder_latency.proto b/core/proto/android/internal/binder_latency.proto
index e32c3e3..8b11f5b 100644
--- a/core/proto/android/internal/binder_latency.proto
+++ b/core/proto/android/internal/binder_latency.proto
@@ -34,6 +34,7 @@
     UNKNOWN_PROCESS_SOURCE = 0;
     SYSTEM_SERVER = 1;
     TELEPHONY = 2;
+    BLUETOOTH = 3;
   }
 
   enum ServiceClassName {
@@ -74,4 +75,19 @@
   // Stores the count of samples for each bucket. The number of buckets and
   // their sizes are controlled server side with a flag.
   repeated int32 buckets = 3;
-}
\ No newline at end of file
+
+  // Params for histogram buckets.
+  // The number of buckets in the histogram. Store this value separately
+  // as the tail of empty buckets is truncated when stored in the proto to
+  // conserve space. Thus it is not possible to infer this value from there.
+  optional int32 bucket_count = 4;
+
+  // The size (upper bound) of the first bucket (used to avoid creating an
+  // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
+  // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
+  optional int32 first_bucket_size = 5;
+
+  // The rate in which each consecutive bucket increases (before rounding).
+  // Implemented in: com.android.internal.os.BinderLatencyBuckets.
+  optional float scale_factor = 6;
+}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 925a212..9d65e71 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -4099,6 +4099,15 @@
     <permission android:name="com.android.permission.INSTALL_EXISTING_PACKAGES"
         android:protectionLevel="signature|privileged" />
 
+    <!-- Allows an application to use the package installer v2 APIs.
+         <p>The package installer v2 APIs are still a work in progress and we're
+         currently validating they work in all scenarios.
+         <p>Not for use by third-party applications.
+         @hide
+    -->
+    <permission android:name="com.android.permission.USE_INSTALLER_V2"
+        android:protectionLevel="signature|installer" />
+
     <!-- Allows an application to use System Data Loaders.
          <p>Not for use by third-party applications.
          @hide
@@ -5673,12 +5682,12 @@
     <permission android:name="android.permission.CONTROL_DEVICE_STATE"
                 android:protectionLevel="signature" />
 
-    <!-- Must be required by a
-        {@link android.service.displayhash.DisplayHasherService}
+    <!-- @hide @SystemApi Must be required by a
+        {@link android.service.displayhash.DisplayHashingService}
         to ensure that only the system can bind to it.
-        @hide This is not a third-party API (intended for OEMs and system apps).
+        This is not a third-party API (intended for OEMs and system apps).
     -->
-    <permission android:name="android.permission.BIND_DISPLAY_HASHER_SERVICE"
+    <permission android:name="android.permission.BIND_DISPLAY_HASHING_SERVICE"
         android:protectionLevel="signature" />
 
     <!-- @hide @TestApi Allows an application to enable/disable toast rate limiting.
diff --git a/core/res/res/drawable/btn_borderless_material.xml b/core/res/res/drawable/btn_borderless_material.xml
index 1a0912e..08e1060 100644
--- a/core/res/res/drawable/btn_borderless_material.xml
+++ b/core/res/res/drawable/btn_borderless_material.xml
@@ -15,8 +15,7 @@
 -->
 
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-        android:color="?attr/colorControlHighlight"
-        android:rippleStyle="?attr/rippleStyle">
+        android:color="?attr/colorControlHighlight">
     <item android:id="@id/mask"
           android:drawable="@drawable/btn_default_mtrl_shape" />
 </ripple>
diff --git a/core/res/res/drawable/btn_colored_material.xml b/core/res/res/drawable/btn_colored_material.xml
index 5274ef2..7ba21e8 100644
--- a/core/res/res/drawable/btn_colored_material.xml
+++ b/core/res/res/drawable/btn_colored_material.xml
@@ -19,8 +19,7 @@
        android:insetTop="@dimen/button_inset_vertical_material"
        android:insetRight="@dimen/button_inset_horizontal_material"
        android:insetBottom="@dimen/button_inset_vertical_material">
-    <ripple android:color="?attr/colorControlHighlight"
-            android:rippleStyle="?attr/rippleStyle">
+    <ripple android:color="?attr/colorControlHighlight">
         <item>
             <shape android:shape="rectangle"
                    android:tint="@color/btn_colored_background_material">
diff --git a/core/res/res/drawable/btn_default_material.xml b/core/res/res/drawable/btn_default_material.xml
index 6a9e621..ed2b5aa 100644
--- a/core/res/res/drawable/btn_default_material.xml
+++ b/core/res/res/drawable/btn_default_material.xml
@@ -15,7 +15,6 @@
 -->
 
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
-        android:color="?attr/colorControlHighlight"
-        android:rippleStyle="?attr/rippleStyle">
+        android:color="?attr/colorControlHighlight">
     <item android:drawable="@drawable/btn_default_mtrl_shape" />
 </ripple>
diff --git a/core/res/res/drawable/btn_toggle_material.xml b/core/res/res/drawable/btn_toggle_material.xml
index 7cee382..8b19e4a 100644
--- a/core/res/res/drawable/btn_toggle_material.xml
+++ b/core/res/res/drawable/btn_toggle_material.xml
@@ -21,8 +21,7 @@
        android:insetBottom="@dimen/button_inset_vertical_material">
     <layer-list android:paddingMode="stack">
         <item>
-            <ripple android:color="?attr/colorControlHighlight"
-                android:rippleStyle="?attr/rippleStyle">
+            <ripple android:color="?attr/colorControlHighlight">
                 <item>
                     <shape android:shape="rectangle"
                            android:tint="?attr/colorButtonNormal">
diff --git a/core/res/res/drawable/ic_accessibility_reduce_bright_colors.xml b/core/res/res/drawable/ic_accessibility_reduce_bright_colors.xml
deleted file mode 100644
index 1e840d2..0000000
--- a/core/res/res/drawable/ic_accessibility_reduce_bright_colors.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<!--
-     Copyright (C) 2021 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>
-        <shape android:shape="oval">
-            <solid
-                android:color="@color/GM2_grey_700"/>
-            <size
-                android:height="@dimen/accessibility_icon_size"
-                android:width="@dimen/accessibility_icon_size"/>
-        </shape>
-    </item>
-    <item
-        android:gravity="center">
-        <vector
-            android:width="@dimen/accessibility_icon_foreground_size"
-            android:height="@dimen/accessibility_icon_foreground_size"
-            android:viewportWidth="24"
-            android:viewportHeight="24">
-            <path
-                android:pathData="M17,12.1L15.59,10.69L13.05,13.22V7.05H11.05V13.22L8.51,10.69L7.1,12.1L12.05,17.05L17,12.1Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M2.05,13.05H4.05C4.6,13.05 5.05,12.6 5.05,12.05C5.05,11.5 4.6,11.05 4.05,11.05H2.05C1.5,11.05 1.05,11.5 1.05,12.05C1.05,12.6 1.5,13.05 2.05,13.05Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M20.05,13.05H22.05C22.6,13.05 23.05,12.6 23.05,12.05C23.05,11.5 22.6,11.05 22.05,11.05H20.05C19.5,11.05 19.05,11.5 19.05,12.05C19.05,12.6 19.5,13.05 20.05,13.05Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M11.05,2.05V4.05C11.05,4.6 11.5,5.05 12.05,5.05C12.6,5.05 13.05,4.6 13.05,4.05V2.05C13.05,1.5 12.6,1.05 12.05,1.05C11.5,1.05 11.05,1.5 11.05,2.05Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M11.05,20.05V22.05C11.05,22.6 11.5,23.05 12.05,23.05C12.6,23.05 13.05,22.6 13.05,22.05V20.05C13.05,19.5 12.6,19.05 12.05,19.05C11.5,19.05 11.05,19.5 11.05,20.05Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M6.04,4.63C5.65,4.24 5.01,4.24 4.63,4.63C4.24,5.02 4.24,5.66 4.63,6.04L5.69,7.1C6.08,7.49 6.72,7.49 7.1,7.1C7.49,6.71 7.49,6.07 7.1,5.69L6.04,4.63Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M18.41,17C18.02,16.61 17.38,16.61 17,17C16.61,17.39 16.61,18.03 17,18.41L18.06,19.47C18.45,19.86 19.09,19.86 19.47,19.47C19.86,19.08 19.86,18.44 19.47,18.06L18.41,17Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M19.47,6.04C19.86,5.65 19.86,5.01 19.47,4.63C19.08,4.24 18.44,4.24 18.06,4.63L17,5.69C16.61,6.08 16.61,6.72 17,7.1C17.39,7.49 18.03,7.49 18.41,7.1L19.47,6.04Z"
-                android:fillColor="#ffffff"/>
-            <path
-                android:pathData="M7.1,18.41C7.49,18.02 7.49,17.38 7.1,17C6.71,16.61 6.07,16.61 5.69,17L4.63,18.06C4.24,18.45 4.24,19.09 4.63,19.47C5.02,19.86 5.66,19.86 6.04,19.47L7.1,18.41Z"
-                android:fillColor="#ffffff"/>
-        </vector>
-    </item>
-</layer-list>
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 5d260d5..445bac5 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Maak toe"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Antwoord"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Wys af"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Lui af"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Inkomende oproep"</string>
diff --git a/core/res/res/values-az/strings.xml b/core/res/res/values-az/strings.xml
index ed86bf4..69e0400 100644
--- a/core/res/res/values-az/strings.xml
+++ b/core/res/res/values-az/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Qapadın"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Cavab verin"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"İmtina edin"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Dəstəyi asın"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Gələn zəng"</string>
diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml
index df8aa33..5a7e890 100644
--- a/core/res/res/values-b+sr+Latn/strings.xml
+++ b/core/res/res/values-b+sr+Latn/strings.xml
@@ -1960,8 +1960,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Zatvori"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Odgovori"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Odbij"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Prekini vezu"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Dolazni poziv"</string>
diff --git a/core/res/res/values-bs/strings.xml b/core/res/res/values-bs/strings.xml
index 315efea..195b8f7 100644
--- a/core/res/res/values-bs/strings.xml
+++ b/core/res/res/values-bs/strings.xml
@@ -1960,8 +1960,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Zatvori"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Odgovori"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Videozapis"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Odbaci"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Prekini vezu"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Dolazni poziv"</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index e0c5376..0448954 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -1734,13 +1734,13 @@
     <string name="accessibility_shortcut_off" msgid="3651336255403648739">"Nezapínat"</string>
     <string name="accessibility_shortcut_menu_item_status_on" msgid="6608392117189732543">"ZAP"</string>
     <string name="accessibility_shortcut_menu_item_status_off" msgid="5531598275559472393">"VYP"</string>
-    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"Chcete službě <xliff:g id="SERVICE">%1$s</xliff:g> povolit, aby nad vaším zařízením měla plnou kontrolu?"</string>
+    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"Chcete službě <xliff:g id="SERVICE">%1$s</xliff:g> povolit plnou kontrolu nad vaším zařízením?"</string>
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"Pokud zapnete službu <xliff:g id="SERVICE">%1$s</xliff:g>, zařízení nebude používat zámek obrazovky k vylepšení šifrování dat."</string>
-    <string name="accessibility_service_warning_description" msgid="291674995220940133">"Plná kontrola je vhodná u aplikací, které vám pomáhají s usnadněním přístupu, nikoli u většiny aplikací."</string>
+    <string name="accessibility_service_warning_description" msgid="291674995220940133">"Plná kontrola je vhodná u aplikací, které vám pomáhají s usnadněním přístupu. U většiny aplikací však vhodná není."</string>
     <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"Zobrazení a ovládání obrazovky"</string>
-    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"Může číst veškerý obsah obrazovky a zobrazovat obsah přes ostatní aplikace."</string>
+    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"Služba může číst veškerý obsah obrazovky a zobrazovat ho přes ostatní aplikace."</string>
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"Zobrazení a provádění akcí"</string>
-    <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"Může sledovat vaše interakce s aplikací nebo hardwarovým senzorem a komunikovat s aplikacemi namísto vás."</string>
+    <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"Služba může sledovat vaše interakce s aplikací nebo hardwarovým senzorem a komunikovat s aplikacemi namísto vás."</string>
     <string name="accessibility_dialog_button_allow" msgid="2092558122987144530">"Povolit"</string>
     <string name="accessibility_dialog_button_deny" msgid="4129575637812472671">"Zakázat"</string>
     <string name="accessibility_select_shortcut_menu_title" msgid="6002726538854613272">"Chcete-li některou funkci začít používat, klepněte na ni:"</string>
@@ -2343,5 +2343,5 @@
     <string name="splash_screen_view_icon_description" msgid="180638751260598187">"Ikona aplikace"</string>
     <string name="splash_screen_view_branding_description" msgid="7911129347402728216">"Image značky aplikace"</string>
     <string name="view_and_control_notification_title" msgid="4300765399209912240">"Zkontrolujte nastavení přístupu"</string>
-    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> může zobrazit a ovládat tuto obrazovku. Klepnutím to zkontrolujete."</string>
+    <string name="view_and_control_notification_content" msgid="8003766498562604034">"Tuto obrazovku může zobrazit a ovládat služba <xliff:g id="SERVICE_NAME">%s</xliff:g>. Klepnutím to zkontrolujete."</string>
 </resources>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index 0379bac..1e58aed 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Sule"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Vasta"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Keeldu"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Lõpeta kõne"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Sissetulev kõne"</string>
diff --git a/core/res/res/values-fr-rCA/strings.xml b/core/res/res/values-fr-rCA/strings.xml
index f5f19b6..3d22748 100644
--- a/core/res/res/values-fr-rCA/strings.xml
+++ b/core/res/res/values-fr-rCA/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Fermer"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g> : <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Répondre"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Vidéo"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Refuser"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Raccrocher"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Appel entrant"</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index f5abb4c..190d561 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"बंद करें"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"जवाब दें"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"वीडियो"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"अस्वीकार करें"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"कॉल काटें"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"आने वाला (इनकमिंग) कॉल"</string>
@@ -2263,7 +2262,7 @@
     <string name="config_pdp_reject_user_authentication_failed" msgid="4531693033885744689"></string>
     <string name="config_pdp_reject_service_not_subscribed" msgid="8190338397128671588"></string>
     <string name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" msgid="6024904218067254186"></string>
-    <string name="window_magnification_prompt_title" msgid="2876703640772778215">"ज़ूम करके देखने की नई सुविधा उपलब्ध है"</string>
+    <string name="window_magnification_prompt_title" msgid="2876703640772778215">"ज़ूम करने की सुविधा वाली नई सेटिंग"</string>
     <string name="window_magnification_prompt_content" msgid="8159173903032344891">"अब आप अपनी स्क्रीन के किसी हिस्से को ज़ूम करके देख सकते हैं"</string>
     <string name="turn_on_magnification_settings_action" msgid="8521433346684847700">"सेटिंग में जाकर, इस सुविधा को चालू करें"</string>
     <string name="dismiss_action" msgid="1728820550388704784">"खारिज करें"</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index c2e3ab8..28fb400 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -1960,8 +1960,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Zatvori"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Odgovori"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Videozapis"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Odbij"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Prekini"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Dolazni poziv"</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 0bc815b..b3134a7 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -1405,7 +1405,7 @@
     <string name="usb_power_notification_message" msgid="7284765627437897702">"המכשיר המחובר בטעינה. יש להקיש לאפשרויות נוספות."</string>
     <string name="usb_unsupported_audio_accessory_title" msgid="2335775548086533065">"המכשיר זיהה התקן אודיו אנלוגי"</string>
     <string name="usb_unsupported_audio_accessory_message" msgid="1300168007129796621">"ההתקן שחיברת לא תואם לטלפון הזה. יש להקיש לקבלת מידע נוסף."</string>
-    <string name="adb_active_notification_title" msgid="408390247354560331">"‏ניפוי באגים של USB מחובר"</string>
+    <string name="adb_active_notification_title" msgid="408390247354560331">"‏ניפוי באגים ב-USB מחובר"</string>
     <string name="adb_active_notification_message" msgid="5617264033476778211">"‏יש להקיש כדי לכבות את ניפוי הבאגים ב-USB"</string>
     <string name="adb_active_notification_message" product="tv" msgid="6624498401272780855">"‏יש ללחוץ על ההתראה כדי להשבית ניפוי באגים ב-USB."</string>
     <string name="adbwifi_active_notification_title" msgid="6147343659168302473">"ניפוי הבאגים האלחוטי מחובר"</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index d571a6b..a8d2f1a 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"閉じる"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"応答"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"ビデオ"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"拒否"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"通話終了"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"着信"</string>
diff --git a/core/res/res/values-kk/strings.xml b/core/res/res/values-kk/strings.xml
index 7a45851..7d6bf12 100644
--- a/core/res/res/values-kk/strings.xml
+++ b/core/res/res/values-kk/strings.xml
@@ -1690,7 +1690,7 @@
     <string name="accessibility_shortcut_off" msgid="3651336255403648739">"Қосылмасын"</string>
     <string name="accessibility_shortcut_menu_item_status_on" msgid="6608392117189732543">"ҚОСУЛЫ"</string>
     <string name="accessibility_shortcut_menu_item_status_off" msgid="5531598275559472393">"ӨШІРУЛІ"</string>
-    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"<xliff:g id="SERVICE">%1$s</xliff:g> қызметі құрылғыңызды толық басқаруына рұқсат етілсін бе?"</string>
+    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"<xliff:g id="SERVICE">%1$s</xliff:g> қызметіне құрылғыны толық басқаруға рұқсат етілсін бе?"</string>
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"<xliff:g id="SERVICE">%1$s</xliff:g> қоссаңыз, құрылғыңыз деректерді шифрлау үшін экранды бекітуді пайдаланбайды."</string>
     <string name="accessibility_service_warning_description" msgid="291674995220940133">"Арнайы мүмкіндіктер бойынша көмектесетін қолданбаларға ғана құрылғыны толық басқару рұқсатын берген дұрыс."</string>
     <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"Экранды көру және басқару"</string>
@@ -1698,7 +1698,7 @@
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"Әрекеттерді көру және орындау"</string>
     <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"Ол қолданбамен немесе жабдық датчигімен істеген тапсырмаларыңызды бақылайды және қолданбаларды сіздің атыңыздан пайдаланады."</string>
     <string name="accessibility_dialog_button_allow" msgid="2092558122987144530">"Рұқсат ету"</string>
-    <string name="accessibility_dialog_button_deny" msgid="4129575637812472671">"Қабылдамау"</string>
+    <string name="accessibility_dialog_button_deny" msgid="4129575637812472671">"Тыйым салу"</string>
     <string name="accessibility_select_shortcut_menu_title" msgid="6002726538854613272">"Функцияны пайдалана бастау үшін түртіңіз:"</string>
     <string name="accessibility_edit_shortcut_menu_button_title" msgid="239446795930436325">"\"Арнайы мүмкіндіктер\" түймесімен қолданылатын функцияларды таңдаңыз"</string>
     <string name="accessibility_edit_shortcut_menu_volume_title" msgid="1077294237378645981">"Дыбыс деңгейі пернелері тіркесімімен қолданылатын функцияларды таңдаңыз"</string>
@@ -2275,5 +2275,5 @@
     <string name="splash_screen_view_icon_description" msgid="180638751260598187">"Қолданба белгішесі"</string>
     <string name="splash_screen_view_branding_description" msgid="7911129347402728216">"Қолданба брендін ілгері жылжыту кескіні"</string>
     <string name="view_and_control_notification_title" msgid="4300765399209912240">"Пайдалану параметрлерін тексеріңіз"</string>
-    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> қызметі экраныңызды көріп, бақылай алады. Көру үшін түртіңіз."</string>
+    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> экраныңызды көріп, оны басқара алады. Өту үшін түртіңіз."</string>
 </resources>
diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml
index 110641d..370bb29 100644
--- a/core/res/res/values-km/strings.xml
+++ b/core/res/res/values-km/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"បិទ"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>៖ <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"ឆ្លើយ"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"វីដេអូ"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"បដិសេធ"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"ដាក់​ចុះ"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"ការ​ហៅ​ចូល"</string>
diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml
index e5183dc..0daa7fe 100644
--- a/core/res/res/values-kn/strings.xml
+++ b/core/res/res/values-kn/strings.xml
@@ -1693,7 +1693,7 @@
     <string name="accessibility_enable_service_title" msgid="3931558336268541484">"ನಿಮ್ಮ ಸಾಧನದ ಪೂರ್ಣ ನಿಯಂತ್ರಣ ಹೊಂದಲು <xliff:g id="SERVICE">%1$s</xliff:g> ಗೆ ಅನುಮತಿಸಬೇಕೆ?"</string>
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"ನೀವು <xliff:g id="SERVICE">%1$s</xliff:g> ಅನ್ನು ಆನ್ ಮಾಡಿದರೆ, ನಿಮ್ಮ ಸಾಧನವು ಡೇಟಾ ಎನ್‌ಕ್ರಿಪ್ಶನ್ ಅನ್ನು ವರ್ಧಿಸಲು ನಿಮ್ಮ ಸ್ಕ್ರೀನ್‌ಲಾಕ್ ಅನ್ನು ಬಳಸುವುದಿಲ್ಲ."</string>
     <string name="accessibility_service_warning_description" msgid="291674995220940133">"ಪ್ರವೇಶಿಸುವಿಕೆಯ ಅವಶ್ಯಕತೆಗಳಿಗೆ ಸಹಾಯ ಮಾಡುವ ಆ್ಯಪ್‌ಗಳಿಗೆ ಪೂರ್ಣ ನಿಯಂತ್ರಣ ನೀಡುವುದು ಸೂಕ್ತವಾಗಿರುತ್ತದೆ, ಆದರೆ ಬಹುತೇಕ ಆ್ಯಪ್‌ಗಳಿಗೆ ಇದು ಸೂಕ್ತವಲ್ಲ."</string>
-    <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"ಪರದೆಯನ್ನು ವೀಕ್ಷಿಸಿ ಮತ್ತು ನಿಯಂತ್ರಿಸಿ"</string>
+    <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"ಸ್ಕ್ರೀನ್ ವೀಕ್ಷಿಸಿ ಮತ್ತು ನಿಯಂತ್ರಿಸಿ"</string>
     <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"ಇದು ಪರದೆಯ ಮೇಲಿನ ಎಲ್ಲಾ ವಿಷಯವನ್ನು ಓದಬಹುದು ಮತ್ತು ಇತರ ಆ್ಯಪ್‌ಗಳ ಮೇಲೆ ವಿಷಯವನ್ನು ಪ್ರದರ್ಶಿಸಬಹುದು."</string>
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"ಕ್ರಿಯೆಗಳನ್ನು ವೀಕ್ಷಿಸಿ ಮತ್ತು ನಿರ್ವಹಿಸಿ"</string>
     <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"ಇದು ಆ್ಯಪ್ ಅಥವಾ ಹಾರ್ಡ್‌ವೇರ್ ಸೆನ್ಸರ್‌ನ ಜೊತೆಗಿನ ನಿಮ್ಮ ಸಂವಹನಗಳನ್ನು ಟ್ರ್ಯಾಕ್ ಮಾಡಬಹುದು, ಮತ್ತು ನಿಮ್ಮ ಪರವಾಗಿ ಆ್ಯಪ್‌ಗಳ ಜೊತೆ ಸಂವಹನ ನಡೆಸಬಹುದು."</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index cad3dff..da8f4ab 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"닫기"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"답변"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"동영상"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"거절"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"전화 끊기"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"수신 전화"</string>
diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml
index 40d1bfe..de0acbe 100644
--- a/core/res/res/values-ky/strings.xml
+++ b/core/res/res/values-ky/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Жабуу"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Жооп берүү"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Видео"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Четке кагуу"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Чалууну бүтүрүү"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Кирүүчү чалуу"</string>
@@ -2263,7 +2262,7 @@
     <string name="config_pdp_reject_user_authentication_failed" msgid="4531693033885744689"></string>
     <string name="config_pdp_reject_service_not_subscribed" msgid="8190338397128671588"></string>
     <string name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" msgid="6024904218067254186"></string>
-    <string name="window_magnification_prompt_title" msgid="2876703640772778215">"Жаңы чоңойтуу жөндөөлөрү"</string>
+    <string name="window_magnification_prompt_title" msgid="2876703640772778215">"Чоңойтуу функциясынын жаңы жөндөөлөрү"</string>
     <string name="window_magnification_prompt_content" msgid="8159173903032344891">"Эми экрандын бир бөлүгүн чоңойто аласыз"</string>
     <string name="turn_on_magnification_settings_action" msgid="8521433346684847700">"Жөндөөлөрдөн күйгүзүү"</string>
     <string name="dismiss_action" msgid="1728820550388704784">"Жабуу"</string>
diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml
index 1583abf..24ed1b6 100644
--- a/core/res/res/values-mr/strings.xml
+++ b/core/res/res/values-mr/strings.xml
@@ -277,7 +277,7 @@
     <string name="notification_hidden_text" msgid="2835519769868187223">"नवीन सूचना"</string>
     <string name="notification_channel_virtual_keyboard" msgid="6465975799223304567">"व्हर्च्युअल कीबोर्ड"</string>
     <string name="notification_channel_physical_keyboard" msgid="5417306456125988096">"वास्तविक कीबोर्ड"</string>
-    <string name="notification_channel_security" msgid="8516754650348238057">"सुरक्षितता"</string>
+    <string name="notification_channel_security" msgid="8516754650348238057">"सुरक्षा"</string>
     <string name="notification_channel_car_mode" msgid="2123919247040988436">"कार मोड"</string>
     <string name="notification_channel_account" msgid="6436294521740148173">"खाते स्थिती"</string>
     <string name="notification_channel_developer" msgid="1691059964407549150">"डेव्हलपर मेसेज"</string>
diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml
index e7c8e4b..ece2a53 100644
--- a/core/res/res/values-ne/strings.xml
+++ b/core/res/res/values-ne/strings.xml
@@ -1692,7 +1692,7 @@
     <string name="accessibility_shortcut_menu_item_status_off" msgid="5531598275559472393">"निष्क्रिय"</string>
     <string name="accessibility_enable_service_title" msgid="3931558336268541484">"<xliff:g id="SERVICE">%1$s</xliff:g> लाई तपाईंको यन्त्र पूर्ण रूपमा नियन्त्रण गर्न दिने हो?"</string>
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"तपाईंले <xliff:g id="SERVICE">%1$s</xliff:g> सक्रिय गर्नुभयो भने तपाईंको यन्त्रले डेटा इन्क्रिप्ट गर्ने सुविधाको स्तरोन्नति गर्न तपाईंको स्क्रिन लक सुविधाको प्रयोग गर्ने छैन।"</string>
-    <string name="accessibility_service_warning_description" msgid="291674995220940133">"तपाईंलाई पहुँच राख्न आवश्यक पर्ने कुरामा सहयोग गर्ने एपमाथि पूर्ण नियन्त्रण गर्नु उपयुक्त हुन्छ तर अधिकांश अनुप्रयोगहरूका हकमा यस्तो नियन्त्रण उपयुक्त हुँदैन।"</string>
+    <string name="accessibility_service_warning_description" msgid="291674995220940133">"एक्सेसिबिलिटीसम्बन्धी आवश्यकतामा सहयोग गर्ने एपको पूर्ण नियन्त्रण गर्नु उपयुक्त हुन्छ तर अधिकांश एपका हकमा यस्तो नियन्त्रण उपयुक्त हुँदैन।"</string>
     <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"स्क्रिन हेर्नुहोस् र नियन्त्रण गर्नुहोस्"</string>
     <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"यसले स्क्रिनमा देखिने सबै सामग्री पढ्न सक्छ र अन्य एपहरूमा उक्त सामग्री देखाउन सक्छ।"</string>
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"कारबाहीहरू हेर्नुहोस् र तिनमा कार्य गर्नुहोस्"</string>
@@ -2272,7 +2272,7 @@
     <string name="config_pdp_reject_service_not_subscribed" msgid="8190338397128671588"></string>
     <string name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" msgid="6024904218067254186"></string>
     <string name="window_magnification_prompt_title" msgid="2876703640772778215">"जुम इन गर्ने सुविधासम्बन्धी नयाँ सेटिङ"</string>
-    <string name="window_magnification_prompt_content" msgid="8159173903032344891">"तपाईं अब स्क्रिनको जुनसुकै भाग जुम इन गर्न सक्नुहुन्छ"</string>
+    <string name="window_magnification_prompt_content" msgid="8159173903032344891">"तपाईं अब स्क्रिनको जुनसुकै भागमा जुम इन गर्न सक्नुहुन्छ"</string>
     <string name="turn_on_magnification_settings_action" msgid="8521433346684847700">"सेटिङमा गई यो सुविधा अन गर्नुहोस्"</string>
     <string name="dismiss_action" msgid="1728820550388704784">"हटाउनुहोस्"</string>
     <string name="sensor_privacy_start_use_mic_notification_content_title" msgid="2420858361276370367">"डिभाइसको माइक्रोफोन अनब्लक गर्नुहोस्"</string>
@@ -2282,6 +2282,6 @@
     <string name="sensor_privacy_notification_channel_label" msgid="936036783155261349">"सेन्सरसम्बन्धी गोपनीयता"</string>
     <string name="splash_screen_view_icon_description" msgid="180638751260598187">"एप जनाउने आइकन"</string>
     <string name="splash_screen_view_branding_description" msgid="7911129347402728216">"एपको ब्रान्डिङ फोटो"</string>
-    <string name="view_and_control_notification_title" msgid="4300765399209912240">"हेर्ने तथा नियन्त्रण गर्ने अनुमतिसम्बन्धी सेटिङ जाँच्नु…"</string>
-    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> ले तपाईंको स्क्रिन हेर्न र नियन्त्रण गर्न सक्छ। समीक्षा गर्न ट्याप गर्नुहोस्।"</string>
+    <string name="view_and_control_notification_title" msgid="4300765399209912240">"हेराइ र नियन्त्रणसम्बन्धी सेटिङ जाँच्नुहोस्"</string>
+    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> तपाईंको स्क्रिन हेर्न र नियन्त्रण गर्न सक्छ। सेटिङ मिलाउन ट्याप गर्नुहोस्।"</string>
 </resources>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index d326f85..0222f6f 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Sluiten"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Beantwoorden"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Weigeren"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Ophangen"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Inkomend gesprek"</string>
diff --git a/core/res/res/values-pa/strings.xml b/core/res/res/values-pa/strings.xml
index 72c662f..ac5af41 100644
--- a/core/res/res/values-pa/strings.xml
+++ b/core/res/res/values-pa/strings.xml
@@ -1694,7 +1694,7 @@
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"ਜੇਕਰ ਤੁਸੀਂ <xliff:g id="SERVICE">%1$s</xliff:g> ਚਾਲੂ ਕਰਦੇ ਹੋ, ਤਾਂ ਤੁਹਾਡਾ ਡੀਵਾਈਸ ਇਨਕ੍ਰਿਪਸ਼ਨ ਦਾ ਵਿਸਤਾਰ ਕਰਨ ਲਈ ਤੁਹਾਡੇ ਸਕ੍ਰੀਨ ਲਾਕ ਦੀ ਵਰਤੋਂ ਨਹੀਂ ਕਰੇਗਾ।"</string>
     <string name="accessibility_service_warning_description" msgid="291674995220940133">"ਪੂਰਾ ਕੰਟਰੋਲ ਉਹਨਾਂ ਐਪਾਂ ਲਈ ਢੁਕਵਾਂ ਹੈ ਜੋ ਪਹੁੰਚਯੋਗਤਾ ਸੰਬੰਧੀ ਲੋੜਾਂ ਵਿੱਚ ਤੁਹਾਡੀ ਮਦਦ ਕਰਦੀਆਂ ਹਨ, ਪਰ ਜ਼ਿਆਦਾਤਰ ਐਪਾਂ ਲਈ ਢੁਕਵਾਂ ਨਹੀਂ ਹੁੰਦਾ।"</string>
     <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"ਸਕ੍ਰੀਨ ਨੂੰ ਦੇਖੋ ਅਤੇ ਕੰਟਰੋਲ ਕਰੋ"</string>
-    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"ਇਹ ਸਕ੍ਰੀਨ \'ਤੇ ਸਾਰੀ ਸਮੱਗਰੀ ਪੜ੍ਹ ਸਕਦੀ ਹੈ ਅਤੇ ਸਮੱਗਰੀ ਨੂੰ ਦੂਜੀਆਂ ਐਪਾਂ ਦੇ ਉੱਪਰ ਪ੍ਰਦਰਸ਼ਿਤ ਕਰ ਸਕਦੀ ਹੈ।"</string>
+    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"ਇਹ ਸਕ੍ਰੀਨ \'ਤੇ ਸਾਰੀ ਸਮੱਗਰੀ ਪੜ੍ਹ ਸਕਦੀ ਹੈ ਅਤੇ ਸਮੱਗਰੀ ਨੂੰ ਦੂਜੀਆਂ ਐਪਾਂ ਦੇ ਉੱਪਰ ਦਿਖਾ ਸਕਦੀ ਹੈ।"</string>
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"ਕਾਰਵਾਈਆਂ ਦੇਖੋ ਅਤੇ ਕਰੋ"</string>
     <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"ਇਹ ਕਿਸੇ ਐਪ ਜਾਂ ਹਾਰਡਵੇਅਰ ਸੈਂਸਰ ਦੇ ਨਾਲ ਤੁਹਾਡੀਆਂ ਅੰਤਰਕਿਰਿਆਵਾਂ ਨੂੰ ਟਰੈਕ ਕਰ ਸਕਦੀ ਹੈ, ਅਤੇ ਤੁਹਾਡੀ ਤਰਫ਼ੋਂ ਐਪਾਂ ਦੇ ਨਾਲ ਅੰਤਰਕਿਰਿਆ ਕਰ ਸਕਦੀ ਹੈ।"</string>
     <string name="accessibility_dialog_button_allow" msgid="2092558122987144530">"ਕਰਨ ਦਿਓ"</string>
@@ -2264,7 +2264,7 @@
     <string name="config_pdp_reject_service_not_subscribed" msgid="8190338397128671588"></string>
     <string name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" msgid="6024904218067254186"></string>
     <string name="window_magnification_prompt_title" msgid="2876703640772778215">"ਨਵੀਆਂ ਵੱਡਦਰਸ਼ੀਕਰਨ ਸੈਟਿੰਗਾਂ"</string>
-    <string name="window_magnification_prompt_content" msgid="8159173903032344891">"ਹੁਣ ਤੁਸੀਂ ਆਪਣੀ ਸਕ੍ਰੀਨ ਦਾ ਕੁਝ ਹਿੱਸਾ ਵੱਡਦਰਸ਼ੀ ਕਰ ਸਕਦੇ ਹੋ"</string>
+    <string name="window_magnification_prompt_content" msgid="8159173903032344891">"ਹੁਣ ਤੁਸੀਂ ਆਪਣੀ ਸਕ੍ਰੀਨ ਦਾ ਕੁਝ ਹਿੱਸਾ ਵੱਡਾ ਕਰ ਸਕਦੇ ਹੋ"</string>
     <string name="turn_on_magnification_settings_action" msgid="8521433346684847700">"ਸੈਟਿੰਗਾਂ ਵਿੱਚ ਚਾਲੂ ਕਰੋ"</string>
     <string name="dismiss_action" msgid="1728820550388704784">"ਖਾਰਜ ਕਰੋ"</string>
     <string name="sensor_privacy_start_use_mic_notification_content_title" msgid="2420858361276370367">"ਡੀਵਾਈਸ ਦੇ ਮਾਈਕ੍ਰੋਫ਼ੋਨ ਨੂੰ ਅਣਬਲਾਕ ਕਰੋ"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 78324f6..76b3991 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -1991,8 +1991,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Закрыть"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Ответить"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Видео"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Отклонить"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Завершить"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Входящий вызов"</string>
diff --git a/core/res/res/values-si/strings.xml b/core/res/res/values-si/strings.xml
index 35f125c..c0577d6 100644
--- a/core/res/res/values-si/strings.xml
+++ b/core/res/res/values-si/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"වසන්න"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"පිළිතුරු දෙ."</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"වීඩියෝ"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"ප්‍රතික්ෂේප ක"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"විසන්ධි කරන්න"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"එන ඇමතුම"</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index 18d2b99..96fa82d 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -1960,8 +1960,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Затвори"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Одговори"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Видео"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Одбиј"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Прекини везу"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Долазни позив"</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 46944ab..ea069e1 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Funga"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Jibu"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Kataa"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Kata simu"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Simu uliyopigiwa"</string>
diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml
index 1d53e3c..882af55 100644
--- a/core/res/res/values-te/strings.xml
+++ b/core/res/res/values-te/strings.xml
@@ -1690,13 +1690,13 @@
     <string name="accessibility_shortcut_off" msgid="3651336255403648739">"ఆన్ చేయకండి"</string>
     <string name="accessibility_shortcut_menu_item_status_on" msgid="6608392117189732543">"ఆన్"</string>
     <string name="accessibility_shortcut_menu_item_status_off" msgid="5531598275559472393">"ఆఫ్"</string>
-    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"<xliff:g id="SERVICE">%1$s</xliff:g>కి మీ పరికరంపై పూర్తి నియంత్రణను ఇవ్వాలనుకుంటున్నారా?"</string>
+    <string name="accessibility_enable_service_title" msgid="3931558336268541484">"<xliff:g id="SERVICE">%1$s</xliff:g>కి మీ పరికరంపై పూర్తి కంట్రోల్‌ను ఇవ్వాలనుకుంటున్నారా?"</string>
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"మీరు <xliff:g id="SERVICE">%1$s</xliff:g>ని ఆన్ చేస్తే, డేటా ఎన్‌క్రిప్షన్‌ను మెరుగుపరచడానికి మీ పరికరం మీ స్క్రీన్ లాక్‌ను ఉపయోగించదు."</string>
-    <string name="accessibility_service_warning_description" msgid="291674995220940133">"అవసరమైన యాక్సెస్ సామర్ధ్యం కోసం యాప్‌లకు పూర్తి నియంత్రణ ఇవ్వడం తగిన పనే అయినా, అన్ని యాప్‌లకు అలా ఇవ్వడం సరికాదు."</string>
-    <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"స్క్రీన్‌ను చూసి, నియంత్రించండి"</string>
+    <string name="accessibility_service_warning_description" msgid="291674995220940133">"అవసరమైన యాక్సెసిబిలిటీ కోసం యాప్‌లకు పూర్తి కంట్రోల్ ఇవ్వడం తగిన పనే అయినా, అన్ని యాప్‌లకు అలా ఇవ్వడం సరికాదు."</string>
+    <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"స్క్రీన్‌ను చూసి, కంట్రోల్ చేయడం"</string>
     <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"స్క్రీన్‌పై ఉండే కంటెంట్‌ మొత్తాన్ని చదవగలుగుతుంది మరియు ఇతర యాప్‌లలో కూడా ఈ కంటెంట్‌ను ప్రదర్శిస్తుంది."</string>
     <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"చర్యలను చూసి, అమలు చేయండి"</string>
-    <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"మీరు యాప్‌‌తో చేసే పరస్పర చర్యల‌ను లేదా హార్డ్‌వేర్ సెన్సార్‌ను ట్రాక్ చేస్తూ మీ త‌ర‌ఫున యాప్‌లతో పరస్పరం సమన్వయం చేస్తుంది."</string>
+    <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"మీరు ఒక యాప్‌‌తో చేసే ఇంటరాక్షన్‌లను లేదా హార్డ్‌వేర్ సెన్సార్‌ను ట్రాక్ చేస్తూ మీ త‌ర‌ఫున యాప్‌లతో ఇంటరాక్ట్ చేయగలదు."</string>
     <string name="accessibility_dialog_button_allow" msgid="2092558122987144530">"అనుమతించు"</string>
     <string name="accessibility_dialog_button_deny" msgid="4129575637812472671">"నిరాకరించు"</string>
     <string name="accessibility_select_shortcut_menu_title" msgid="6002726538854613272">"ఫీచర్‌ని ఉపయోగించడం ప్రారంభించడానికి, దాన్ని ట్యాప్ చేయండి:"</string>
@@ -2275,5 +2275,5 @@
     <string name="splash_screen_view_icon_description" msgid="180638751260598187">"యాప్ చిహ్నం"</string>
     <string name="splash_screen_view_branding_description" msgid="7911129347402728216">"యాప్ బ్రాండింగ్ ఇమేజ్"</string>
     <string name="view_and_control_notification_title" msgid="4300765399209912240">"యాక్సెస్ సెట్టింగ్‌లను చెక్ చేయండి"</string>
-    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> మీ స్క్రీన్‌ను చూడవచ్చు, నియంత్రించవచ్చు. రివ్యూ చేయడానికి ట్యాప్ చేయండి."</string>
+    <string name="view_and_control_notification_content" msgid="8003766498562604034">"<xliff:g id="SERVICE_NAME">%s</xliff:g> మీ స్క్రీన్‌ను చూడవచ్చు, కంట్రోల్ చేయవచ్చు. రివ్యూ చేయడానికి ట్యాప్ చేయండి."</string>
 </resources>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 0860d6f..adaa774 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Isara"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Sagutin"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Tanggihan"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Ibaba"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Papasok na tawag"</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 9d12acc..bd85322 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -1694,8 +1694,8 @@
     <string name="accessibility_enable_service_encryption_warning" msgid="8603532708618236909">"<xliff:g id="SERVICE">%1$s</xliff:g> hizmetini açarsanız cihazınız veri şifrelemeyi geliştirmek için ekran kilidinizi kullanmaz."</string>
     <string name="accessibility_service_warning_description" msgid="291674995220940133">"Erişebilirlik ihtiyaçlarınıza yardımcı olan uygulamalara tam kontrol verilmesi uygundur ancak diğer pek çok uygulama için uygun değildir."</string>
     <string name="accessibility_service_screen_control_title" msgid="190017412626919776">"Ekranı görüntüleme ve kontrol etme"</string>
-    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"Ekrandaki tüm içeriği okuyabilir ve içeriği diğer uygulamaların üzerinde gösterebilir"</string>
-    <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"İşlemleri görüntüleyin ve gerçekleştirin"</string>
+    <string name="accessibility_service_screen_control_description" msgid="6946315917771791525">"Ekrandaki tüm içeriği okuyabilir ve içeriği diğer uygulamaların üzerinde gösterebilir."</string>
+    <string name="accessibility_service_action_perform_title" msgid="779670378951658160">"İşlemleri görüntüleme ve gerçekleştirme"</string>
     <string name="accessibility_service_action_perform_description" msgid="2718852014003170558">"Bir uygulama veya donanım sensörüyle etkileşimlerinizi takip edebilir ve sizin adınıza uygulamalarla etkileşimde bulunabilir."</string>
     <string name="accessibility_dialog_button_allow" msgid="2092558122987144530">"İzin ver"</string>
     <string name="accessibility_dialog_button_deny" msgid="4129575637812472671">"Reddet"</string>
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Kapat"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Yanıtla"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Reddet"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Kapat"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Gelen çağrı"</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index c0349c0..77d81d8 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Đóng"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Trả lời"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Video"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Từ chối"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Kết thúc"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Cuộc gọi đến"</string>
diff --git a/core/res/res/values-zh-rHK/strings.xml b/core/res/res/values-zh-rHK/strings.xml
index 2b16bda..9c6b851 100644
--- a/core/res/res/values-zh-rHK/strings.xml
+++ b/core/res/res/values-zh-rHK/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"關閉"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>:<xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"接聽"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"視像"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"拒接"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"掛斷"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"來電"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index bf476f1..e2a52f1 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -1929,8 +1929,7 @@
     <string name="close_button_text" msgid="10603510034455258">"Vala"</string>
     <string name="notification_messaging_title_template" msgid="772857526770251989">"<xliff:g id="CONVERSATION_TITLE">%1$s</xliff:g>: <xliff:g id="SENDER_NAME">%2$s</xliff:g>"</string>
     <string name="call_notification_answer_action" msgid="5999246836247132937">"Phendula"</string>
-    <!-- no translation found for call_notification_answer_video_action (2086030940195382249) -->
-    <skip />
+    <string name="call_notification_answer_video_action" msgid="2086030940195382249">"Ividiyo"</string>
     <string name="call_notification_decline_action" msgid="3700345945214000726">"Yenqaba"</string>
     <string name="call_notification_hang_up_action" msgid="9130720590159188131">"Vala Ucingo"</string>
     <string name="call_notification_incoming_text" msgid="6143109825406638201">"Ikholi engenayo"</string>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index bd1d848..f097009 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1176,6 +1176,9 @@
         <!-- Alternative color applied to surfaces on top of colorBackground. @hide -->
         <attr name="colorSurfaceHeader" format="color" />
 
+        <!-- Color applied to effects. -->
+        <attr name="effectColor" format="color" />
+
         <!-- The type of the edge effect. The default is glow. -->
         <attr name="edgeEffectType">
             <!-- Use a colored glow at the edge. -->
@@ -6540,13 +6543,8 @@
         <!-- The radius of the ripple when fully expanded. By default, the
              radius is computed based on the size of the ripple's container. -->
         <attr name="radius" />
-        <!-- The style of the ripple drawable is solid by default -->
-        <attr name="rippleStyle">
-            <!-- Solid is the default style -->
-            <enum name="solid" value="0" />
-            <!-- Patterned style-->
-            <enum name="patterned" value="1" />
-        </attr>
+        <!-- Secondary color of the ripple effect. -->
+        <attr name="effectColor" />
     </declare-styleable>
 
     <declare-styleable name="ScaleDrawable">
@@ -9577,7 +9575,7 @@
     <!-- Perceptual luminance of a color, in accessibility friendly color space. From 0 to 100. -->
     <attr name="lStar" format="float"/>
 
-    <declare-styleable name="DisplayHasherService">
+    <declare-styleable name="DisplayHashingService">
         <!-- The throttle duration for display hash requests
              @hide @SystemApi -->
         <attr name="throttleDurationMillis" format="integer" />
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 588ae79..3b155de 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -1880,6 +1880,9 @@
         apps due to inconsistencies in MediaStore collection and lower file system.
         When the flag is set, app should scan the file after file path operations to ensure
         consistency of MediaStore collection.
+        <p> The flag can be set to false if the app doesn't do many bulk file path operations or if
+        app prefers the system to ensure the consistency of the MediaStore collection for file path
+        operations without scanning the file.
 
         <p> The default value is {@code true} if
         <ul>
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 3ad20c6..0213c60 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -231,8 +231,7 @@
     <color name="chooser_gradient_background">@color/loading_gradient_background_color_light</color>
     <color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_light</color>
 
-    <color name="GM2_grey_700">#5F6368</color>
-    <color name="GM2_grey_800">#3C4043</color>
+    <color name="GM2_grey_800">#ff3C4043</color>
 
     <!-- Resolver/Chooser -->
     <color name="resolver_text_color_secondary_dark">#ffC4C6C6</color>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 062b080..0e436e3 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -570,12 +570,6 @@
     <!-- Width of the outline stroke used by the accessibility focus rectangle -->
     <dimen name="accessibility_focus_highlight_stroke_width">4dp</dimen>
 
-    <!-- The size of the Accessibility icon -->
-    <dimen name="accessibility_icon_size">32dp</dimen>
-
-    <!-- The size of the Accessibility icon foreground part -->
-    <dimen name="accessibility_icon_foreground_size">18dp</dimen>
-
     <!-- Margin around the various security views -->
     <dimen name="keyguard_muliuser_selector_margin">8dp</dimen>
 
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index f6a67d2..2a76c57 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -3099,6 +3099,7 @@
     <!-- @hide @SystemApi -->
     <public name="throttleDurationMillis" />
     <public name="showInInputMethodPicker" />
+    <public name="effectColor" />
   </staging-public-group>
 
   <staging-public-group type="drawable" first-id="0x010800b5">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 60383be..5715fab 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3389,7 +3389,6 @@
   <java-symbol type="drawable" name="ic_accessibility_color_inversion" />
   <java-symbol type="drawable" name="ic_accessibility_color_correction" />
   <java-symbol type="drawable" name="ic_accessibility_magnification" />
-  <java-symbol type="drawable" name="ic_accessibility_reduce_bright_colors" />
 
   <java-symbol type="string" name="reduce_bright_colors_feature_name" />
 
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 1d4beae..41bedb2 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -234,9 +234,6 @@
         <item name="textColorTertiary">@color/text_color_tertiary_device_default_dark</item>
         <item name="colorForeground">@color/foreground_device_default_dark</item>
         <item name="colorForegroundInverse">@color/foreground_device_default_light</item>
-
-        <!-- Ripple style-->
-        <item name="rippleStyle">solid</item>
     </style>
 
     <style name="Theme.DeviceDefault" parent="Theme.DeviceDefaultBase" />
diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
index 4dbdc60..281ce2b 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
@@ -693,7 +693,7 @@
 
         @Override
         public void updateUiTranslationState(IBinder activityToken, int state,
-                TranslationSpec sourceSpec, TranslationSpec destSpec, List<AutofillId> viewIds) {
+                TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds) {
 
         }
     }
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryUsageStatsRule.java b/core/tests/coretests/src/com/android/internal/os/BatteryUsageStatsRule.java
index 3a6f7b8..e0739be 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryUsageStatsRule.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryUsageStatsRule.java
@@ -167,7 +167,7 @@
     }
 
     BatteryUsageStats apply(BatteryUsageStatsQuery query, PowerCalculator... calculators) {
-        final String[] customPowerComponentNames = mBatteryStats.getCustomPowerComponentNames();
+        final String[] customPowerComponentNames = mBatteryStats.getCustomEnergyConsumerNames();
         final boolean includePowerModels = (query.getFlags()
                 & BatteryUsageStatsQuery.FLAG_BATTERY_USAGE_STATS_INCLUDE_POWER_MODELS) != 0;
         BatteryUsageStats.Builder builder = new BatteryUsageStats.Builder(
diff --git a/data/etc/car/com.android.car.shell.xml b/data/etc/car/com.android.car.shell.xml
index ec903ad..578c46e 100644
--- a/data/etc/car/com.android.car.shell.xml
+++ b/data/etc/car/com.android.car.shell.xml
@@ -28,5 +28,9 @@
         <permission name="android.car.permission.CONTROL_CAR_CLIMATE"/>
         <permission name="android.car.permission.CAR_TIRES"/>
         <permission name="android.car.permission.READ_CAR_STEERING"/>
+        <permission name="android.car.permission.REQUEST_CAR_EVS_ACTIVITY" />
+        <permission name="android.car.permission.CONTROL_CAR_EVS_ACTIVITY" />
+        <permission name="android.car.permission.USE_CAR_EVS_CAMERA" />
+        <permission name="android.car.permission.MONITOR_CAR_EVS_STATUS" />
     </privapp-permissions>
 </permissions>
diff --git a/data/etc/car/com.google.android.car.kitchensink.xml b/data/etc/car/com.google.android.car.kitchensink.xml
index e6196c2..40dda65 100644
--- a/data/etc/car/com.google.android.car.kitchensink.xml
+++ b/data/etc/car/com.google.android.car.kitchensink.xml
@@ -87,5 +87,9 @@
         <permission name="android.car.permission.STORAGE_MONITORING"/>
         <permission name="android.car.permission.VMS_PUBLISHER"/>
         <permission name="android.car.permission.VMS_SUBSCRIBER"/>
+        <permission name="android.car.permission.REQUEST_CAR_EVS_ACTIVITY" />
+        <permission name="android.car.permission.CONTROL_CAR_EVS_ACTIVITY" />
+        <permission name="android.car.permission.USE_CAR_EVS_CAMERA" />
+        <permission name="android.car.permission.MONITOR_CAR_EVS_STATUS" />
     </privapp-permissions>
 </permissions>
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index 5f34426..5544eb4 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -417,6 +417,8 @@
         <permission name="android.permission.SET_WALLPAPER" />
         <permission name="android.permission.SET_WALLPAPER_COMPONENT" />
         <permission name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE" />
+        <!-- Permissions required for Incremental CTS tests -->
+        <permission name="com.android.permission.USE_INSTALLER_V2"/>
         <permission name="android.permission.LOADER_USAGE_STATS"/>
         <!-- Permission required to test system only camera devices. -->
         <permission name="android.permission.SYSTEM_CAMERA" />
@@ -518,6 +520,8 @@
         <permission name="android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER" />
         <permission name="android.permission.SET_MEDIA_KEY_LISTENER" />
         <permission name="android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER" />
+        <!-- Permission required for CTS test - CtsAlarmManagerTestCases -->
+        <permission name="android.permission.UPDATE_DEVICE_STATS" />
     </privapp-permissions>
 
     <privapp-permissions package="com.android.statementservice">
diff --git a/graphics/java/android/graphics/HardwareRenderer.java b/graphics/java/android/graphics/HardwareRenderer.java
index f3dba82..8f1223b 100644
--- a/graphics/java/android/graphics/HardwareRenderer.java
+++ b/graphics/java/android/graphics/HardwareRenderer.java
@@ -754,6 +754,11 @@
     }
 
     /** @hide */
+    public void setASurfaceTransactionCallback(ASurfaceTransactionCallback callback) {
+        nSetASurfaceTransactionCallback(mNativeProxy, callback);
+    }
+
+    /** @hide */
     public void setFrameCallback(FrameDrawingCallback callback) {
         nSetFrameCallback(mNativeProxy, callback);
     }
@@ -868,6 +873,23 @@
     }
 
     /**
+     * Interface used to receive callbacks when a transaction needs to be merged.
+     *
+     * @hide
+     */
+    public interface ASurfaceTransactionCallback {
+        /**
+         * Invoked during a frame drawing.
+         *
+         * @param aSurfaceTranactionNativeObj the ASurfaceTransaction native object handle
+         * @param aSurfaceControlNativeObj ASurfaceControl native object handle
+         * @param frame The id of the frame being drawn.
+         */
+        void onMergeTransaction(long aSurfaceTranactionNativeObj,
+                                long aSurfaceControlNativeObj, long frame);
+    }
+
+    /**
      * Interface used to receive callbacks when a frame is being drawn.
      *
      * @hide
@@ -1342,6 +1364,9 @@
     private static native void nSetPictureCaptureCallback(long nativeProxy,
             PictureCapturedCallback callback);
 
+    private static native void nSetASurfaceTransactionCallback(long nativeProxy,
+            ASurfaceTransactionCallback callback);
+
     private static native void nSetFrameCallback(long nativeProxy, FrameDrawingCallback callback);
 
     private static native void nSetFrameCompleteCallback(long nativeProxy,
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index c972a24..29fa09d 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -150,6 +150,7 @@
     /** The maximum number of ripples supported. */
     private static final int MAX_RIPPLES = 10;
     private static final LinearInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
+    private static final int DEFAULT_EFFECT_COLOR = 0x80ffffff;
     /** Temporary flag for teamfood. **/
     private static final boolean FORCE_PATTERNED_STYLE = true;
 
@@ -465,12 +466,37 @@
      *
      * @attr ref android.R.styleable#RippleDrawable_color
      */
-    public void setColor(ColorStateList color) {
+    public void setColor(@NonNull ColorStateList color) {
+        if (color == null) {
+            throw new IllegalArgumentException("color cannot be null");
+        }
         mState.mColor = color;
         invalidateSelf(false);
     }
 
     /**
+     * Sets the ripple effect color.
+     *
+     * @param color Ripple color as a color state list.
+     *
+     * @attr ref android.R.styleable#RippleDrawable_effectColor
+     */
+    public void setEffectColor(@NonNull ColorStateList color) {
+        if (color == null) {
+            throw new IllegalArgumentException("color cannot be null");
+        }
+        mState.mEffectColor = color;
+        invalidateSelf(false);
+    }
+
+    /**
+     * @return The ripple effect color as a color state list.
+     */
+    public @NonNull ColorStateList getEffectColor() {
+        return mState.mEffectColor;
+    }
+
+    /**
      * Sets the radius in pixels of the fully expanded ripple.
      *
      * @param radius ripple radius in pixels, or {@link #RADIUS_AUTO} to
@@ -561,13 +587,14 @@
             mState.mColor = color;
         }
 
+        final ColorStateList effectColor =
+                a.getColorStateList(R.styleable.RippleDrawable_effectColor);
+        if (effectColor != null) {
+            mState.mEffectColor = effectColor;
+        }
+
         mState.mMaxRadius = a.getDimensionPixelSize(
                 R.styleable.RippleDrawable_radius, mState.mMaxRadius);
-
-        if (!FORCE_PATTERNED_STYLE) {
-            mState.mRippleStyle = a.getInteger(R.styleable.RippleDrawable_rippleStyle,
-                    mState.mRippleStyle);
-        }
     }
 
     private void verifyRequiredAttributes(@NonNull TypedArray a) throws XmlPullParserException {
@@ -933,10 +960,11 @@
         float radius = getComputedRadius();
         RippleAnimationSession.AnimationProperties<Float, Paint> properties;
         RippleShader shader = new RippleShader();
-        int color = mMaskColorFilter == null
+        final int color = mMaskColorFilter == null
                 ? mState.mColor.getColorForState(getState(), Color.BLACK)
                 : mMaskColorFilter.getColor();
-        shader.setColor(color);
+        final int effectColor = mState.mEffectColor.getColorForState(getState(), Color.MAGENTA);
+        shader.setColor(color, effectColor);
         shader.setOrigin(cx, cy);
         shader.setTouch(x, y);
         shader.setResolution(w, h, mState.mDensity);
@@ -1257,33 +1285,6 @@
         return this;
     }
 
-    /**
-     * Sets the visual style of the ripple.
-     *
-     * @see #STYLE_SOLID
-     * @see #STYLE_PATTERNED
-     *
-     * @param style The style of the ripple
-     * @hide
-     */
-    public void setRippleStyle(@RippleStyle int style) throws IllegalArgumentException {
-        if (style == STYLE_SOLID || style == STYLE_PATTERNED) {
-            mState.mRippleStyle = style;
-        } else {
-            throw new IllegalArgumentException("Invalid style value " + style);
-        }
-    }
-
-    /**
-     * Get the current ripple style
-     * @return Ripple style
-     * @hide
-     */
-    public @RippleStyle int getRippleStyle() {
-        return mState.mRippleStyle;
-    }
-
-
     @Override
     RippleState createConstantState(LayerState state, Resources res) {
         return new RippleState(state, this, res);
@@ -1293,6 +1294,7 @@
         int[] mTouchThemeAttrs;
         @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
         ColorStateList mColor = ColorStateList.valueOf(Color.MAGENTA);
+        ColorStateList mEffectColor = ColorStateList.valueOf(DEFAULT_EFFECT_COLOR);
         int mMaxRadius = RADIUS_AUTO;
         int mRippleStyle = FORCE_PATTERNED_STYLE ? STYLE_PATTERNED : STYLE_SOLID;
 
@@ -1305,6 +1307,7 @@
                 mColor = origs.mColor;
                 mMaxRadius = origs.mMaxRadius;
                 mRippleStyle = origs.mRippleStyle;
+                mEffectColor = origs.mEffectColor;
 
                 if (origs.mDensity != mDensity) {
                     applyDensityScaling(orig.mDensity, mDensity);
diff --git a/graphics/java/android/graphics/drawable/RippleShader.java b/graphics/java/android/graphics/drawable/RippleShader.java
index c1c6afc..a0aa41e 100644
--- a/graphics/java/android/graphics/drawable/RippleShader.java
+++ b/graphics/java/android/graphics/drawable/RippleShader.java
@@ -39,6 +39,7 @@
             + "uniform vec2 in_tRotation2;\n"
             + "uniform vec2 in_tRotation3;\n"
             + "uniform vec4 in_color;\n"
+            + "uniform vec4 in_sparkleColor;\n"
             + "uniform shader in_shader;\n";
     private static final String SHADER_LIB =
             "float triangleNoise(vec2 n) {\n"
@@ -48,7 +49,6 @@
             + "    return fract(xy * 95.4307) + fract(xy * 75.04961) - 1.0;\n"
             + "}"
             + "const float PI = 3.1415926535897932384626;\n"
-            + "const float SPARKLE_OPACITY = 0.75;\n"
             + "\n"
             + "float sparkles(vec2 uv, float t) {\n"
             + "  float n = triangleNoise(uv);\n"
@@ -60,7 +60,7 @@
             + "    o *= abs(sin(PI * o * (t + 0.55 * i)));\n"
             + "    s += o;\n"
             + "  }\n"
-            + "  return saturate(s) * SPARKLE_OPACITY;\n"
+            + "  return saturate(s) * in_sparkleColor.a;\n"
             + "}\n"
             + "float softCircle(vec2 uv, vec2 xy, float radius, float blur) {\n"
             + "  float blurHalf = blur * 0.5;\n"
@@ -116,7 +116,7 @@
             + "    vec4 circle = in_color * (softCircle(p, center, in_maxRadius "
             + "      * scaleIn, 0.2) * fade);\n"
             + "    float mask = in_hasMask == 1. ? sample(in_shader).a > 0. ? 1. : 0. : 1.;\n"
-            + "    return mix(circle, vec4(sparkle), sparkle) * mask;\n"
+            + "    return mix(circle, in_sparkleColor, sparkle) * mask;\n"
             + "}";
     private static final String SHADER = SHADER_UNIFORMS + SHADER_LIB + SHADER_MAIN;
     private static final double PI_ROTATE_RIGHT = Math.PI * 0.0078125;
@@ -200,10 +200,13 @@
     /**
      * Color of the circle that's under the sparkles. Sparkles will always be white.
      */
-    public void setColor(@ColorInt int colorIn) {
-        Color color = Color.valueOf(colorIn);
-        this.setUniform("in_color", new float[] {color.red(),
+    public void setColor(@ColorInt int colorInt, @ColorInt int sparkleColorInt) {
+        Color color = Color.valueOf(colorInt);
+        Color sparkleColor = Color.valueOf(sparkleColorInt);
+        setUniform("in_color", new float[] {color.red(),
                 color.green(), color.blue(), color.alpha()});
+        setUniform("in_sparkleColor", new float[] {sparkleColor.red(),
+                sparkleColor.green(), sparkleColor.blue(), sparkleColor.alpha()});
     }
 
     public void setResolution(float w, float h, int density) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java
index a474831..dd7e294 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java
@@ -50,6 +50,7 @@
     // Referenced in com.android.systemui.util.NotificationChannels.
     public static final String NOTIFICATION_CHANNEL = "TVPIP";
     private static final String NOTIFICATION_TAG = "TvPip";
+    private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF";
 
     private static final String ACTION_SHOW_PIP_MENU =
             "com.android.wm.shell.pip.tv.notification.action.SHOW_PIP_MENU";
@@ -207,7 +208,8 @@
     }
 
     private static PendingIntent createPendingIntent(Context context, String action) {
-        return PendingIntent.getBroadcast(context, 0, new Intent(action),
+        return PendingIntent.getBroadcast(context, 0,
+                new Intent(action).setPackage(context.getPackageName()),
                 PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
     }
 
@@ -223,7 +225,7 @@
         void register() {
             if (mRegistered) return;
 
-            mContext.registerReceiverForAllUsers(this, mIntentFilter, null /* permission */,
+            mContext.registerReceiverForAllUsers(this, mIntentFilter, SYSTEMUI_PERMISSION,
                     mMainHandler);
             mRegistered = true;
         }
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java
index 516dfd0..147f2e2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java
@@ -16,6 +16,7 @@
 
 package com.android.wm.shell.startingsurface;
 
+import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST;
 import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
 import static android.os.UserHandle.getUserHandleForUid;
 
@@ -35,6 +36,8 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.os.Build;
+import android.os.Handler;
+import android.os.HandlerThread;
 import android.os.Trace;
 import android.util.Slog;
 import android.view.SurfaceControl;
@@ -48,10 +51,11 @@
 import com.android.wm.shell.common.TransactionPool;
 
 import java.util.List;
+import java.util.function.Consumer;
 
 /**
  * Util class to create the view for a splash screen content.
- *
+ * Everything execute in this class should be post to mSplashscreenWorkerHandler.
  * @hide
  */
 public class SplashscreenContentDrawer {
@@ -78,6 +82,7 @@
     private int mIconEarlyExitDistance;
     private final TransactionPool mTransactionPool;
     private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs();
+    private final Handler mSplashscreenWorkerHandler;
 
     SplashscreenContentDrawer(Context context, int maxAnimatableIconDuration,
             int iconExitAnimDuration, int appRevealAnimDuration, TransactionPool pool) {
@@ -87,6 +92,45 @@
         mAppRevealDuration = appRevealAnimDuration;
         mIconExitDuration = iconExitAnimDuration;
         mTransactionPool = pool;
+
+        // Initialize Splashscreen worker thread
+        // TODO(b/185288910) move it into WMShellConcurrencyModule and provide an executor to make
+        //  it easier to test stuff that happens on that thread later.
+        final HandlerThread shellSplashscreenWorkerThread =
+                new HandlerThread("wmshell.splashworker", THREAD_PRIORITY_TOP_APP_BOOST);
+        shellSplashscreenWorkerThread.start();
+        mSplashscreenWorkerHandler = shellSplashscreenWorkerThread.getThreadHandler();
+    }
+
+    /**
+     * Create a SplashScreenView object.
+     *
+     * In order to speed up the splash screen view to show on first frame, preparing the
+     * view on background thread so the view and the drawable can be create and pre-draw in
+     * parallel.
+     *
+     * @param consumer Receiving the SplashScreenView object, which will also be executed
+     *                 on splash screen thread. Note that the view can be null if failed.
+     */
+    void createContentView(Context context, int splashScreenResId, ActivityInfo info,
+            int taskId, Consumer<SplashScreenView> consumer) {
+        mSplashscreenWorkerHandler.post(() -> {
+            SplashScreenView contentView;
+            try {
+                contentView = SplashscreenContentDrawer.makeSplashscreenContent(
+                        context, splashScreenResId);
+                if (contentView == null) {
+                    Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "makeSplashScreenContentView");
+                    contentView = makeSplashScreenContentView(context, info);
+                    Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
+                }
+            } catch (RuntimeException e) {
+                Slog.w(TAG, "failed creating starting window content at taskId: "
+                        + taskId, e);
+                contentView = null;
+            }
+            consumer.accept(contentView);
+        });
     }
 
     private void updateDensity() {
@@ -146,7 +190,7 @@
         }
     }
 
-    SplashScreenView makeSplashScreenContentView(Context context, ActivityInfo ai) {
+    private SplashScreenView makeSplashScreenContentView(Context context, ActivityInfo ai) {
         updateDensity();
 
         getWindowAttrs(context, mTmpAttrs);
@@ -199,7 +243,7 @@
         }
     }
 
-    static class SplashScreenWindowAttrs {
+    private static class SplashScreenWindowAttrs {
         private int mWindowBgResId = 0;
         private int mWindowBgColor = Color.TRANSPARENT;
         private Drawable mReplaceIcon = null;
@@ -271,9 +315,7 @@
                 if (DEBUG) {
                     Slog.d(TAG, "The icon is not an AdaptiveIconDrawable");
                 }
-                mFinalIconDrawable = SplashscreenIconDrawableFactory.makeIconDrawable(
-                        mIconBackground != Color.TRANSPARENT
-                        ? mIconBackground : mThemeColor, mIconDrawable, mIconSize);
+                createIconDrawable(mIconDrawable, mIconSize);
             }
             final int iconSize = mFinalIconDrawable != null ? (int) (mIconSize * mScale) : 0;
             mCachedResult = fillViewWithIcon(mContext, iconSize, mFinalIconDrawable);
@@ -283,8 +325,8 @@
 
         private void createIconDrawable(Drawable iconDrawable, int iconSize) {
             mFinalIconDrawable = SplashscreenIconDrawableFactory.makeIconDrawable(
-                    mIconBackground != Color.TRANSPARENT
-                    ? mIconBackground : mThemeColor, iconDrawable, iconSize);
+                    mIconBackground != Color.TRANSPARENT ? mIconBackground : mThemeColor,
+                    iconDrawable, iconSize, mSplashscreenWorkerHandler);
         }
 
         private boolean processAdaptiveIcon() {
@@ -399,7 +441,7 @@
         return root < 0.1;
     }
 
-    static SplashScreenView makeSplashscreenContent(Context ctx,
+    private static SplashScreenView makeSplashscreenContent(Context ctx,
             int splashscreenContentResId) {
         // doesn't support windowSplashscreenContent after S
         // TODO add an allowlist to skip some packages if needed
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java
index 4196d68..85845d0 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java
@@ -37,6 +37,7 @@
 import android.graphics.drawable.Animatable;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
+import android.os.Handler;
 import android.os.Trace;
 import android.util.PathParser;
 import android.window.SplashScreenView;
@@ -50,42 +51,61 @@
 public class SplashscreenIconDrawableFactory {
 
     static Drawable makeIconDrawable(@ColorInt int backgroundColor,
-            @NonNull Drawable foregroundDrawable, int iconSize) {
+            @NonNull Drawable foregroundDrawable, int iconSize,
+            Handler splashscreenWorkerHandler) {
         if (foregroundDrawable instanceof Animatable) {
             return new AnimatableIconDrawable(backgroundColor, foregroundDrawable);
         } else if (foregroundDrawable instanceof AdaptiveIconDrawable) {
-            return new ImmobileIconDrawable((AdaptiveIconDrawable) foregroundDrawable, iconSize);
+            return new ImmobileIconDrawable((AdaptiveIconDrawable) foregroundDrawable, iconSize,
+                    splashscreenWorkerHandler);
         } else {
             return new ImmobileIconDrawable(new AdaptiveIconDrawable(
-                    new ColorDrawable(backgroundColor), foregroundDrawable), iconSize);
+                    new ColorDrawable(backgroundColor), foregroundDrawable), iconSize,
+                    splashscreenWorkerHandler);
         }
     }
 
     private static class ImmobileIconDrawable extends Drawable {
-        private Shader mLayersShader;
+        private boolean mCacheComplete;
         private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG
                 | Paint.FILTER_BITMAP_FLAG);
 
-        ImmobileIconDrawable(AdaptiveIconDrawable drawable, int iconSize) {
-            cachePaint(drawable, iconSize, iconSize);
+        ImmobileIconDrawable(AdaptiveIconDrawable drawable, int iconSize,
+                Handler splashscreenWorkerHandler) {
+            splashscreenWorkerHandler.post(() -> cachePaint(drawable, iconSize, iconSize));
         }
 
         private void cachePaint(AdaptiveIconDrawable drawable, int width, int height) {
-            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "cachePaint");
-            final Bitmap layersBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
-            final Canvas canvas = new Canvas(layersBitmap);
-            drawable.setBounds(0, 0, width, height);
-            drawable.draw(canvas);
-            mLayersShader = new BitmapShader(layersBitmap, Shader.TileMode.CLAMP,
-                    Shader.TileMode.CLAMP);
-            mPaint.setShader(mLayersShader);
-            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
+            synchronized (mPaint) {
+                if (mCacheComplete) {
+                    return;
+                }
+                Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "cachePaint");
+                final Bitmap layersBitmap = Bitmap.createBitmap(width, height,
+                        Bitmap.Config.ARGB_8888);
+                final Canvas canvas = new Canvas(layersBitmap);
+                drawable.setBounds(0, 0, width, height);
+                drawable.draw(canvas);
+                final Shader layersShader = new BitmapShader(layersBitmap, Shader.TileMode.CLAMP,
+                        Shader.TileMode.CLAMP);
+                mPaint.setShader(layersShader);
+                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
+                mCacheComplete = true;
+            }
         }
 
         @Override
         public void draw(Canvas canvas) {
-            final Rect bounds = getBounds();
-            canvas.drawRect(bounds, mPaint);
+            synchronized (mPaint) {
+                if (mCacheComplete) {
+                    final Rect bounds = getBounds();
+                    canvas.drawRect(bounds, mPaint);
+                } else {
+                    // this shouldn't happen, but if it really happen, invalidate self to wait
+                    // for cachePaint finish.
+                    invalidateSelf();
+                }
+            }
         }
 
         @Override
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
index e95135a..7037d18 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java
@@ -18,8 +18,10 @@
 
 import static android.content.Context.CONTEXT_RESTRICTED;
 import static android.content.res.Configuration.EMPTY;
+import static android.view.Choreographer.CALLBACK_INSETS_ANIMATION;
 import static android.view.Display.DEFAULT_DISPLAY;
 
+import android.annotation.Nullable;
 import android.app.ActivityManager.RunningTaskInfo;
 import android.app.ActivityTaskManager;
 import android.content.Context;
@@ -29,16 +31,15 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
-import android.graphics.Color;
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
-import android.graphics.drawable.ColorDrawable;
 import android.hardware.display.DisplayManager;
 import android.os.IBinder;
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.util.Slog;
 import android.util.SparseArray;
+import android.view.Choreographer;
 import android.view.Display;
 import android.view.SurfaceControl;
 import android.view.View;
@@ -54,9 +55,44 @@
 import com.android.wm.shell.common.TransactionPool;
 
 import java.util.function.Consumer;
+import java.util.function.Supplier;
 
 /**
  * A class which able to draw splash screen or snapshot as the starting window for a task.
+ *
+ * In order to speed up, there will use two threads to creating a splash screen in parallel.
+ * Right now we are still using PhoneWindow to create splash screen window, so the view is added to
+ * the ViewRootImpl, and those view won't be draw immediately because the ViewRootImpl will call
+ * scheduleTraversal to register a callback from Choreographer, so the drawing result of the view
+ * can synchronize on each frame.
+ *
+ * The bad thing is that we cannot decide when would Choreographer#doFrame happen, and drawing
+ * the AdaptiveIconDrawable object can be time consuming, so we use the splash-screen background
+ * thread to draw the AdaptiveIconDrawable object to a Bitmap and cache it to a BitmapShader after
+ * the SplashScreenView just created, once we get the BitmapShader then the #draw call can be very
+ * quickly.
+ *
+ * So basically we are using the spare time to prepare the SplashScreenView while splash screen
+ * thread is waiting for
+ * 1. WindowManager#addView(binder call to WM),
+ * 2. Choreographer#doFrame happen(uncertain time for next frame, depends on device),
+ * 3. Session#relayout(another binder call to WM which under Choreographer#doFrame, but will
+ * always happen before #draw).
+ * Because above steps are running on splash-screen thread, so pre-draw the BitmapShader on
+ * splash-screen background tread can make they execute in parallel, which ensure it is faster then
+ * to draw the AdaptiveIconDrawable when receive callback from Choreographer#doFrame.
+ *
+ * Here is the sequence to compare the difference between using single and two thread.
+ *
+ * Single thread:
+ * => makeSplashScreenContentView -> WM#addView .. waiting for Choreographer#doFrame -> relayout
+ * -> draw -> AdaptiveIconDrawable#draw
+ *
+ * Two threads:
+ * => makeSplashScreenContentView -> cachePaint(=AdaptiveIconDrawable#draw)
+ * => WM#addView -> .. waiting for Choreographer#doFrame -> relayout -> draw -> (draw the Paint
+ * directly).
+ *
  * @hide
  */
 public class StartingSurfaceDrawer {
@@ -68,7 +104,11 @@
     private final DisplayManager mDisplayManager;
     private final ShellExecutor mSplashScreenExecutor;
     private final SplashscreenContentDrawer mSplashscreenContentDrawer;
+    private Choreographer mChoreographer;
 
+    /**
+     * @param splashScreenExecutor The thread used to control add and remove starting window.
+     */
     public StartingSurfaceDrawer(Context context, ShellExecutor splashScreenExecutor,
             TransactionPool pool) {
         mContext = context;
@@ -82,6 +122,7 @@
                 com.android.wm.shell.R.integer.starting_window_app_reveal_anim_duration);
         mSplashscreenContentDrawer = new SplashscreenContentDrawer(mContext,
                 maxAnimatableIconDuration, iconExitAnimDuration, appRevealAnimDuration, pool);
+        mSplashScreenExecutor.execute(() -> mChoreographer = Choreographer.getInstance());
     }
 
     private final SparseArray<StartingWindowRecord> mStartingWindowRecords = new SparseArray<>();
@@ -267,36 +308,91 @@
         params.setTitle("Splash Screen " + activityInfo.packageName);
 
         // TODO(b/173975965) tracking performance
-        SplashScreenView sView = null;
+        // Prepare the splash screen content view on splash screen worker thread in parallel, so the
+        // content view won't be blocked by binder call like addWindow and relayout.
+        // 1. Trigger splash screen worker thread to create SplashScreenView before/while
+        // Session#addWindow.
+        // 2. Synchronize the SplashscreenView to splash screen thread before Choreographer start
+        // traversal, which will call Session#relayout on splash screen thread.
+        // 3. Pre-draw the BitmapShader if the icon is immobile on splash screen worker thread, at
+        // the same time the splash screen thread should be executing Session#relayout. Blocking the
+        // traversal -> draw on splash screen thread until the BitmapShader of the icon is ready.
+        final Runnable setViewSynchronized;
+        if (!emptyView) {
+            // Record whether create splash screen view success, notify to current thread after
+            // create splash screen view finished.
+            final SplashScreenViewSupplier viewSupplier = new SplashScreenViewSupplier();
+            setViewSynchronized = () -> {
+                // waiting for setContentView before relayoutWindow
+                SplashScreenView contentView = viewSupplier.get();
+                final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
+                // if record == null, either the starting window added fail or removed already.
+                if (record != null) {
+                    // if view == null then creation of content view was failed.
+                    if (contentView != null) {
+                        try {
+                            win.setContentView(contentView);
+                            contentView.cacheRootWindow(win);
+                        } catch (RuntimeException e) {
+                            Slog.w(TAG, "failed set content view to starting window "
+                                    + "at taskId: " + taskId, e);
+                            contentView = null;
+                        }
+                    }
+                    record.setSplashScreenView(contentView);
+                }
+            };
+            mSplashscreenContentDrawer.createContentView(context,
+                    splashscreenContentResId[0], activityInfo, taskId, viewSupplier::setView);
+        } else {
+            setViewSynchronized = null;
+        }
+
         try {
             final View view = win.getDecorView();
             final WindowManager wm = mContext.getSystemService(WindowManager.class);
-            if (!emptyView) {
-                // splash screen content will be deprecated after S.
-                sView = SplashscreenContentDrawer.makeSplashscreenContent(
-                        context, splashscreenContentResId[0]);
-                final boolean splashscreenContentCompatible = sView != null;
-                if (splashscreenContentCompatible) {
-                    win.setContentView(sView);
-                } else {
-                    sView = mSplashscreenContentDrawer
-                            .makeSplashScreenContentView(context, activityInfo);
-                    win.setContentView(sView);
-                    win.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
-                    sView.cacheRootWindow(win);
-                }
-            }
             postAddWindow(taskId, appToken, view, wm, params);
+
+            // all done
+            if (emptyView) {
+                return;
+            }
+            // We use the splash screen worker thread to create SplashScreenView while adding the
+            // window, as otherwise Choreographer#doFrame might be delayed on this thread.
+            // And since Choreographer#doFrame won't happen immediately after adding the window, if
+            // the view is not added to the PhoneWindow on the first #doFrame, the view will not be
+            // rendered on the first frame. So here we need to synchronize the view on the window
+            // before first round relayoutWindow, which will happen after insets animation.
+            mChoreographer.postCallback(CALLBACK_INSETS_ANIMATION, setViewSynchronized, null);
         } catch (RuntimeException e) {
             // don't crash if something else bad happens, for example a
             // failure loading resources because we are loading from an app
             // on external storage that has been unmounted.
-            Slog.w(TAG, " failed creating starting window at taskId: " + taskId, e);
-            sView = null;
-        } finally {
-            final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
-            if (record != null) {
-                record.setSplashScreenView(sView);
+            Slog.w(TAG, "failed creating starting window at taskId: " + taskId, e);
+        }
+    }
+
+    private static class SplashScreenViewSupplier implements Supplier<SplashScreenView> {
+        private SplashScreenView mView;
+        private boolean mIsViewSet;
+        void setView(SplashScreenView view) {
+            synchronized (this) {
+                mView = view;
+                mIsViewSet = true;
+                notify();
+            }
+        }
+
+        @Override
+        public @Nullable SplashScreenView get() {
+            synchronized (this) {
+                while (!mIsViewSet) {
+                    try {
+                        wait();
+                    } catch (InterruptedException ignored) {
+                    }
+                }
+                return mView;
             }
         }
     }
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java
index 8a629bc..e336287 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java
@@ -16,6 +16,7 @@
 package com.android.wm.shell.startingsurface;
 
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
+import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
 import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN;
 import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE;
 import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT;
@@ -30,11 +31,11 @@
 import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
 
 import android.app.ActivityManager.RunningTaskInfo;
-import android.app.ActivityTaskManager;
 import android.content.Context;
 import android.graphics.Rect;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.os.Trace;
 import android.util.Slog;
 import android.view.SurfaceControl;
 import android.window.StartingWindowInfo;
@@ -109,17 +110,9 @@
     }
 
     private static class StartingTypeChecker {
-        TaskSnapshot mSnapshot;
-
-        StartingTypeChecker() { }
-
-        private void reset() {
-            mSnapshot = null;
-        }
 
         private @StartingWindowInfo.StartingWindowType int
                 estimateStartingWindowType(StartingWindowInfo windowInfo) {
-            reset();
             final int parameter = windowInfo.startingWindowTypeParameter;
             final boolean newTask = (parameter & TYPE_PARAMETER_NEW_TASK) != 0;
             final boolean taskSwitch = (parameter & TYPE_PARAMETER_TASK_SWITCH) != 0;
@@ -159,7 +152,7 @@
                 }
             }
             if (taskSwitch && allowTaskSnapshot) {
-                final TaskSnapshot snapshot = getTaskSnapshot(windowInfo.taskInfo.taskId);
+                final TaskSnapshot snapshot = windowInfo.mTaskSnapshot;
                 if (isSnapshotCompatible(windowInfo, snapshot)) {
                     return STARTING_WINDOW_TYPE_SNAPSHOT;
                 }
@@ -198,20 +191,6 @@
             }
             return taskRotation == snapshotRotation;
         }
-
-        private TaskSnapshot getTaskSnapshot(int taskId) {
-            if (mSnapshot != null) {
-                return mSnapshot;
-            }
-            try {
-                mSnapshot = ActivityTaskManager.getService().getTaskSnapshot(taskId,
-                        false/* isLowResolution */);
-            } catch (RemoteException e) {
-                Slog.e(TAG, "Unable to get snapshot for task: " + taskId + ", from: " + e);
-                return null;
-            }
-            return mSnapshot;
-        }
     }
 
     /*
@@ -232,7 +211,9 @@
      */
     public void addStartingWindow(StartingWindowInfo windowInfo, IBinder appToken) {
         mSplashScreenExecutor.execute(() -> {
-            final int suggestionType = mStartingTypeChecker.estimateStartingWindowType(windowInfo);
+            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "addStartingWindow");
+            final int suggestionType = mStartingTypeChecker.estimateStartingWindowType(
+                    windowInfo);
             final RunningTaskInfo runningTaskInfo = windowInfo.taskInfo;
             if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) {
                 mTaskLaunchingCallback.accept(runningTaskInfo.taskId, suggestionType);
@@ -244,10 +225,12 @@
                 mStartingSurfaceDrawer.addSplashScreenStartingWindow(windowInfo, appToken,
                         true /* emptyView */);
             } else if (suggestionType == STARTING_WINDOW_TYPE_SNAPSHOT) {
-                final TaskSnapshot snapshot = mStartingTypeChecker.mSnapshot;
-                mStartingSurfaceDrawer.makeTaskSnapshotWindow(windowInfo, appToken, snapshot);
+                final TaskSnapshot snapshot = windowInfo.mTaskSnapshot;
+                mStartingSurfaceDrawer.makeTaskSnapshotWindow(windowInfo, appToken,
+                        snapshot);
             }
             // If prefer don't show, then don't show!
+            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
         });
     }
 
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
index 6e43741..e9ce2ad 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
@@ -19,6 +19,7 @@
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
 import static android.graphics.Color.WHITE;
 import static android.graphics.Color.alpha;
+import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
 import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
 import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
 import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
@@ -60,6 +61,7 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.SystemClock;
+import android.os.Trace;
 import android.util.MergedConfiguration;
 import android.util.Slog;
 import android.view.IWindowSession;
@@ -222,8 +224,10 @@
         final InputChannel tmpInputChannel = new InputChannel();
         mainExecutor.execute(() -> {
             try {
+                Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "TaskSnapshot#addToDisplay");
                 final int res = session.addToDisplay(window, layoutParams, View.GONE, displayId,
                         mTmpInsetsState, tmpInputChannel, mTmpInsetsState, mTempControls);
+                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
                 if (res < 0) {
                     Slog.w(TAG, "Failed to add snapshot starting window res=" + res);
                     return;
@@ -233,9 +237,11 @@
             }
             window.setOuter(snapshotSurface);
             try {
+                Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "TaskSnapshot#relayout");
                 session.relayout(window, layoutParams, -1, -1, View.VISIBLE, 0, -1,
                         tmpFrames, tmpMergedConfiguration, surfaceControl, mTmpInsetsState,
                         mTempControls, TMP_SURFACE_SIZE);
+                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
             } catch (RemoteException e) {
                 snapshotSurface.clearWindowSynced();
             }
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawerTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawerTests.java
index d1d1313..2623535 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawerTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawerTests.java
@@ -77,9 +77,9 @@
         int mAddWindowForTask = 0;
         int mViewThemeResId;
 
-        TestStartingSurfaceDrawer(Context context, ShellExecutor animExecutor,
+        TestStartingSurfaceDrawer(Context context, ShellExecutor splashScreenExecutor,
                 TransactionPool pool) {
-            super(context, animExecutor, pool);
+            super(context, splashScreenExecutor, pool);
         }
 
         @Override
@@ -120,8 +120,9 @@
         doReturn(metrics).when(mMockWindowManager).getMaximumWindowMetrics();
         doNothing().when(mMockWindowManager).addView(any(), any());
 
-        mStartingSurfaceDrawer = spy(new TestStartingSurfaceDrawer(context,
-                new HandlerExecutor(new Handler(Looper.getMainLooper())),
+        final HandlerExecutor testExecutor =
+                new HandlerExecutor(new Handler(Looper.getMainLooper()));
+        mStartingSurfaceDrawer = spy(new TestStartingSurfaceDrawer(context, testExecutor,
                 mTransactionPool));
     }
 
diff --git a/libs/hwui/WebViewFunctorManager.cpp b/libs/hwui/WebViewFunctorManager.cpp
index 671c66f..979678d 100644
--- a/libs/hwui/WebViewFunctorManager.cpp
+++ b/libs/hwui/WebViewFunctorManager.cpp
@@ -18,6 +18,7 @@
 
 #include <private/hwui/WebViewFunctor.h>
 #include "Properties.h"
+#include "renderthread/CanvasContext.h"
 #include "renderthread/RenderThread.h"
 
 #include <log/log.h>
@@ -115,11 +116,20 @@
     ScopedCurrentFunctor currentFunctor(this);
 
     WebViewOverlayData overlayParams = {
-            // TODO:
             .overlaysMode = OverlaysMode::Disabled,
             .getSurfaceControl = currentFunctor.getSurfaceControl,
             .mergeTransaction = currentFunctor.mergeTransaction,
     };
+
+    if (!drawInfo.isLayer) {
+        renderthread::CanvasContext* activeContext =
+                renderthread::CanvasContext::getActiveContext();
+        if (activeContext != nullptr) {
+            ASurfaceControl* rootSurfaceControl = activeContext->getSurfaceControl();
+            if (rootSurfaceControl) overlayParams.overlaysMode = OverlaysMode::Enabled;
+        }
+    }
+
     mCallbacks.gles.draw(mFunctor, mData, drawInfo, overlayParams);
 }
 
@@ -138,11 +148,12 @@
     ScopedCurrentFunctor currentFunctor(this);
 
     WebViewOverlayData overlayParams = {
-            // TODO
             .overlaysMode = OverlaysMode::Disabled,
             .getSurfaceControl = currentFunctor.getSurfaceControl,
             .mergeTransaction = currentFunctor.mergeTransaction,
     };
+
+    // TODO, enable surface control once offscreen mode figured out
     mCallbacks.vk.draw(mFunctor, mData, params, overlayParams);
 }
 
@@ -166,15 +177,43 @@
 void WebViewFunctor::removeOverlays() {
     ScopedCurrentFunctor currentFunctor(this);
     mCallbacks.removeOverlays(mFunctor, mData, currentFunctor.mergeTransaction);
+    if (mSurfaceControl) {
+        auto funcs = renderthread::RenderThread::getInstance().getASurfaceControlFunctions();
+        funcs.releaseFunc(mSurfaceControl);
+        mSurfaceControl = nullptr;
+    }
 }
 
 ASurfaceControl* WebViewFunctor::getSurfaceControl() {
-    // TODO
-    return nullptr;
+    ATRACE_NAME("WebViewFunctor::getSurfaceControl");
+    if (mSurfaceControl != nullptr) return mSurfaceControl;
+
+    renderthread::CanvasContext* activeContext = renderthread::CanvasContext::getActiveContext();
+    LOG_ALWAYS_FATAL_IF(activeContext == nullptr, "Null active canvas context!");
+
+    ASurfaceControl* rootSurfaceControl = activeContext->getSurfaceControl();
+    LOG_ALWAYS_FATAL_IF(rootSurfaceControl == nullptr, "Null root surface control!");
+
+    auto funcs = renderthread::RenderThread::getInstance().getASurfaceControlFunctions();
+    mSurfaceControl = funcs.createFunc(rootSurfaceControl, "Webview Overlay SurfaceControl");
+    ASurfaceTransaction* transaction = funcs.transactionCreateFunc();
+    funcs.transactionSetVisibilityFunc(transaction, mSurfaceControl,
+                                       ASURFACE_TRANSACTION_VISIBILITY_SHOW);
+    funcs.transactionApplyFunc(transaction);
+    funcs.transactionDeleteFunc(transaction);
+    return mSurfaceControl;
 }
 
 void WebViewFunctor::mergeTransaction(ASurfaceTransaction* transaction) {
-    // TODO
+    ATRACE_NAME("WebViewFunctor::mergeTransaction");
+    if (transaction == nullptr) return;
+    renderthread::CanvasContext* activeContext = renderthread::CanvasContext::getActiveContext();
+    LOG_ALWAYS_FATAL_IF(activeContext == nullptr, "Null active canvas context!");
+    bool done = activeContext->mergeTransaction(transaction, mSurfaceControl);
+    if (!done) {
+        auto funcs = renderthread::RenderThread::getInstance().getASurfaceControlFunctions();
+        funcs.transactionApplyFunc(transaction);
+    }
 }
 
 WebViewFunctorManager& WebViewFunctorManager::instance() {
diff --git a/libs/hwui/WebViewFunctorManager.h b/libs/hwui/WebViewFunctorManager.h
index 17b936a..a84cda5 100644
--- a/libs/hwui/WebViewFunctorManager.h
+++ b/libs/hwui/WebViewFunctorManager.h
@@ -91,6 +91,7 @@
     RenderMode mMode;
     bool mHasContext = false;
     bool mCreatedHandle = false;
+    ASurfaceControl* mSurfaceControl = nullptr;
 };
 
 class WebViewFunctorManager {
diff --git a/libs/hwui/jni/android_graphics_HardwareRenderer.cpp b/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
index d859541..dd78d58 100644
--- a/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
+++ b/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
@@ -64,6 +64,10 @@
 } gHardwareRenderer;
 
 struct {
+    jmethodID onMergeTransaction;
+} gASurfaceTransactionCallback;
+
+struct {
     jmethodID onFrameDraw;
 } gFrameDrawingCallback;
 
@@ -509,6 +513,27 @@
     }
 }
 
+static void android_view_ThreadedRenderer_setASurfaceTransactionCallback(
+        JNIEnv* env, jobject clazz, jlong proxyPtr, jobject aSurfaceTransactionCallback) {
+    RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
+    if (!aSurfaceTransactionCallback) {
+        proxy->setASurfaceTransactionCallback(nullptr);
+    } else {
+        JavaVM* vm = nullptr;
+        LOG_ALWAYS_FATAL_IF(env->GetJavaVM(&vm) != JNI_OK, "Unable to get Java VM");
+        auto globalCallbackRef = std::make_shared<JGlobalRefHolder>(
+                vm, env->NewGlobalRef(aSurfaceTransactionCallback));
+        proxy->setASurfaceTransactionCallback(
+                [globalCallbackRef](int64_t transObj, int64_t scObj, int64_t frameNr) {
+                    JNIEnv* env = getenv(globalCallbackRef->vm());
+                    env->CallVoidMethod(globalCallbackRef->object(),
+                                        gASurfaceTransactionCallback.onMergeTransaction,
+                                        static_cast<jlong>(transObj), static_cast<jlong>(scObj),
+                                        static_cast<jlong>(frameNr));
+                });
+    }
+}
+
 static void android_view_ThreadedRenderer_setFrameCallback(JNIEnv* env,
         jobject clazz, jlong proxyPtr, jobject frameCallback) {
     RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
@@ -762,8 +787,7 @@
         {"nSetName", "(JLjava/lang/String;)V", (void*)android_view_ThreadedRenderer_setName},
         {"nSetSurface", "(JLandroid/view/Surface;Z)V",
          (void*)android_view_ThreadedRenderer_setSurface},
-        {"nSetSurfaceControl", "(JJ)V",
-         (void*)android_view_ThreadedRenderer_setSurfaceControl},
+        {"nSetSurfaceControl", "(JJ)V", (void*)android_view_ThreadedRenderer_setSurfaceControl},
         {"nPause", "(J)Z", (void*)android_view_ThreadedRenderer_pause},
         {"nSetStopped", "(JZ)V", (void*)android_view_ThreadedRenderer_setStopped},
         {"nSetLightAlpha", "(JFF)V", (void*)android_view_ThreadedRenderer_setLightAlpha},
@@ -804,6 +828,9 @@
         {"nSetPictureCaptureCallback",
          "(JLandroid/graphics/HardwareRenderer$PictureCapturedCallback;)V",
          (void*)android_view_ThreadedRenderer_setPictureCapturedCallbackJNI},
+        {"nSetASurfaceTransactionCallback",
+         "(JLandroid/graphics/HardwareRenderer$ASurfaceTransactionCallback;)V",
+         (void*)android_view_ThreadedRenderer_setASurfaceTransactionCallback},
         {"nSetFrameCallback", "(JLandroid/graphics/HardwareRenderer$FrameDrawingCallback;)V",
          (void*)android_view_ThreadedRenderer_setFrameCallback},
         {"nSetFrameCompleteCallback",
@@ -866,6 +893,11 @@
             GetStaticMethodIDOrDie(env, hardwareRenderer, "closeHintSession",
                                    "(Landroid/os/PerformanceHintManager$Session;)V");
 
+    jclass aSurfaceTransactionCallbackClass =
+            FindClassOrDie(env, "android/graphics/HardwareRenderer$ASurfaceTransactionCallback");
+    gASurfaceTransactionCallback.onMergeTransaction =
+            GetMethodIDOrDie(env, aSurfaceTransactionCallbackClass, "onMergeTransaction", "(JJJ)V");
+
     jclass frameCallbackClass = FindClassOrDie(env,
             "android/graphics/HardwareRenderer$FrameDrawingCallback");
     gFrameDrawingCallback.onFrameDraw = GetMethodIDOrDie(env, frameCallbackClass,
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 2482188..bba2207 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -56,6 +56,22 @@
 namespace uirenderer {
 namespace renderthread {
 
+namespace {
+class ScopedActiveContext {
+public:
+    ScopedActiveContext(CanvasContext* context) { sActiveContext = context; }
+
+    ~ScopedActiveContext() { sActiveContext = nullptr; }
+
+    static CanvasContext* getActiveContext() { return sActiveContext; }
+
+private:
+    static CanvasContext* sActiveContext;
+};
+
+CanvasContext* ScopedActiveContext::sActiveContext = nullptr;
+} /* namespace */
+
 CanvasContext* CanvasContext::create(RenderThread& thread, bool translucent,
                                      RenderNode* rootRenderNode, IContextFactory* contextFactory) {
     auto renderType = Properties::getRenderPipelineType();
@@ -473,6 +489,7 @@
         return;
     }
 
+    ScopedActiveContext activeContext(this);
     mCurrentFrameInfo->set(FrameInfoIndex::FrameInterval) =
             mRenderThread.timeLord().frameIntervalNanos();
 
@@ -880,6 +897,17 @@
     return windowDirty;
 }
 
+CanvasContext* CanvasContext::getActiveContext() {
+    return ScopedActiveContext::getActiveContext();
+}
+
+bool CanvasContext::mergeTransaction(ASurfaceTransaction* transaction, ASurfaceControl* control) {
+    if (!mASurfaceTransactionCallback) return false;
+    std::invoke(mASurfaceTransactionCallback, reinterpret_cast<int64_t>(transaction),
+                reinterpret_cast<int64_t>(control), getFrameNumber());
+    return true;
+}
+
 } /* namespace renderthread */
 } /* namespace uirenderer */
 } /* namespace android */
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 74f426e..af1ebb2 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -109,6 +109,8 @@
      */
     GrDirectContext* getGrContext() const { return mRenderThread.getGrContext(); }
 
+    ASurfaceControl* getSurfaceControl() const { return mSurfaceControl; }
+
     // Won't take effect until next EGLSurface creation
     void setSwapBehavior(SwapBehavior swapBehavior);
 
@@ -201,6 +203,15 @@
     static void onSurfaceStatsAvailable(void* context, ASurfaceControl* control,
             ASurfaceControlStats* stats);
 
+    void setASurfaceTransactionCallback(
+            const std::function<void(int64_t, int64_t, int64_t)>& callback) {
+        mASurfaceTransactionCallback = callback;
+    }
+
+    bool mergeTransaction(ASurfaceTransaction* transaction, ASurfaceControl* control);
+
+    static CanvasContext* getActiveContext();
+
 private:
     CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode,
                   IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline);
@@ -296,6 +307,8 @@
 
     // If set to true, we expect that callbacks into onSurfaceStatsAvailable
     bool mExpectSurfaceStats = false;
+
+    std::function<void(int64_t, int64_t, int64_t)> mASurfaceTransactionCallback;
 };
 
 } /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 9361abd..1b4b4b9 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -295,6 +295,12 @@
             [this, cb = callback]() { mContext->setPictureCapturedCallback(cb); });
 }
 
+void RenderProxy::setASurfaceTransactionCallback(
+        const std::function<void(int64_t, int64_t, int64_t)>& callback) {
+    mRenderThread.queue().post(
+            [this, cb = callback]() { mContext->setASurfaceTransactionCallback(cb); });
+}
+
 void RenderProxy::setFrameCallback(std::function<void(int64_t)>&& callback) {
     mDrawFrameTask.setFrameCallback(std::move(callback));
 }
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 8d55d3c..288f555 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -120,6 +120,8 @@
     void drawRenderNode(RenderNode* node);
     void setContentDrawBounds(int left, int top, int right, int bottom);
     void setPictureCapturedCallback(const std::function<void(sk_sp<SkPicture>&&)>& callback);
+    void setASurfaceTransactionCallback(
+            const std::function<void(int64_t, int64_t, int64_t)>& callback);
     void setFrameCallback(std::function<void(int64_t)>&& callback);
     void setFrameCompleteCallback(std::function<void(int64_t)>&& callback);
 
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 682baa6..04aa1cb 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -54,6 +54,10 @@
 
 ASurfaceControlFunctions::ASurfaceControlFunctions() {
     void* handle_ = dlopen("libandroid.so", RTLD_NOW | RTLD_NODELETE);
+    createFunc = (ASC_create)dlsym(handle_, "ASurfaceControl_create");
+    LOG_ALWAYS_FATAL_IF(createFunc == nullptr,
+                        "Failed to find required symbol ASurfaceControl_create!");
+
     acquireFunc = (ASC_acquire) dlsym(handle_, "ASurfaceControl_acquire");
     LOG_ALWAYS_FATAL_IF(acquireFunc == nullptr,
             "Failed to find required symbol ASurfaceControl_acquire!");
@@ -81,6 +85,23 @@
             "ASurfaceControlStats_getFrameNumber");
     LOG_ALWAYS_FATAL_IF(getFrameNumberFunc == nullptr,
             "Failed to find required symbol ASurfaceControlStats_getFrameNumber!");
+
+    transactionCreateFunc = (AST_create)dlsym(handle_, "ASurfaceTransaction_create");
+    LOG_ALWAYS_FATAL_IF(transactionCreateFunc == nullptr,
+                        "Failed to find required symbol ASurfaceTransaction_create!");
+
+    transactionDeleteFunc = (AST_delete)dlsym(handle_, "ASurfaceTransaction_delete");
+    LOG_ALWAYS_FATAL_IF(transactionDeleteFunc == nullptr,
+                        "Failed to find required symbol ASurfaceTransaction_delete!");
+
+    transactionApplyFunc = (AST_apply)dlsym(handle_, "ASurfaceTransaction_apply");
+    LOG_ALWAYS_FATAL_IF(transactionApplyFunc == nullptr,
+                        "Failed to find required symbol ASurfaceTransaction_apply!");
+
+    transactionSetVisibilityFunc =
+            (AST_setVisibility)dlsym(handle_, "ASurfaceTransaction_setVisibility");
+    LOG_ALWAYS_FATAL_IF(transactionSetVisibilityFunc == nullptr,
+                        "Failed to find required symbol ASurfaceTransaction_setVisibility!");
 }
 
 void RenderThread::frameCallback(int64_t frameTimeNanos, void* data) {
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 9e5bce7..cd9b923 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -79,25 +79,39 @@
     virtual ~VsyncSource() {}
 };
 
+typedef ASurfaceControl* (*ASC_create)(ASurfaceControl* parent, const char* debug_name);
 typedef void (*ASC_acquire)(ASurfaceControl* control);
 typedef void (*ASC_release)(ASurfaceControl* control);
 
 typedef void (*ASC_registerSurfaceStatsListener)(ASurfaceControl* control, void* context,
         ASurfaceControl_SurfaceStatsListener func);
 typedef void (*ASC_unregisterSurfaceStatsListener)(void* context,
-                                       ASurfaceControl_SurfaceStatsListener func);
+                                                   ASurfaceControl_SurfaceStatsListener func);
 
 typedef int64_t (*ASCStats_getAcquireTime)(ASurfaceControlStats* stats);
 typedef uint64_t (*ASCStats_getFrameNumber)(ASurfaceControlStats* stats);
 
+typedef ASurfaceTransaction* (*AST_create)();
+typedef void (*AST_delete)(ASurfaceTransaction* transaction);
+typedef void (*AST_apply)(ASurfaceTransaction* transaction);
+typedef void (*AST_setVisibility)(ASurfaceTransaction* transaction,
+                                  ASurfaceControl* surface_control, int8_t visibility);
+
 struct ASurfaceControlFunctions {
     ASurfaceControlFunctions();
+
+    ASC_create createFunc;
     ASC_acquire acquireFunc;
     ASC_release releaseFunc;
     ASC_registerSurfaceStatsListener registerListenerFunc;
     ASC_unregisterSurfaceStatsListener unregisterListenerFunc;
     ASCStats_getAcquireTime getAcquireTimeFunc;
     ASCStats_getFrameNumber getFrameNumberFunc;
+
+    AST_create transactionCreateFunc;
+    AST_delete transactionDeleteFunc;
+    AST_apply transactionApplyFunc;
+    AST_setVisibility transactionSetVisibilityFunc;
 };
 
 class ChoreographerSource;
diff --git a/media/java/android/media/metrics/Event.java b/media/java/android/media/metrics/Event.java
index 17218f0..4a69ac5 100644
--- a/media/java/android/media/metrics/Event.java
+++ b/media/java/android/media/metrics/Event.java
@@ -32,19 +32,17 @@
         mTimeSinceCreatedMillis = MediaMetricsManager.INVALID_TIMESTAMP;
     }
 
-    // TODO: remove
-    protected Event(long timeSinceCreatedMillis) {
-        mTimeSinceCreatedMillis = timeSinceCreatedMillis;
-    }
-
     /* package */ Event(long timeSinceCreatedMillis, Bundle extras) {
         mTimeSinceCreatedMillis = timeSinceCreatedMillis;
         mMetricsBundle = extras;
     }
 
     /**
-     * Gets time since the corresponding instance is created in millisecond.
+     * Gets time since the corresponding log session is created in millisecond.
      * @return the timestamp since the instance is created, or -1 if unknown.
+     * @see LogSessionId
+     * @see PlaybackSession
+     * @see RecordingSession
      */
     @IntRange(from = -1)
     public long getTimeSinceCreatedMillis() {
diff --git a/media/java/android/media/metrics/MediaMetricsManager.java b/media/java/android/media/metrics/MediaMetricsManager.java
index b4a74a3..23b697f 100644
--- a/media/java/android/media/metrics/MediaMetricsManager.java
+++ b/media/java/android/media/metrics/MediaMetricsManager.java
@@ -25,7 +25,7 @@
  * This class gives information about, and interacts with media metrics.
  */
 @SystemService(Context.MEDIA_METRICS_SERVICE)
-public class MediaMetricsManager {
+public final class MediaMetricsManager {
     public static final long INVALID_TIMESTAMP = -1;
 
     private static final String TAG = "MediaMetricsManager";
diff --git a/media/java/android/media/metrics/NetworkEvent.java b/media/java/android/media/metrics/NetworkEvent.java
index 0e80543..7471d1d 100644
--- a/media/java/android/media/metrics/NetworkEvent.java
+++ b/media/java/android/media/metrics/NetworkEvent.java
@@ -105,10 +105,8 @@
 
     /**
      * Creates a new NetworkEvent.
-     *
-     * @hide
      */
-    public NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
+    private NetworkEvent(@NetworkType int type, long timeSinceCreatedMillis,
             @NonNull Bundle extras) {
         this.mNetworkType = type;
         this.mTimeSinceCreatedMillis = timeSinceCreatedMillis;
@@ -124,8 +122,11 @@
     }
 
     /**
-     * Gets timestamp since the creation in milliseconds.
+     * Gets timestamp since the creation of the log session in milliseconds.
      * @return the timestamp since the creation in milliseconds, or -1 if unknown.
+     * @see LogSessionId
+     * @see PlaybackSession
+     * @see RecordingSession
      */
     @Override
     @IntRange(from = -1)
@@ -177,8 +178,7 @@
         return 0;
     }
 
-    /** @hide */
-    /* package-private */ NetworkEvent(@NonNull android.os.Parcel in) {
+    private NetworkEvent(@NonNull android.os.Parcel in) {
         int type = in.readInt();
         long timeSinceCreatedMillis = in.readLong();
         Bundle extras = in.readBundle();
@@ -230,6 +230,7 @@
          * Sets timestamp since the creation in milliseconds.
          * @param value the timestamp since the creation in milliseconds.
          *              -1 indicates the value is unknown.
+         * @see #getTimeSinceCreatedMillis()
          */
         public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
             mTimeSinceCreatedMillis = value;
diff --git a/media/java/android/media/metrics/PlaybackErrorEvent.java b/media/java/android/media/metrics/PlaybackErrorEvent.java
index f36c04e..d155576 100644
--- a/media/java/android/media/metrics/PlaybackErrorEvent.java
+++ b/media/java/android/media/metrics/PlaybackErrorEvent.java
@@ -150,10 +150,8 @@
 
     /**
      * Creates a new PlaybackErrorEvent.
-     *
-     * @hide
      */
-    public PlaybackErrorEvent(
+    private PlaybackErrorEvent(
             @Nullable String exceptionStack,
             int errorCode,
             int subErrorCode,
@@ -191,8 +189,10 @@
     }
 
     /**
-     * Gets the timestamp since creation in milliseconds.
+     * Gets the timestamp since creation of the playback session in milliseconds.
      * @return the timestamp since the playback is created, or -1 if unknown.
+     * @see LogSessionId
+     * @see PlaybackSession
      */
     @Override
     @IntRange(from = -1)
@@ -254,8 +254,7 @@
         return 0;
     }
 
-    /** @hide */
-    /* package-private */ PlaybackErrorEvent(@NonNull Parcel in) {
+    private PlaybackErrorEvent(@NonNull Parcel in) {
         byte flg = in.readByte();
         String exceptionStack = (flg & 0x1) == 0 ? null : in.readString();
         int errorCode = in.readInt();
@@ -330,6 +329,7 @@
          * Set the timestamp since creation in milliseconds.
          * @param value the timestamp since the creation in milliseconds.
          *              -1 indicates the value is unknown.
+         * @see #getTimeSinceCreatedMillis()
          */
         public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
             mTimeSinceCreatedMillis = value;
diff --git a/media/java/android/media/metrics/PlaybackMetrics.java b/media/java/android/media/metrics/PlaybackMetrics.java
index 5f606a0..bbcc484 100644
--- a/media/java/android/media/metrics/PlaybackMetrics.java
+++ b/media/java/android/media/metrics/PlaybackMetrics.java
@@ -213,6 +213,7 @@
 
     /**
      * Gets the media duration in milliseconds.
+     * <p>Media duration is the length of the media.
      * @return the media duration in milliseconds, or -1 if unknown.
      */
     @IntRange(from = -1)
@@ -328,6 +329,8 @@
 
     /**
      * Gets network transfer duration in milliseconds.
+     * <p>Total transfer time spent reading from the network in ms. For parallel requests, the
+     * overlapping time intervals are counted only once.
      */
     @IntRange(from = -1)
     public long getNetworkTransferDurationMillis() {
@@ -523,6 +526,7 @@
         /**
          * Sets the media duration in milliseconds.
          * @param value the media duration in milliseconds. -1 indicates the value is unknown.
+         * @see #getMediaDurationMillis()
          */
         public @NonNull Builder setMediaDurationMillis(@IntRange(from = -1) long value) {
             mMediaDurationMillis = value;
@@ -645,6 +649,7 @@
          * Sets the network transfer duration in milliseconds.
          * @param value the network transfer duration in milliseconds.
          *              -1 indicates the value is unknown.
+         * @see #getNetworkTransferDurationMillis()
          */
         public @NonNull Builder setNetworkTransferDurationMillis(@IntRange(from = -1) long value) {
             mNetworkTransferDurationMillis = value;
diff --git a/media/java/android/media/metrics/PlaybackStateEvent.java b/media/java/android/media/metrics/PlaybackStateEvent.java
index 449abe9..8e74825 100644
--- a/media/java/android/media/metrics/PlaybackStateEvent.java
+++ b/media/java/android/media/metrics/PlaybackStateEvent.java
@@ -132,10 +132,8 @@
 
     /**
      * Creates a new PlaybackStateEvent.
-     *
-     * @hide
      */
-    public PlaybackStateEvent(
+    private PlaybackStateEvent(
             int state,
             long timeSinceCreatedMillis,
             @NonNull Bundle extras) {
@@ -147,13 +145,16 @@
     /**
      * Gets playback state.
      */
+    @State
     public int getState() {
         return mState;
     }
 
     /**
-     * Gets time since the corresponding playback is created in millisecond.
+     * Gets time since the corresponding playback session is created in millisecond.
      * @return the timestamp since the playback is created, or -1 if unknown.
+     * @see LogSessionId
+     * @see PlaybackSession
      */
     @Override
     @IntRange(from = -1)
@@ -197,8 +198,7 @@
         return 0;
     }
 
-    /** @hide */
-    /* package-private */ PlaybackStateEvent(@NonNull Parcel in) {
+    private PlaybackStateEvent(@NonNull Parcel in) {
         int state = in.readInt();
         long timeSinceCreatedMillis = in.readLong();
         Bundle extras = in.readBundle();
@@ -247,6 +247,7 @@
          * Sets timestamp since the creation in milliseconds.
          * @param value the timestamp since the creation in milliseconds.
          *              -1 indicates the value is unknown.
+         * @see #getTimeSinceCreatedMillis()
          */
         public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
             mTimeSinceCreatedMillis = value;
diff --git a/media/java/android/media/metrics/TrackChangeEvent.java b/media/java/android/media/metrics/TrackChangeEvent.java
index c3670269..65d011c 100644
--- a/media/java/android/media/metrics/TrackChangeEvent.java
+++ b/media/java/android/media/metrics/TrackChangeEvent.java
@@ -184,8 +184,11 @@
     }
 
     /**
-     * Gets timestamp since the creation in milliseconds.
+     * Gets timestamp since the creation of the log session in milliseconds.
      * @return the timestamp since the creation in milliseconds, or -1 if unknown.
+     * @see LogSessionId
+     * @see PlaybackSession
+     * @see RecordingSession
      */
     @Override
     @IntRange(from = -1)
@@ -193,6 +196,11 @@
         return mTimeSinceCreatedMillis;
     }
 
+    /**
+     * Gets the track type.
+     * <p>The track type must be one of {@link #TRACK_TYPE_AUDIO}, {@link #TRACK_TYPE_VIDEO},
+     * {@link #TRACK_TYPE_TEXT}.
+     */
     @TrackType
     public int getTrackType() {
         return mType;
@@ -302,8 +310,7 @@
         return 0;
     }
 
-    /** @hide */
-    /* package-private */ TrackChangeEvent(@NonNull Parcel in) {
+    private TrackChangeEvent(@NonNull Parcel in) {
         int flg = in.readInt();
         int state = in.readInt();
         int reason = in.readInt();
@@ -429,8 +436,14 @@
 
         /**
          * Creates a new Builder.
+         * @param type the track type. It must be one of {@link #TRACK_TYPE_AUDIO},
+         *             {@link #TRACK_TYPE_VIDEO}, {@link #TRACK_TYPE_TEXT}.
          */
-        public Builder(int type) {
+        public Builder(@TrackType int type) {
+            if (type != TRACK_TYPE_AUDIO && type != TRACK_TYPE_VIDEO && type != TRACK_TYPE_TEXT) {
+                throw new IllegalArgumentException("track type must be one of TRACK_TYPE_AUDIO, "
+                    + "TRACK_TYPE_VIDEO, TRACK_TYPE_TEXT.");
+            }
             mType = type;
         }
 
@@ -499,6 +512,7 @@
          * Sets timestamp since the creation in milliseconds.
          * @param value the timestamp since the creation in milliseconds.
          *              -1 indicates the value is unknown.
+         * @see #getTimeSinceCreatedMillis()
          */
         public @NonNull Builder setTimeSinceCreatedMillis(@IntRange(from = -1) long value) {
             checkNotUsed();
diff --git a/media/java/android/media/session/ParcelableListBinder.java b/media/java/android/media/session/ParcelableListBinder.java
index a7aacf2..bbf1e08 100644
--- a/media/java/android/media/session/ParcelableListBinder.java
+++ b/media/java/android/media/session/ParcelableListBinder.java
@@ -109,7 +109,7 @@
             throws RemoteException {
         int count = list.size();
         int i = 0;
-        while (i < count) {
+        do {
             Parcel data = Parcel.obtain();
             Parcel reply = Parcel.obtain();
             if (i == 0) {
@@ -126,6 +126,6 @@
             binder.transact(FIRST_CALL_TRANSACTION, data, reply, 0);
             reply.recycle();
             data.recycle();
-        }
+        } while (i < count);
     }
 }
diff --git a/media/jni/android_media_tv_Tuner.cpp b/media/jni/android_media_tv_Tuner.cpp
index 0aae940..4bdbe36 100644
--- a/media/jni/android_media_tv_Tuner.cpp
+++ b/media/jni/android_media_tv_Tuner.cpp
@@ -3029,7 +3029,8 @@
     }
 }
 
-static FrontendSettingsExt1_1 getFrontendSettingsExt1_1(JNIEnv *env, int type, jobject settings) {
+static FrontendSettingsExt1_1 getFrontendSettingsExt1_1(
+        JNIEnv *env, int type, jobject settings, int tunerVersion) {
     ALOGD("getFrontendSettingsExt1_1 %d", type);
 
     FrontendSettingsExt1_1 settingsExt1_1 {
@@ -3038,6 +3039,10 @@
     };
     settingsExt1_1.settingExt.noinit();
 
+    if (tunerVersion < TUNER_VERSION_1_1) {
+        return settingsExt1_1;
+    }
+
     if (type == static_cast<int>(::android::hardware::tv::tuner::V1_1::FrontendType::DTMB)) {
         getDtmbFrontendSettings(env, settings, settingsExt1_1);
     } else {
@@ -3220,7 +3225,8 @@
 static int android_media_tv_Tuner_tune(JNIEnv *env, jobject thiz, jint type, jobject settings) {
     sp<JTuner> tuner = getTuner(env, thiz);
     FrontendSettings setting = getFrontendSettings(env, type, settings);
-    FrontendSettingsExt1_1 settingExt = getFrontendSettingsExt1_1(env, type, settings);
+    FrontendSettingsExt1_1 settingExt = getFrontendSettingsExt1_1(
+            env, type, settings, tuner->getTunerVersion());
     return tuner->tune(setting, settingExt);
 }
 
@@ -3233,7 +3239,8 @@
         JNIEnv *env, jobject thiz, jint settingsType, jobject settings, jint scanType) {
     sp<JTuner> tuner = getTuner(env, thiz);
     FrontendSettings setting = getFrontendSettings(env, settingsType, settings);
-    FrontendSettingsExt1_1 settingExt = getFrontendSettingsExt1_1(env, settingsType, settings);
+    FrontendSettingsExt1_1 settingExt = getFrontendSettingsExt1_1(
+            env, settingsType, settings, tuner->getTunerVersion());
     return tuner->scan(setting, static_cast<FrontendScanType>(scanType), settingExt);
 }
 
diff --git a/media/jni/android_media_tv_Tuner.h b/media/jni/android_media_tv_Tuner.h
index fafef42..2a933b2 100644
--- a/media/jni/android_media_tv_Tuner.h
+++ b/media/jni/android_media_tv_Tuner.h
@@ -73,6 +73,8 @@
 
 using MQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
 
+const static int TUNER_VERSION_1_1 = ((1 << 16) | 1);
+
 namespace android {
 
 struct LnbClientCallbackImpl : public LnbClientCallback {
diff --git a/media/jni/tuner/FilterClient.cpp b/media/jni/tuner/FilterClient.cpp
index c080701..dc1d8b7 100644
--- a/media/jni/tuner/FilterClient.cpp
+++ b/media/jni/tuner/FilterClient.cpp
@@ -596,11 +596,11 @@
             sectionBits.mask.resize(hidlSectionBits.mask.size());
             sectionBits.mode.resize(hidlSectionBits.mode.size());
             copy(hidlSectionBits.filter.begin(), hidlSectionBits.filter.end(),
-                    hidlSectionBits.filter.begin());
+                    sectionBits.filter.begin());
             copy(hidlSectionBits.mask.begin(), hidlSectionBits.mask.end(),
-                    hidlSectionBits.mask.begin());
+                    sectionBits.mask.begin());
             copy(hidlSectionBits.mode.begin(), hidlSectionBits.mode.end(),
-                    hidlSectionBits.mode.begin());
+                    sectionBits.mode.begin());
             aidlSection.condition.set<TunerFilterSectionCondition::sectionBits>(sectionBits);
             break;
         }
diff --git a/packages/Connectivity/framework/api/module-lib-current.txt b/packages/Connectivity/framework/api/module-lib-current.txt
index 9e2cd3e..c8b04a3 100644
--- a/packages/Connectivity/framework/api/module-lib-current.txt
+++ b/packages/Connectivity/framework/api/module-lib-current.txt
@@ -7,7 +7,7 @@
 
   public class ConnectivityManager {
     method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void factoryReset();
-    method @NonNull @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public java.util.List<android.net.NetworkStateSnapshot> getAllNetworkStateSnapshot();
+    method @NonNull @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public java.util.List<android.net.NetworkStateSnapshot> getAllNetworkStateSnapshots();
     method @Nullable public android.net.ProxyInfo getGlobalProxy();
     method @NonNull public static android.util.Range<java.lang.Integer> getIpSecNetIdRange();
     method @NonNull public static String getPrivateDnsMode(@NonNull android.content.Context);
diff --git a/packages/Connectivity/framework/src/android/net/ConnectivityManager.java b/packages/Connectivity/framework/src/android/net/ConnectivityManager.java
index 96f2de6..b3c1997 100644
--- a/packages/Connectivity/framework/src/android/net/ConnectivityManager.java
+++ b/packages/Connectivity/framework/src/android/net/ConnectivityManager.java
@@ -1425,9 +1425,9 @@
             android.Manifest.permission.NETWORK_STACK,
             android.Manifest.permission.NETWORK_SETTINGS})
     @NonNull
-    public List<NetworkStateSnapshot> getAllNetworkStateSnapshot() {
+    public List<NetworkStateSnapshot> getAllNetworkStateSnapshots() {
         try {
-            return mService.getAllNetworkStateSnapshot();
+            return mService.getAllNetworkStateSnapshots();
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
diff --git a/packages/Connectivity/framework/src/android/net/IConnectivityManager.aidl b/packages/Connectivity/framework/src/android/net/IConnectivityManager.aidl
index 728f375..c434bbc 100644
--- a/packages/Connectivity/framework/src/android/net/IConnectivityManager.aidl
+++ b/packages/Connectivity/framework/src/android/net/IConnectivityManager.aidl
@@ -82,7 +82,7 @@
     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
     NetworkState[] getAllNetworkState();
 
-    List<NetworkStateSnapshot> getAllNetworkStateSnapshot();
+    List<NetworkStateSnapshot> getAllNetworkStateSnapshots();
 
     boolean isActiveNetworkMetered();
 
diff --git a/packages/SettingsLib/UsageProgressBarPreference/res/layout/preference_usage_progress_bar.xml b/packages/SettingsLib/UsageProgressBarPreference/res/layout/preference_usage_progress_bar.xml
index 31b3fe5..d2c6fa2 100644
--- a/packages/SettingsLib/UsageProgressBarPreference/res/layout/preference_usage_progress_bar.xml
+++ b/packages/SettingsLib/UsageProgressBarPreference/res/layout/preference_usage_progress_bar.xml
@@ -24,29 +24,27 @@
     android:orientation="vertical"
     android:layout_marginStart="16dp"
     android:layout_marginEnd="16dp"
-    android:paddingTop="32dp"
-    android:paddingBottom="32dp">
+    android:paddingTop="16dp"
+    android:paddingBottom="16dp">
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
         <TextView
             android:id="@+id/usage_summary"
-            android:layout_width="0dp"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            app:layout_constraintWidth_percent="0.45"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintBaseline_toBaselineOf="@id/total_summary"
             android:ellipsize="marquee"
-            android:fontFamily="@*android:string/config_headlineFontFamily"
-            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
             android:textSize="14sp"
             android:textAlignment="viewStart"/>
         <TextView
             android:id="@+id/total_summary"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
-            app:layout_constraintWidth_percent="0.45"
+            app:layout_constraintStart_toEndOf="@id/usage_summary"
             app:layout_constraintEnd_toStartOf="@id/custom_content"
             android:ellipsize="marquee"
             android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
@@ -54,12 +52,11 @@
             android:textAlignment="viewEnd"/>
         <FrameLayout
             android:id="@+id/custom_content"
-            android:layout_width="0dp"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:visibility="gone"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintBottom_toBottomOf="@id/total_summary"
-            app:layout_constraintWidth_percent="0.1"/>
+            app:layout_constraintBottom_toBottomOf="@id/total_summary"/>
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <ProgressBar
@@ -67,8 +64,7 @@
         style="?android:attr/progressBarStyleHorizontal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:scaleY="2"
-        android:layout_marginTop="4dp"
+        android:scaleY="4"
         android:max="100"/>
 
     <TextView
diff --git a/packages/SettingsLib/UsageProgressBarPreference/src/com/android/settingslib/widget/UsageProgressBarPreference.java b/packages/SettingsLib/UsageProgressBarPreference/src/com/android/settingslib/widget/UsageProgressBarPreference.java
index a2b1de2..fbf325c 100644
--- a/packages/SettingsLib/UsageProgressBarPreference/src/com/android/settingslib/widget/UsageProgressBarPreference.java
+++ b/packages/SettingsLib/UsageProgressBarPreference/src/com/android/settingslib/widget/UsageProgressBarPreference.java
@@ -20,7 +20,7 @@
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.TextUtils;
-import android.text.style.RelativeSizeSpan;
+import android.text.style.AbsoluteSizeSpan;
 import android.util.AttributeSet;
 import android.view.View;
 import android.widget.FrameLayout;
@@ -192,7 +192,7 @@
         final Matcher matcher = mNumberPattern.matcher(summary);
         if (matcher.find()) {
             final SpannableString spannableSummary =  new SpannableString(summary);
-            spannableSummary.setSpan(new RelativeSizeSpan(2.4f), matcher.start(),
+            spannableSummary.setSpan(new AbsoluteSizeSpan(64, true /* dip */), matcher.start(),
                     matcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
             return spannableSummary;
         }
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index f685d88..0c47cf8 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -162,6 +162,7 @@
     <uses-permission android:name="android.permission.READ_INPUT_STATE" />
     <uses-permission android:name="android.permission.SET_ORIENTATION" />
     <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
+    <uses-permission android:name="com.android.permission.USE_INSTALLER_V2" />
     <uses-permission android:name="com.android.permission.USE_SYSTEM_DATA_LOADERS" />
     <uses-permission android:name="android.permission.MOVE_PACKAGE" />
     <uses-permission android:name="android.permission.KEEP_UNINSTALLED_PACKAGES" />
@@ -544,6 +545,9 @@
     <!-- Permission required for CTS test - CtsUwbTestCases -->
     <uses-permission android:name="android.permission.UWB_PRIVILEGED" />
 
+    <!-- Permission required for CTS test - CtsAlarmManagerTestCases -->
+    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
+
     <application android:label="@string/app_label"
                 android:theme="@android:style/Theme.DeviceDefault.DayNight"
                 android:defaultToDeviceProtectedStorage="true"
diff --git a/packages/Shell/TEST_MAPPING b/packages/Shell/TEST_MAPPING
index a149b5c..9bb1b4b 100644
--- a/packages/Shell/TEST_MAPPING
+++ b/packages/Shell/TEST_MAPPING
@@ -18,6 +18,20 @@
           "exclude-annotation": "androidx.test.filters.FlakyTest"
         }
       ]
+    },
+    {
+      "name": "CtsUiAutomationTestCases",
+      "options": [
+        {
+          "include-filter": "android.app.uiautomation.cts.UiAutomationTest#testAdoptAllShellPermissions"
+        },
+        {
+          "include-filter": "android.app.uiautomation.cts.UiAutomationTest#testAdoptSomeShellPermissions"
+        },
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
     }
   ],
   "postsubmit": [
diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml
index 0fef9f1..72b027a 100644
--- a/packages/SystemUI/res-keyguard/values/styles.xml
+++ b/packages/SystemUI/res-keyguard/values/styles.xml
@@ -17,7 +17,7 @@
 */
 -->
 
-<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+<resources>
     <!-- Keyguard PIN pad styles -->
     <style name="Keyguard.TextView" parent="@android:style/Widget.DeviceDefault.TextView">
         <item name="android:textSize">@dimen/kg_status_line_font_size</item>
@@ -32,7 +32,9 @@
         <item name="android:stateListAnimator">@null</item>
     </style>
     <style name="NumPadKey" parent="Theme.SystemUI">
-      <item name="android:colorControlNormal">?androidprv:attr/colorSurface</item>
+      <!-- Studio can't directly reference ?androidprv:attr/colorSurface here, so this value
+           is resolved in {@link NumPadAnimator}. -->
+      <item name="android:colorControlNormal">@null</item>
       <item name="android:colorControlHighlight">?android:attr/colorAccent</item>
       <item name="android:background">@drawable/num_pad_key_background</item>
     </style>
diff --git a/packages/SystemUI/res/layout/media_output_list_item.xml b/packages/SystemUI/res/layout/media_output_list_item.xml
index c98c3a0..b563633 100644
--- a/packages/SystemUI/res/layout/media_output_list_item.xml
+++ b/packages/SystemUI/res/layout/media_output_list_item.xml
@@ -28,7 +28,7 @@
         <FrameLayout
             android:layout_width="36dp"
             android:layout_height="36dp"
-            android:layout_gravity="center_vertical"
+            android:layout_gravity="center_vertical|start"
             android:layout_marginStart="16dp">
             <ImageView
                 android:id="@+id/title_icon"
@@ -41,7 +41,7 @@
             android:id="@+id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
+            android:layout_gravity="center_vertical|start"
             android:layout_marginStart="68dp"
             android:ellipsize="end"
             android:maxLines="1"
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
index 570854e..abdd770 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
@@ -29,6 +29,7 @@
 
 import com.android.systemui.R;
 import com.android.systemui.animation.Interpolators;
+import com.android.systemui.util.Utils;
 
 /**
  * Provides background color and radius animations for key pad buttons.
@@ -100,7 +101,8 @@
 
         ContextThemeWrapper ctw = new ContextThemeWrapper(context, mStyle);
         TypedArray a = ctw.obtainStyledAttributes(customAttrs);
-        mNormalColor = a.getColor(0, 0);
+        mNormalColor = Utils.getPrivateAttrColorIfUnset(ctw, a, 0, 0,
+                com.android.internal.R.attr.colorSurface);
         mHighlightColor = a.getColor(1, 0);
         a.recycle();
 
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java b/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
index 6a012eb..6f70672 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
@@ -42,6 +42,7 @@
     public static final int QS_COLLAPSE = 12;
     public static final int UDFPS_AUTHENTICATION = 13;
     public static final int DISABLED_UDFPS_AFFORDANCE = 14;
+    public static final int QS_SWIPE = 15;
 
     @IntDef({
             QUICK_SETTINGS,
@@ -59,7 +60,8 @@
             QS_COLLAPSE,
             BRIGHTNESS_SLIDER,
             UDFPS_AUTHENTICATION,
-            DISABLED_UDFPS_AFFORDANCE
+            DISABLED_UDFPS_AFFORDANCE,
+            QS_SWIPE
     })
     @Retention(RetentionPolicy.SOURCE)
     public @interface InteractionType {}
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/DistanceClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/DistanceClassifier.java
index a4e1637..2298010 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/DistanceClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/DistanceClassifier.java
@@ -155,7 +155,8 @@
                 || interactionType == SHADE_DRAG
                 || interactionType == QS_COLLAPSE
                 || interactionType == Classifier.UDFPS_AUTHENTICATION
-                || interactionType == Classifier.DISABLED_UDFPS_AFFORDANCE) {
+                || interactionType == Classifier.DISABLED_UDFPS_AFFORDANCE
+                || interactionType == Classifier.QS_SWIPE) {
             return Result.passed(0);
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
index 3bc24c7..72d4303 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
@@ -19,6 +19,7 @@
 import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_PROXIMITY_PERCENT_COVERED_THRESHOLD;
 import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
 import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
+import static com.android.systemui.classifier.Classifier.QS_SWIPE;
 import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
 
 import android.provider.DeviceConfig;
@@ -118,7 +119,7 @@
             @Classifier.InteractionType int interactionType,
             double historyBelief, double historyConfidence) {
         if (interactionType == QUICK_SETTINGS || interactionType == BRIGHTNESS_SLIDER
-                || interactionType == QS_COLLAPSE) {
+                || interactionType == QS_COLLAPSE || interactionType == QS_SWIPE) {
             return Result.passed(0);
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/TypeClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/TypeClassifier.java
index 1042516..c2ad7e6 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/TypeClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/TypeClassifier.java
@@ -24,6 +24,7 @@
 import static com.android.systemui.classifier.Classifier.NOTIFICATION_DRAG_DOWN;
 import static com.android.systemui.classifier.Classifier.PULSE_EXPAND;
 import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
+import static com.android.systemui.classifier.Classifier.QS_SWIPE;
 import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
 import static com.android.systemui.classifier.Classifier.RIGHT_AFFORDANCE;
 import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
@@ -85,6 +86,9 @@
             case QS_COLLAPSE:
                 wrongDirection = !vertical || !up;
                 break;
+            case QS_SWIPE:
+                wrongDirection = vertical;
+                break;
             default:
                 wrongDirection = true;
                 break;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
index de00d50..2e03d9a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
@@ -17,10 +17,20 @@
 package com.android.systemui.keyguard;
 
 import android.annotation.IntDef;
+import android.app.IWallpaperManager;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Point;
+import android.os.Bundle;
 import android.os.PowerManager;
+import android.os.RemoteException;
 import android.os.Trace;
+import android.util.DisplayMetrics;
+
+import androidx.annotation.Nullable;
 
 import com.android.systemui.Dumpable;
+import com.android.systemui.R;
 import com.android.systemui.dagger.SysUISingleton;
 
 import java.io.FileDescriptor;
@@ -31,7 +41,7 @@
 import javax.inject.Inject;
 
 /**
- * Tracks the wakefulness lifecycle.
+ * Tracks the wakefulness lifecycle, including why we're waking or sleeping.
  */
 @SysUISingleton
 public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observer> implements
@@ -51,13 +61,32 @@
     public static final int WAKEFULNESS_AWAKE = 2;
     public static final int WAKEFULNESS_GOING_TO_SLEEP = 3;
 
+    private final Context mContext;
+    private final DisplayMetrics mDisplayMetrics;
+
+    @Nullable
+    private final IWallpaperManager mWallpaperManagerService;
+
     private int mWakefulness = WAKEFULNESS_ASLEEP;
+
     private @PowerManager.WakeReason int mLastWakeReason = PowerManager.WAKE_REASON_UNKNOWN;
+
+    @Nullable
+    private Point mLastWakeOriginLocation = null;
+
     private @PowerManager.GoToSleepReason int mLastSleepReason =
             PowerManager.GO_TO_SLEEP_REASON_MIN;
 
+    @Nullable
+    private Point mLastSleepOriginLocation = null;
+
     @Inject
-    public WakefulnessLifecycle() {
+    public WakefulnessLifecycle(
+            Context context,
+            @Nullable IWallpaperManager wallpaperManagerService) {
+        mContext = context;
+        mDisplayMetrics = context.getResources().getDisplayMetrics();
+        mWallpaperManagerService = wallpaperManagerService;
     }
 
     public @Wakefulness int getWakefulness() {
@@ -85,6 +114,17 @@
         }
         setWakefulness(WAKEFULNESS_WAKING);
         mLastWakeReason = pmWakeReason;
+        updateLastWakeOriginLocation();
+
+        if (mWallpaperManagerService != null) {
+            try {
+                mWallpaperManagerService.notifyWakingUp(
+                        mLastWakeOriginLocation.x, mLastWakeOriginLocation.y, new Bundle());
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+        }
+
         dispatch(Observer::onStartedWakingUp);
     }
 
@@ -102,6 +142,17 @@
         }
         setWakefulness(WAKEFULNESS_GOING_TO_SLEEP);
         mLastSleepReason = pmSleepReason;
+        updateLastSleepOriginLocation();
+
+        if (mWallpaperManagerService != null) {
+            try {
+                mWallpaperManagerService.notifyGoingToSleep(
+                        mLastSleepOriginLocation.x, mLastSleepOriginLocation.y, new Bundle());
+            } catch (RemoteException e) {
+                e.printStackTrace();
+            }
+        }
+
         dispatch(Observer::onStartedGoingToSleep);
     }
 
@@ -124,6 +175,60 @@
         Trace.traceCounter(Trace.TRACE_TAG_APP, "wakefulness", wakefulness);
     }
 
+    private void updateLastWakeOriginLocation() {
+        mLastWakeOriginLocation = null;
+
+        switch (mLastWakeReason) {
+            case PowerManager.WAKE_REASON_POWER_BUTTON:
+                mLastWakeOriginLocation = getPowerButtonOrigin();
+                break;
+            default:
+                mLastWakeOriginLocation = getDefaultWakeSleepOrigin();
+                break;
+        }
+    }
+
+    private void updateLastSleepOriginLocation() {
+        mLastSleepOriginLocation = null;
+
+        switch (mLastSleepReason) {
+            case PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON:
+                mLastSleepOriginLocation = getPowerButtonOrigin();
+                break;
+            default:
+                mLastSleepOriginLocation = getDefaultWakeSleepOrigin();
+                break;
+        }
+    }
+
+    /**
+     * Returns the point on the screen closest to the physical power button.
+     */
+    private Point getPowerButtonOrigin() {
+        final boolean isPortrait = mContext.getResources().getConfiguration().orientation
+                == Configuration.ORIENTATION_PORTRAIT;
+
+        if (isPortrait) {
+            return new Point(
+                    mDisplayMetrics.widthPixels,
+                    mContext.getResources().getDimensionPixelSize(
+                            R.dimen.physical_power_button_center_screen_location_y));
+        } else {
+            return new Point(
+                    mContext.getResources().getDimensionPixelSize(
+                            R.dimen.physical_power_button_center_screen_location_y),
+                    mDisplayMetrics.heightPixels);
+        }
+    }
+
+    /**
+     * Returns the point on the screen used as the default origin for wake/sleep events. This is the
+     * middle-bottom of the screen.
+     */
+    private Point getDefaultWakeSleepOrigin() {
+        return new Point(mDisplayMetrics.widthPixels / 2, mDisplayMetrics.heightPixels);
+    }
+
     public interface Observer {
         default void onStartedWakingUp() {}
         default void onFinishedWakingUp() {}
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java b/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java
index 59329d1..41957bc 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java
@@ -93,7 +93,7 @@
                 : Dependency.get(NotificationEntryManager.class);
 
         RemoteViews view = PeopleSpaceUtils.getPreview(getContext(), mPeopleManager, mLauncherApps,
-                mNotificationEntryManager, shortcutId, userHandle, packageName);
+                mNotificationEntryManager, shortcutId, userHandle, packageName, extras);
         if (view == null) {
             if (DEBUG) Log.d(TAG, "No preview available for shortcutId: " + shortcutId);
             return null;
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index a160379..c0a16e1 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -529,7 +529,7 @@
      */
     public static RemoteViews getPreview(Context context, IPeopleManager peopleManager,
             LauncherApps launcherApps, NotificationEntryManager notificationEntryManager,
-            String shortcutId, UserHandle userHandle, String packageName) {
+            String shortcutId, UserHandle userHandle, String packageName, Bundle options) {
         peopleManager = (peopleManager != null) ? peopleManager : IPeopleManager.Stub.asInterface(
                 ServiceManager.getService(Context.PEOPLE_SERVICE));
         launcherApps = (launcherApps != null) ? launcherApps
@@ -556,8 +556,7 @@
                 context, tile, notificationEntryManager);
 
         if (DEBUG) Log.i(TAG, "Returning tile preview for shortcutId: " + shortcutId);
-        Bundle bundle = new Bundle();
-        return new PeopleTileViewHelper(context, augmentedTile, 0, bundle).getViews();
+        return new PeopleTileViewHelper(context, augmentedTile, 0, options).getViews();
     }
 
     /** Returns the userId associated with a {@link PeopleSpaceTile} */
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
index 6cb7c31..fb0dcc2 100644
--- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
+++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
@@ -777,12 +777,12 @@
      * Builds a request to pin a People Tile app widget, with a preview and storing necessary
      * information as the callback.
      */
-    public boolean requestPinAppWidget(ShortcutInfo shortcutInfo) {
+    public boolean requestPinAppWidget(ShortcutInfo shortcutInfo, Bundle options) {
         if (DEBUG) Log.d(TAG, "Requesting pin widget, shortcutId: " + shortcutInfo.getId());
 
         RemoteViews widgetPreview = PeopleSpaceUtils.getPreview(mContext, mIPeopleManager,
                 mLauncherApps, mNotificationEntryManager, shortcutInfo.getId(),
-                shortcutInfo.getUserHandle(), shortcutInfo.getPackage());
+                shortcutInfo.getUserHandle(), shortcutInfo.getPackage(), options);
         if (widgetPreview == null) {
             Log.w(TAG, "Skipping pinning widget: no tile for shortcutId: " + shortcutInfo.getId());
             return false;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
index 5b6b5df..93ccfc72 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java
@@ -16,12 +16,14 @@
 
 package com.android.systemui.qs;
 
+import static com.android.systemui.classifier.Classifier.QS_SWIPE;
 import static com.android.systemui.media.dagger.MediaModule.QS_PANEL;
 import static com.android.systemui.qs.QSPanel.QS_SHOW_BRIGHTNESS;
 import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_MEDIA_PLAYER;
 
 import android.annotation.NonNull;
 import android.content.res.Configuration;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 
@@ -31,6 +33,7 @@
 import com.android.systemui.dump.DumpManager;
 import com.android.systemui.media.MediaHierarchyManager;
 import com.android.systemui.media.MediaHost;
+import com.android.systemui.plugins.FalsingManager;
 import com.android.systemui.plugins.qs.DetailAdapter;
 import com.android.systemui.plugins.qs.QSTile;
 import com.android.systemui.qs.customize.QSCustomizerController;
@@ -58,6 +61,7 @@
     private final TunerService mTunerService;
     private final QSCustomizerController mQsCustomizerController;
     private final QSTileRevealController.Factory mQsTileRevealControllerFactory;
+    private final FalsingManager mFalsingManager;
     private final BrightnessController mBrightnessController;
     private final BrightnessSlider.Factory mBrightnessSliderFactory;
     private final BrightnessSlider mBrightnessSlider;
@@ -81,6 +85,16 @@
     private final BrightnessMirrorController.BrightnessMirrorListener mBrightnessMirrorListener =
             mirror -> updateBrightnessMirror();
 
+    private View.OnTouchListener mTileLayoutTouchListener = new View.OnTouchListener() {
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            if (event.getActionMasked() == MotionEvent.ACTION_UP) {
+                mFalsingManager.isFalseTouch(QS_SWIPE);
+            }
+            return false;
+        }
+    };
+
     @Inject
     QSPanelController(QSPanel view, QSSecurityFooter qsSecurityFooter, TunerService tunerService,
             QSTileHost qstileHost, QSCustomizerController qsCustomizerController,
@@ -89,7 +103,7 @@
             QSTileRevealController.Factory qsTileRevealControllerFactory,
             DumpManager dumpManager, MetricsLogger metricsLogger, UiEventLogger uiEventLogger,
             QSLogger qsLogger, BrightnessController.Factory brightnessControllerFactory,
-            BrightnessSlider.Factory brightnessSliderFactory,
+            BrightnessSlider.Factory brightnessSliderFactory, FalsingManager falsingManager,
             FeatureFlags featureFlags) {
         super(view, qstileHost, qsCustomizerController, usingMediaPlayer, mediaHost,
                 metricsLogger, uiEventLogger, qsLogger, dumpManager, featureFlags);
@@ -97,6 +111,7 @@
         mTunerService = tunerService;
         mQsCustomizerController = qsCustomizerController;
         mQsTileRevealControllerFactory = qsTileRevealControllerFactory;
+        mFalsingManager = falsingManager;
         mQsSecurityFooter.setHostEnvironment(qstileHost);
         mBrightnessSliderFactory = brightnessSliderFactory;
 
@@ -133,6 +148,9 @@
         if (mBrightnessMirrorController != null) {
             mBrightnessMirrorController.addCallback(mBrightnessMirrorListener);
         }
+
+        ((PagedTileLayout) mView.createRegularTileLayout())
+                .setOnTouchListener(mTileLayoutTouchListener);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 3f06312..7123e49 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -235,6 +235,12 @@
                 public void onAnimationStarted() {
                     mIconContainer.removeIgnoredSlot(mMobileSlotName);
                 }
+
+                @Override
+                public void onAnimationAtStart() {
+                    super.onAnimationAtStart();
+                    mIconContainer.removeIgnoredSlot(mMobileSlotName);
+                }
             });
         }
         mAlphaAnimator = builder.build();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
index 20383fe..fad7480 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
@@ -24,6 +24,7 @@
 import com.android.systemui.dagger.SysUISingleton;
 import com.android.systemui.dagger.qualifiers.Main;
 import com.android.systemui.media.MediaDataManager;
+import com.android.systemui.plugins.ActivityStarter;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.statusbar.ActionClickLogger;
 import com.android.systemui.statusbar.CommandQueue;
@@ -237,9 +238,11 @@
     static OngoingCallController provideOngoingCallController(
             CommonNotifCollection notifCollection,
             FeatureFlags featureFlags,
-            SystemClock systemClock) {
+            SystemClock systemClock,
+            ActivityStarter activityStarter) {
         OngoingCallController ongoingCallController =
-                new OngoingCallController(notifCollection, featureFlags, systemClock);
+                new OngoingCallController(
+                        notifCollection, featureFlags, systemClock, activityStarter);
         ongoingCallController.init();
         return ongoingCallController;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
index fa6f23d..3434f67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
@@ -44,6 +44,7 @@
 import android.content.pm.ShortcutManager;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
 import android.os.UserHandle;
@@ -181,7 +182,7 @@
             showPriorityOnboarding();
         } else if (mSelectedAction == ACTION_FAVORITE && getPriority() != mSelectedAction) {
             mShadeController.animateCollapsePanels();
-            mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo);
+            mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
         }
         mGutsContainer.closeControls(v, true);
     };
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt
index 9bbe616..270721f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt
@@ -28,6 +28,7 @@
 import android.graphics.drawable.ColorDrawable
 import android.graphics.drawable.Drawable
 import android.graphics.drawable.GradientDrawable
+import android.os.Bundle
 import android.text.SpannableStringBuilder
 import android.text.style.BulletSpan
 import android.view.Gravity
@@ -86,7 +87,7 @@
         Prefs.putBoolean(context, Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S, true)
         dialog.dismiss()
         shadeController.animateCollapsePanels()
-        peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo)
+        peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo, Bundle())
     }
 
     private fun settings() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
index 4e57e44..1eccfd8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
@@ -162,6 +162,7 @@
         Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
         mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
         mClockView = mStatusBar.findViewById(R.id.clock);
+        mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip);
         showSystemIconArea(false);
         showClock(false);
         initEmergencyCryptkeeperText();
@@ -182,7 +183,7 @@
         super.onResume();
         mCommandQueue.addCallback(this);
         mStatusBarStateController.addCallback(this);
-        mOngoingCallController.addCallback(mOngoingCallListener);
+        initOngoingCallChip();
     }
 
     @Override
@@ -221,8 +222,6 @@
         }
         statusBarCenteredIconArea.addView(mCenteredIconArea);
 
-        initOngoingCallChip();
-
         // Default to showing until we know otherwise.
         showNotificationIconArea(false);
     }
@@ -273,7 +272,7 @@
             state |= DISABLE_CLOCK;
         }
 
-        if (mOngoingCallController.getHasOngoingCall()) {
+        if (mOngoingCallController.hasOngoingCall()) {
             state |= DISABLE_NOTIFICATION_ICONS;
         }
 
@@ -448,7 +447,7 @@
     }
 
     private void initOngoingCallChip() {
-        mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip);
+        mOngoingCallController.addCallback(mOngoingCallListener);
         mOngoingCallController.setChipView(mOngoingCallChip);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
index b55db6f..96473c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
@@ -18,11 +18,14 @@
 
 import android.app.Notification
 import android.app.Notification.CallStyle.CALL_TYPE_ONGOING
+import android.content.Intent
 import android.util.Log
 import android.view.ViewGroup
 import android.widget.Chronometer
 import com.android.systemui.R
+import com.android.systemui.animation.ActivityLaunchAnimator
 import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.plugins.ActivityStarter
 import com.android.systemui.statusbar.FeatureFlags
 import com.android.systemui.statusbar.notification.collection.NotificationEntry
 import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
@@ -38,11 +41,12 @@
 class OngoingCallController @Inject constructor(
     private val notifCollection: CommonNotifCollection,
     private val featureFlags: FeatureFlags,
-    private val systemClock: SystemClock
+    private val systemClock: SystemClock,
+    private val activityStarter: ActivityStarter
 ) : CallbackController<OngoingCallListener> {
 
-    var hasOngoingCall = false
-        private set
+    /** Null if there's no ongoing call. */
+    private var ongoingCallInfo: OngoingCallInfo? = null
     private var chipView: ViewGroup? = null
 
     private val mListeners: MutableList<OngoingCallListener> = mutableListOf()
@@ -50,25 +54,16 @@
     private val notifListener = object : NotifCollectionListener {
         override fun onEntryUpdated(entry: NotificationEntry) {
             if (isOngoingCallNotification(entry)) {
-                val timeView = chipView?.findViewById<Chronometer>(R.id.ongoing_call_chip_time)
-                if (timeView != null) {
-                    hasOngoingCall = true
-                    val callStartTime = entry.sbn.notification.`when`
-                    timeView.base = callStartTime -
-                            System.currentTimeMillis() +
-                            systemClock.elapsedRealtime()
-                    timeView.start()
-                    mListeners.forEach { l -> l.onOngoingCallStarted(animate = true) }
-                } else if (DEBUG) {
-                    Log.w(TAG, "Ongoing call chip view could not be found; " +
-                            "Not displaying chip in status bar")
-                }
+                ongoingCallInfo = OngoingCallInfo(
+                entry.sbn.notification.`when`,
+                        entry.sbn.notification.contentIntent.intent)
+                updateChip()
             }
         }
 
         override fun onEntryRemoved(entry: NotificationEntry, reason: Int) {
             if (isOngoingCallNotification(entry)) {
-                hasOngoingCall = false
+                ongoingCallInfo = null
                 mListeners.forEach { l -> l.onOngoingCallEnded(animate = true) }
             }
         }
@@ -80,10 +75,23 @@
         }
     }
 
-    fun setChipView(chipView: ViewGroup?) {
+    /**
+     * Sets the chip view that will contain ongoing call information.
+     *
+     * Should only be called from [CollapedStatusBarFragment].
+     */
+    fun setChipView(chipView: ViewGroup) {
         this.chipView = chipView
+        if (hasOngoingCall()) {
+            updateChip()
+        }
     }
 
+    /**
+     * Returns true if there's an active ongoing call that can be displayed in a status bar chip.
+     */
+    fun hasOngoingCall(): Boolean = ongoingCallInfo != null
+
     override fun addCallback(listener: OngoingCallListener) {
         synchronized(mListeners) {
             if (!mListeners.contains(listener)) {
@@ -97,6 +105,43 @@
             mListeners.remove(listener)
         }
     }
+
+    private fun updateChip() {
+        val currentOngoingCallInfo = ongoingCallInfo ?: return
+
+        val currentChipView = chipView
+        val timeView =
+                currentChipView?.findViewById<Chronometer>(R.id.ongoing_call_chip_time)
+
+        if (currentChipView != null && timeView != null) {
+            timeView.base = currentOngoingCallInfo.callStartTime -
+                    System.currentTimeMillis() +
+                    systemClock.elapsedRealtime()
+            timeView.start()
+
+            currentChipView.setOnClickListener {
+                activityStarter.postStartActivityDismissingKeyguard(
+                        currentOngoingCallInfo.intent, 0,
+                        ActivityLaunchAnimator.Controller.fromView(it))
+            }
+
+            mListeners.forEach { l -> l.onOngoingCallStarted(animate = true) }
+        } else {
+            // If we failed to update the chip, don't store the ongoing call info. Then
+            // [hasOngoingCall] will return false and we fall back to typical notification handling.
+            ongoingCallInfo = null
+
+            if (DEBUG) {
+                Log.w(TAG, "Ongoing call chip view could not be found; " +
+                        "Not displaying chip in status bar")
+            }
+        }
+    }
+
+    private class OngoingCallInfo(
+        val callStartTime: Long,
+        val intent: Intent
+    )
 }
 
 private fun isOngoingCallNotification(entry: NotificationEntry): Boolean {
diff --git a/packages/SystemUI/src/com/android/systemui/util/Utils.java b/packages/SystemUI/src/com/android/systemui/util/Utils.java
index fd3641c..f3a95f7 100644
--- a/packages/SystemUI/src/com/android/systemui/util/Utils.java
+++ b/packages/SystemUI/src/com/android/systemui/util/Utils.java
@@ -21,8 +21,10 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
+import android.content.res.TypedArray;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.view.ContextThemeWrapper;
 import android.view.View;
 
 import com.android.systemui.R;
@@ -177,4 +179,23 @@
                 && resources.getBoolean(R.bool.config_use_split_notification_shade);
     }
 
+    /**
+     * Returns the color provided at the specified {@param attrIndex} in {@param a} if it exists,
+     * otherwise, returns the color from the private attribute {@param privAttrId}.
+     */
+    public static int getPrivateAttrColorIfUnset(ContextThemeWrapper ctw, TypedArray a,
+            int attrIndex, int defColor, int privAttrId) {
+        // If the index is specified, use that value
+        if (a.hasValue(attrIndex)) {
+            return a.getColor(attrIndex, defColor);
+        }
+
+        // Otherwise fallback to the value of the private attribute
+        int[] customAttrs = { privAttrId };
+        a = ctw.obtainStyledAttributes(customAttrs);
+        int color = a.getColor(0, defColor);
+        a.recycle();
+        return color;
+    }
+
 }
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
index 3fc3d89..f96d344 100644
--- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
+++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
@@ -381,8 +381,8 @@
     @WMSingleton
     @Provides
     static StartingWindowController provideStartingWindowController(Context context,
-            @ShellSplashscreenThread ShellExecutor executor, TransactionPool pool) {
-        return new StartingWindowController(context, executor, pool);
+            @ShellSplashscreenThread ShellExecutor splashScreenExecutor, TransactionPool pool) {
+        return new StartingWindowController(context, splashScreenExecutor, pool);
     }
 
     //
diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/DistanceClassifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/DistanceClassifierTest.java
index c912419..8e00d10 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/classifier/DistanceClassifierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/DistanceClassifierTest.java
@@ -17,6 +17,7 @@
 package com.android.systemui.classifier;
 
 import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
+import static com.android.systemui.classifier.Classifier.QS_SWIPE;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -103,4 +104,11 @@
         assertThat(mClassifier.classifyGesture(BRIGHTNESS_SLIDER, 0.5, 1).isFalse())
                 .isFalse();
     }
+
+    @Test
+    public void testPass_QsSwipeAlwaysPasses() {
+        mClassifier.onTouchEvent(appendDownEvent(1, 1));
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 1).isFalse())
+                .isFalse();
+    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/TypeClassifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/TypeClassifierTest.java
index 32537b4..1d61e29 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/classifier/TypeClassifierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/TypeClassifierTest.java
@@ -22,6 +22,7 @@
 import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS;
 import static com.android.systemui.classifier.Classifier.NOTIFICATION_DRAG_DOWN;
 import static com.android.systemui.classifier.Classifier.PULSE_EXPAND;
+import static com.android.systemui.classifier.Classifier.QS_SWIPE;
 import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
 import static com.android.systemui.classifier.Classifier.RIGHT_AFFORDANCE;
 import static com.android.systemui.classifier.Classifier.UNLOCK;
@@ -320,4 +321,46 @@
         when(mDataProvider.isRight()).thenReturn(true);
         assertThat(mClassifier.classifyGesture(BRIGHTNESS_SLIDER, 0.5, 0).isFalse()).isTrue();
     }
+
+    @Test
+    public void testPass_QsSwipe() {
+        when(mDataProvider.isVertical()).thenReturn(false);
+
+        when(mDataProvider.isUp()).thenReturn(false);  // up and right should cause no effect.
+        when(mDataProvider.isRight()).thenReturn(false);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isFalse();
+
+        when(mDataProvider.isUp()).thenReturn(true);
+        when(mDataProvider.isRight()).thenReturn(false);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isFalse();
+
+        when(mDataProvider.isUp()).thenReturn(false);
+        when(mDataProvider.isRight()).thenReturn(true);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isFalse();
+
+        when(mDataProvider.isUp()).thenReturn(true);
+        when(mDataProvider.isRight()).thenReturn(true);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isFalse();
+    }
+
+    @Test
+    public void testFalse_QsSwipe() {
+        when(mDataProvider.isVertical()).thenReturn(true);
+
+        when(mDataProvider.isUp()).thenReturn(false);  // up and right should cause no effect.
+        when(mDataProvider.isRight()).thenReturn(false);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isTrue();
+
+        when(mDataProvider.isUp()).thenReturn(true);
+        when(mDataProvider.isRight()).thenReturn(false);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isTrue();
+
+        when(mDataProvider.isUp()).thenReturn(false);
+        when(mDataProvider.isRight()).thenReturn(true);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isTrue();
+
+        when(mDataProvider.isUp()).thenReturn(true);
+        when(mDataProvider.isRight()).thenReturn(true);
+        assertThat(mClassifier.classifyGesture(QS_SWIPE, 0.5, 0).isFalse()).isTrue();
+    }
 }
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 42e88b0..63ce98a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
@@ -22,6 +22,7 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
+import android.app.IWallpaperManager;
 import android.os.PowerManager;
 import android.testing.AndroidTestingRunner;
 
@@ -43,9 +44,12 @@
     private WakefulnessLifecycle mWakefulness;
     private WakefulnessLifecycle.Observer mWakefulnessObserver;
 
+    private IWallpaperManager mWallpaperManager;
+
     @Before
     public void setUp() throws Exception {
-        mWakefulness = new WakefulnessLifecycle();
+        mWallpaperManager = mock(IWallpaperManager.class);
+        mWakefulness = new WakefulnessLifecycle(mContext, mWallpaperManager);
         mWakefulnessObserver = mock(WakefulnessLifecycle.Observer.class);
         mWakefulness.addObserver(mWakefulnessObserver);
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
index e9be8d8..1ab5d34 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
@@ -1143,7 +1143,7 @@
         when(mAppWidgetManager.requestPinAppWidget(any(), any(), any())).thenReturn(true);
 
         ShortcutInfo info = new ShortcutInfo.Builder(mMockContext, SHORTCUT_ID).build();
-        boolean valid = mManager.requestPinAppWidget(info);
+        boolean valid = mManager.requestPinAppWidget(info, new Bundle());
 
         assertThat(valid).isTrue();
         verify(mAppWidgetManager, times(1)).requestPinAppWidget(
@@ -1157,7 +1157,7 @@
         when(mIPeopleManager.getConversation(PACKAGE_NAME, 0, SHORTCUT_ID)).thenReturn(null);
 
         ShortcutInfo info = new ShortcutInfo.Builder(mMockContext, SHORTCUT_ID).build();
-        boolean valid = mManager.requestPinAppWidget(info);
+        boolean valid = mManager.requestPinAppWidget(info, new Bundle());
 
         assertThat(valid).isFalse();
         verify(mAppWidgetManager, never()).requestPinAppWidget(any(), any(), any());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.java
index bacc493..53eae8c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.java
@@ -32,6 +32,7 @@
 import com.android.internal.logging.UiEventLogger;
 import com.android.internal.logging.testing.UiEventLoggerFake;
 import com.android.systemui.SysuiTestCase;
+import com.android.systemui.classifier.FalsingManagerFake;
 import com.android.systemui.dump.DumpManager;
 import com.android.systemui.media.MediaHost;
 import com.android.systemui.plugins.qs.QSTileView;
@@ -94,6 +95,7 @@
     QSTileView mQSTileView;
     @Mock
     PagedTileLayout mPagedTileLayout;
+    FalsingManagerFake mFalsingManager = new FalsingManagerFake();
     @Mock
     FeatureFlags mFeatureFlags;
 
@@ -121,7 +123,7 @@
                 mQSTileHost, mQSCustomizerController, true, mMediaHost,
                 mQSTileRevealControllerFactory, mDumpManager, mMetricsLogger, mUiEventLogger,
                 mQSLogger, mBrightnessControllerFactory, mToggleSliderViewControllerFactory,
-                mFeatureFlags
+                mFalsingManager, mFeatureFlags
         );
 
         mController.init();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
index 12e341a5..5d29f52 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
@@ -31,7 +31,6 @@
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
-import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.anyString;
@@ -239,7 +238,7 @@
 
         when(mBuilder.build()).thenReturn(mock(PriorityOnboardingDialogController.class));
 
-        when(mPeopleSpaceWidgetManager.requestPinAppWidget(any())).thenReturn(true);
+        when(mPeopleSpaceWidgetManager.requestPinAppWidget(any(), any())).thenReturn(true);
     }
 
     @Test
@@ -1289,7 +1288,7 @@
         mNotificationInfo.findViewById(R.id.done).performClick();
 
         // THEN the user is presented with the People Tile pinning request
-        verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any());
+        verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any(), any());
     }
 
     @Test
@@ -1325,7 +1324,7 @@
         mNotificationInfo.findViewById(R.id.done).performClick();
 
         // THEN the user is not presented with the People Tile pinning request
-        verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(mShortcutInfo);
+        verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(eq(mShortcutInfo), any());
     }
 
     @Test
@@ -1364,6 +1363,6 @@
         mNotificationInfo.findViewById(R.id.done).performClick();
 
         // THEN the user is not presented with the People Tile pinning request
-        verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(mShortcutInfo);
+        verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(eq(mShortcutInfo), any());
     }
 }
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 929a7e1..0e3e0cc 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
@@ -184,7 +184,7 @@
         Mockito.verify(mOngoingCallController).addCallback(ongoingCallListenerCaptor.capture());
         OngoingCallListener listener = Objects.requireNonNull(ongoingCallListenerCaptor.getValue());
 
-        when(mOngoingCallController.getHasOngoingCall()).thenReturn(true);
+        when(mOngoingCallController.hasOngoingCall()).thenReturn(true);
         listener.onOngoingCallStarted(/* animate= */ false);
 
         assertEquals(View.VISIBLE,
@@ -205,7 +205,7 @@
         Mockito.verify(mOngoingCallController).addCallback(ongoingCallListenerCaptor.capture());
         OngoingCallListener listener = Objects.requireNonNull(ongoingCallListenerCaptor.getValue());
 
-        when(mOngoingCallController.getHasOngoingCall()).thenReturn(false);
+        when(mOngoingCallController.hasOngoingCall()).thenReturn(false);
         listener.onOngoingCallEnded(/* animate= */ false);
 
         assertEquals(View.GONE,
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 3989dfa..11f96c8 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
@@ -38,6 +38,7 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.app.IWallpaperManager;
 import android.app.Notification;
 import android.app.StatusBarManager;
 import android.app.trust.TrustManager;
@@ -269,6 +270,7 @@
     @Mock private PrivacyDotViewController mDotViewController;
     @Mock private TunerService mTunerService;
     @Mock private FeatureFlags mFeatureFlags;
+    @Mock private IWallpaperManager mWallpaperManager;
     private ShadeController mShadeController;
     private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
     private InitController mInitController = new InitController();
@@ -327,7 +329,8 @@
 
         when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
 
-        WakefulnessLifecycle wakefulnessLifecycle = new WakefulnessLifecycle();
+        WakefulnessLifecycle wakefulnessLifecycle =
+                new WakefulnessLifecycle(mContext, mWallpaperManager);
         wakefulnessLifecycle.dispatchStartedWakingUp(PowerManager.WAKE_REASON_UNKNOWN);
         wakefulnessLifecycle.dispatchFinishedWakingUp();
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt
index d87d1d1..c244290 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt
@@ -19,14 +19,16 @@
 import android.app.Notification
 import android.app.PendingIntent
 import android.app.Person
+import android.content.Intent
 import android.service.notification.NotificationListenerService.REASON_USER_STOPPED
-import androidx.test.filters.SmallTest
 import android.testing.AndroidTestingRunner
 import android.testing.TestableLooper
 import android.view.LayoutInflater
 import android.widget.LinearLayout
+import androidx.test.filters.SmallTest
 import com.android.systemui.R
 import com.android.systemui.SysuiTestCase
+import com.android.systemui.plugins.ActivityStarter
 import com.android.systemui.statusbar.FeatureFlags
 import com.android.systemui.statusbar.notification.collection.NotificationEntry
 import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder
@@ -43,6 +45,7 @@
 import org.mockito.Mockito.mock
 import org.mockito.Mockito.verify
 import org.mockito.Mockito.never
+import org.mockito.Mockito.times
 import org.mockito.Mockito.`when`
 import org.mockito.MockitoAnnotations
 
@@ -55,6 +58,7 @@
     private lateinit var notifCollectionListener: NotifCollectionListener
 
     @Mock private lateinit var mockOngoingCallListener: OngoingCallListener
+    @Mock private lateinit var mockActivityStarter: ActivityStarter
 
     private lateinit var chipView: LinearLayout
 
@@ -71,7 +75,8 @@
         `when`(featureFlags.isOngoingCallStatusBarChipEnabled).thenReturn(true)
         val notificationCollection = mock(CommonNotifCollection::class.java)
 
-        controller = OngoingCallController(notificationCollection, featureFlags, FakeSystemClock())
+        controller = OngoingCallController(
+                notificationCollection, featureFlags, FakeSystemClock(), mockActivityStarter)
         controller.init()
         controller.addCallback(mockOngoingCallListener)
         controller.setChipView(chipView)
@@ -111,22 +116,24 @@
 
     @Test
     fun hasOngoingCall_noOngoingCallNotifSent_returnsFalse() {
-        assertThat(controller.hasOngoingCall).isFalse()
+        assertThat(controller.hasOngoingCall()).isFalse()
     }
 
     @Test
     fun hasOngoingCall_ongoingCallNotifSentAndChipViewSet_returnsTrue() {
         notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry())
 
-        assertThat(controller.hasOngoingCall).isTrue()
+        assertThat(controller.hasOngoingCall()).isTrue()
     }
 
     @Test
-    fun hasOngoingCall_ongoingCallNotifSentButNoChipView_returnsFalse() {
-        controller.setChipView(null)
+    fun hasOngoingCall_ongoingCallNotifSentButInvalidChipView_returnsFalse() {
+        val invalidChipView = LinearLayout(context)
+        controller.setChipView(invalidChipView)
+
         notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry())
 
-        assertThat(controller.hasOngoingCall).isFalse()
+        assertThat(controller.hasOngoingCall()).isFalse()
     }
 
     @Test
@@ -136,12 +143,42 @@
         notifCollectionListener.onEntryUpdated(ongoingCallNotifEntry)
         notifCollectionListener.onEntryRemoved(ongoingCallNotifEntry, REASON_USER_STOPPED)
 
-        assertThat(controller.hasOngoingCall).isFalse()
+        assertThat(controller.hasOngoingCall()).isFalse()
+    }
+
+    /**
+     * This test fakes a theme change during an ongoing call.
+     *
+     * When a theme change happens, [CollapsedStatusBarFragment] and its views get re-created, so
+     * [OngoingCallController.setChipView] gets called with a new view. If there's an active ongoing
+     * call when the theme changes, the new view needs to be updated with the call information.
+     */
+    @Test
+    fun setChipView_whenHasOngoingCallIsTrue_listenerNotifiedWithNewView() {
+        // Start an ongoing call.
+        notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry())
+
+        lateinit var newChipView: LinearLayout
+        TestableLooper.get(this).runWithLooper {
+            newChipView = LayoutInflater.from(mContext)
+                    .inflate(R.layout.ongoing_call_chip, null) as LinearLayout
+        }
+
+        // Change the chip view associated with the controller.
+        controller.setChipView(newChipView)
+
+        // Verify the listener was notified once for the initial call and again when the new view
+        // was set.
+        verify(mockOngoingCallListener, times(2)).onOngoingCallStarted(anyBoolean())
     }
 
     private fun createOngoingCallNotifEntry(): NotificationEntry {
         val notificationEntryBuilder = NotificationEntryBuilder()
         notificationEntryBuilder.modifyNotification(context).style = ongoingCallStyle
+
+        val contentIntent = mock(PendingIntent::class.java)
+        `when`(contentIntent.intent).thenReturn(mock(Intent::class.java))
+        notificationEntryBuilder.modifyNotification(context).setContentIntent(contentIntent)
         return notificationEntryBuilder.build()
     }
 
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index e251700..d922d2b 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -1589,6 +1589,7 @@
     public ParceledListSlice<AppWidgetProviderInfo> getInstalledProvidersForProfile(int categoryFilter,
             int profileId, String packageName) {
         final int userId = UserHandle.getCallingUserId();
+        final int callingUid = Binder.getCallingUid();
 
         if (DEBUG) {
             Slog.i(TAG, "getInstalledProvidersForProfiles() " + userId);
@@ -1601,7 +1602,7 @@
 
         synchronized (mLock) {
             if (mSecurityPolicy.isCallerInstantAppLocked()) {
-                Slog.w(TAG, "Instant uid " + Binder.getCallingUid()
+                Slog.w(TAG, "Instant uid " + callingUid
                         + " cannot access widget providers");
                 return ParceledListSlice.emptyList();
             }
@@ -1614,11 +1615,12 @@
             for (int i = 0; i < providerCount; i++) {
                 Provider provider = mProviders.get(i);
                 AppWidgetProviderInfo info = provider.getInfoLocked(mContext);
+                final String providerPackageName = provider.id.componentName.getPackageName();
 
                 // Ignore an invalid provider, one not matching the filter,
                 // or one that isn't in the given package, if any.
                 boolean inPackage = packageName == null
-                        || provider.id.componentName.getPackageName().equals(packageName);
+                        || providerPackageName.equals(packageName);
                 if (provider.zombie || (info.widgetCategory & categoryFilter) == 0 || !inPackage) {
                     continue;
                 }
@@ -1627,7 +1629,9 @@
                 final int providerProfileId = info.getProfile().getIdentifier();
                 if (providerProfileId == profileId
                         && mSecurityPolicy.isProviderInCallerOrInProfileAndWhitelListed(
-                            provider.id.componentName.getPackageName(), providerProfileId)) {
+                        providerPackageName, providerProfileId)
+                        && !mPackageManagerInternal.filterAppAccess(providerPackageName, callingUid,
+                        userId)) {
                     result.add(cloneIfLocalBinder(info));
                 }
             }
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index f8b770b..6bf4967 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -1311,7 +1311,9 @@
     @Override
     public void onServiceDied(@NonNull RemoteFillService service) {
         Slog.w(TAG, "removing session because service died");
-        forceRemoveFromServiceLocked();
+        synchronized (mLock) {
+            forceRemoveFromServiceLocked();
+        }
     }
 
     // AutoFillUiCallback
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 5cbcacf..5dc11c5 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -132,7 +132,6 @@
     ],
 
     static_libs: [
-        "protolog-lib",
         "time_zone_distro",
         "time_zone_distro_installer",
         "android.hardware.authsecret-V1.0-java",
diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java
index a9eb2c1..5dd9b0e 100644
--- a/services/core/java/android/content/pm/PackageManagerInternal.java
+++ b/services/core/java/android/content/pm/PackageManagerInternal.java
@@ -825,6 +825,12 @@
             String packageName, int userId);
 
     /**
+     * Return the enabled setting for a package component (activity, receiver, service, provider).
+     */
+    public abstract @PackageManager.EnabledState int getComponentEnabledSetting(
+            @NonNull ComponentName componentName, int callingUid, int userId);
+
+    /**
      * Extra field name for the token of a request to enable rollback for a
      * package.
      */
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index feed220..c3a5d1f 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -714,9 +714,6 @@
             Slog.w(TAG, "Callback is null in unregisterAdapter");
             return;
         }
-        if (!checkConnectPermissionForPreflight(mContext)) {
-            return;
-        }
         synchronized (mCallbacks) {
             mCallbacks.unregister(callback);
         }
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 16e6671..809ef41 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2149,7 +2149,7 @@
         PermissionUtils.enforceNetworkStackPermission(mContext);
 
         final ArrayList<NetworkState> result = new ArrayList<>();
-        for (NetworkStateSnapshot snapshot : getAllNetworkStateSnapshot()) {
+        for (NetworkStateSnapshot snapshot : getAllNetworkStateSnapshots()) {
             // NetworkStateSnapshot doesn't contain NetworkInfo, so need to fetch it from the
             // NetworkAgentInfo.
             final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(snapshot.network);
@@ -2164,7 +2164,7 @@
 
     @Override
     @NonNull
-    public List<NetworkStateSnapshot> getAllNetworkStateSnapshot() {
+    public List<NetworkStateSnapshot> getAllNetworkStateSnapshots() {
         // This contains IMSI details, so make sure the caller is privileged.
         PermissionUtils.enforceNetworkStackPermission(mContext);
 
@@ -2810,6 +2810,8 @@
     @Override
     protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter writer,
             @Nullable String[] args) {
+        if (!checkDumpPermission(mContext, TAG, writer)) return;
+
         mPriorityDumper.dump(fd, writer, args);
     }
 
@@ -2827,7 +2829,6 @@
 
     private void doDump(FileDescriptor fd, PrintWriter writer, String[] args) {
         final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
-        if (!checkDumpPermission(mContext, TAG, pw)) return;
 
         if (CollectionUtils.contains(args, DIAG_ARG)) {
             dumpNetworkDiagnostics(pw);
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 2d486c4..ee3530a 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -2861,7 +2861,14 @@
         intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId);
         intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId);
         intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, phoneId);
+        // Send the broadcast twice -- once for all apps with READ_PHONE_STATE, then again
+        // for all apps with READ_PRIV but not READ_PHONE_STATE. This ensures that any app holding
+        // either READ_PRIV or READ_PHONE get this broadcast exactly once.
         mContext.sendBroadcastAsUser(intent, UserHandle.ALL, Manifest.permission.READ_PHONE_STATE);
+        mContext.createContextAsUser(UserHandle.ALL, 0)
+                .sendBroadcastMultiplePermissions(intent,
+                        new String[] { Manifest.permission.READ_PRIVILEGED_PHONE_STATE },
+                        new String[] { Manifest.permission.READ_PHONE_STATE });
     }
 
     private void broadcastSignalStrengthChanged(SignalStrength signalStrength, int phoneId,
@@ -2988,7 +2995,14 @@
                 getApnTypesStringFromBitmask(pdcs.getApnSetting().getApnTypeBitmask()));
         intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, slotIndex);
         intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId);
+        // Send the broadcast twice -- once for all apps with READ_PHONE_STATE, then again
+        // for all apps with READ_PRIV but not READ_PHONE_STATE. This ensures that any app holding
+        // either READ_PRIV or READ_PHONE get this broadcast exactly once.
         mContext.sendBroadcastAsUser(intent, UserHandle.ALL, Manifest.permission.READ_PHONE_STATE);
+        mContext.createContextAsUser(UserHandle.ALL, 0)
+                .sendBroadcastMultiplePermissions(intent,
+                        new String[] { Manifest.permission.READ_PRIVILEGED_PHONE_STATE },
+                        new String[] { Manifest.permission.READ_PHONE_STATE });
     }
 
     /**
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
index 3678b19..6114094 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
@@ -222,7 +222,6 @@
         super.disableDevice(initiatedByCec, callback);
         assertRunOnServiceThread();
         mService.unregisterTvInputCallback(mTvInputCallback);
-        // TODO(b/129088603): check disableDevice and onStandby behaviors per spec
     }
 
     @Override
@@ -847,7 +846,6 @@
     }
 
     protected void switchToAudioInput() {
-        // TODO(b/111396634): switch input according to PROPERTY_SYSTEM_AUDIO_MODE_AUDIO_PORT
     }
 
     protected boolean isDirectConnectToTv() {
diff --git a/services/core/java/com/android/server/location/provider/LocationProviderManager.java b/services/core/java/com/android/server/location/provider/LocationProviderManager.java
index 102263b..8a2dfa8 100644
--- a/services/core/java/com/android/server/location/provider/LocationProviderManager.java
+++ b/services/core/java/com/android/server/location/provider/LocationProviderManager.java
@@ -25,12 +25,12 @@
 import static android.location.LocationManager.KEY_PROVIDER_ENABLED;
 import static android.location.LocationManager.PASSIVE_PROVIDER;
 import static android.os.IPowerManager.LOCATION_MODE_NO_CHANGE;
+import static android.os.PowerExemptionManager.REASON_LOCATION_PROVIDER;
+import static android.os.PowerExemptionManager.TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
 import static android.os.PowerManager.LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF;
 import static android.os.PowerManager.LOCATION_MODE_FOREGROUND_ONLY;
 import static android.os.PowerManager.LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF;
 import static android.os.PowerManager.LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF;
-import static android.os.PowerWhitelistManager.REASON_LOCATION_PROVIDER;
-import static android.os.PowerWhitelistManager.TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
 
 import static com.android.server.location.LocationManagerService.D;
 import static com.android.server.location.LocationManagerService.TAG;
@@ -148,10 +148,10 @@
     private static final long MAX_HIGH_POWER_INTERVAL_MS = 5 * 60 * 1000;
 
     // max age of a location before it is no longer considered "current"
-    private static final long MAX_CURRENT_LOCATION_AGE_MS = 10 * 1000;
+    private static final long MAX_CURRENT_LOCATION_AGE_MS = 30 * 1000;
 
     // max timeout allowed for getting the current location
-    private static final long GET_CURRENT_LOCATION_MAX_TIMEOUT_MS = 30 * 1000;
+    private static final long MAX_GET_CURRENT_LOCATION_TIMEOUT_MS = 30 * 1000;
 
     // max jitter allowed for min update interval as a percentage of the interval
     private static final float FASTEST_INTERVAL_JITTER_PERCENTAGE = .10f;
@@ -230,7 +230,7 @@
             options.setDontSendToRestrictedApps(true);
             // allows apps to start a fg service in response to a location PI
             options.setTemporaryAppAllowlist(TEMPORARY_APP_ALLOWLIST_DURATION_MS,
-                    TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
+                    TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                     REASON_LOCATION_PROVIDER,
                     "");
 
@@ -1655,9 +1655,9 @@
 
     public @Nullable ICancellationSignal getCurrentLocation(LocationRequest request,
             CallerIdentity identity, int permissionLevel, ILocationCallback callback) {
-        if (request.getDurationMillis() > GET_CURRENT_LOCATION_MAX_TIMEOUT_MS) {
+        if (request.getDurationMillis() > MAX_GET_CURRENT_LOCATION_TIMEOUT_MS) {
             request = new LocationRequest.Builder(request)
-                    .setDurationMillis(GET_CURRENT_LOCATION_MAX_TIMEOUT_MS)
+                    .setDurationMillis(MAX_GET_CURRENT_LOCATION_TIMEOUT_MS)
                     .build();
         }
 
diff --git a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
index c01523a..90694d0 100644
--- a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
+++ b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
@@ -205,6 +205,7 @@
                 Slog.i(TAG, "Using server based resume on reboot");
                 rebootEscrowProvider = new RebootEscrowProviderServerBasedImpl(mContext, mStorage);
             } else {
+                Slog.i(TAG, "Using HAL based resume on reboot");
                 rebootEscrowProvider = new RebootEscrowProviderHalImpl();
             }
 
@@ -239,7 +240,7 @@
             return mKeyStoreManager;
         }
 
-        public RebootEscrowProviderInterface getRebootEscrowProvider() {
+        public RebootEscrowProviderInterface createRebootEscrowProviderIfNeeded() {
             // Initialize for the provider lazily. Because the device_config and service
             // implementation apps may change when system server is running.
             if (mRebootEscrowProvider == null) {
@@ -249,6 +250,14 @@
             return mRebootEscrowProvider;
         }
 
+        public RebootEscrowProviderInterface getRebootEscrowProvider() {
+            return mRebootEscrowProvider;
+        }
+
+        public void clearRebootEscrowProvider() {
+            mRebootEscrowProvider = null;
+        }
+
         public int getBootCount() {
             return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.BOOT_COUNT,
                     0);
@@ -308,8 +317,6 @@
             mStorage.removeRebootEscrow(user.id);
         }
 
-        // Clear the old key in keystore.
-        mKeyStoreManager.clearKeyStoreEncryptionKey();
         onEscrowRestoreComplete(false, attemptCount);
     }
 
@@ -395,9 +402,6 @@
             allUsersUnlocked &= restoreRebootEscrowForUser(user.id, escrowKey, kk);
         }
 
-        // Clear the old key in keystore. A new key will be generated by new RoR requests.
-        mKeyStoreManager.clearKeyStoreEncryptionKey();
-
         if (!allUsersUnlocked && mLoadEscrowDataErrorCode == ERROR_NONE) {
             mLoadEscrowDataErrorCode = ERROR_UNLOCK_ALL_USERS;
         }
@@ -473,11 +477,17 @@
         if (success || (previousBootCount != -1 && bootCountDelta <= BOOT_COUNT_TOLERANCE)) {
             reportMetricOnRestoreComplete(success, attemptCount);
         }
+
+        // Clear the old key in keystore. A new key will be generated by new RoR requests.
+        mKeyStoreManager.clearKeyStoreEncryptionKey();
+        // Clear the saved reboot escrow provider
+        mInjector.clearRebootEscrowProvider();
         clearMetricsStorage();
     }
 
     private RebootEscrowKey getAndClearRebootEscrowKey(SecretKey kk) throws IOException {
-        RebootEscrowProviderInterface rebootEscrowProvider = mInjector.getRebootEscrowProvider();
+        RebootEscrowProviderInterface rebootEscrowProvider =
+                mInjector.createRebootEscrowProviderIfNeeded();
         if (rebootEscrowProvider == null) {
             Slog.w(TAG,
                     "Had reboot escrow data for users, but RebootEscrowProvider is unavailable");
@@ -529,9 +539,8 @@
             return;
         }
 
-        if (mInjector.getRebootEscrowProvider() == null) {
-            Slog.w(TAG,
-                    "Had reboot escrow data for users, but RebootEscrowProvider is unavailable");
+        if (mInjector.createRebootEscrowProviderIfNeeded() == null) {
+            Slog.w(TAG, "Not storing escrow data, RebootEscrowProvider is unavailable");
             return;
         }
 
@@ -586,13 +595,17 @@
         mRebootEscrowWanted = false;
         setRebootEscrowReady(false);
 
-        RebootEscrowProviderInterface rebootEscrowProvider = mInjector.getRebootEscrowProvider();
+        // We want to clear the internal data inside the provider, so always try to create the
+        // provider.
+        RebootEscrowProviderInterface rebootEscrowProvider =
+                mInjector.createRebootEscrowProviderIfNeeded();
         if (rebootEscrowProvider == null) {
             Slog.w(TAG, "RebootEscrowProvider is unavailable for clear request");
         } else {
             rebootEscrowProvider.clearRebootEscrowKey();
         }
 
+        mInjector.clearRebootEscrowProvider();
         clearMetricsStorage();
 
         List<UserInfo> users = mUserManager.getUsers();
@@ -610,8 +623,7 @@
 
         RebootEscrowProviderInterface rebootEscrowProvider = mInjector.getRebootEscrowProvider();
         if (rebootEscrowProvider == null) {
-            Slog.w(TAG,
-                    "Had reboot escrow data for users, but RebootEscrowProvider is unavailable");
+            Slog.w(TAG, "Not storing escrow key, RebootEscrowProvider is unavailable");
             clearRebootEscrowIfNeeded();
             return ARM_REBOOT_ERROR_NO_PROVIDER;
         }
@@ -677,11 +689,12 @@
     }
 
     boolean prepareRebootEscrow() {
-        if (mInjector.getRebootEscrowProvider() == null) {
+        clearRebootEscrowIfNeeded();
+        if (mInjector.createRebootEscrowProviderIfNeeded() == null) {
+            Slog.w(TAG, "No reboot escrow provider, skipping resume on reboot preparation.");
             return false;
         }
 
-        clearRebootEscrowIfNeeded();
         mRebootEscrowWanted = true;
         mEventLog.addEntry(RebootEscrowEvent.REQUESTED_LSKF);
         return true;
@@ -807,6 +820,10 @@
         pw.print("mPendingRebootEscrowKey is ");
         pw.println(keySet ? "set" : "not set");
 
+        RebootEscrowProviderInterface provider = mInjector.getRebootEscrowProvider();
+        String providerType = provider == null ? "null" : String.valueOf(provider.getType());
+        pw.print("RebootEscrowProvider type is " + providerType);
+
         pw.println();
         pw.println("Event log:");
         pw.increaseIndent();
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 05922b3..7e4e29e 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -2016,7 +2016,7 @@
         if (LOGV) Slog.v(TAG, "updateNetworkRulesNL()");
         Trace.traceBegin(TRACE_TAG_NETWORK, "updateNetworkRulesNL");
 
-        final List<NetworkStateSnapshot> snapshots = mConnManager.getAllNetworkStateSnapshot();
+        final List<NetworkStateSnapshot> snapshots = mConnManager.getAllNetworkStateSnapshots();
 
         // First, generate identities of all connected networks so we can
         // quickly compare them against all defined policies below.
diff --git a/services/core/java/com/android/server/net/TEST_MAPPING b/services/core/java/com/android/server/net/TEST_MAPPING
index f707597..02095eb 100644
--- a/services/core/java/com/android/server/net/TEST_MAPPING
+++ b/services/core/java/com/android/server/net/TEST_MAPPING
@@ -1,5 +1,5 @@
 {
-  "presubmit": [
+  "presubmit-large": [
     {
       "name": "CtsHostsideNetworkTests",
       "file_patterns": ["(/|^)NetworkPolicy[^/]*\\.java"],
@@ -14,7 +14,9 @@
           "exclude-annotation": "android.platform.test.annotations.FlakyTest"
         }
       ]
-    },
+    }
+  ],
+  "presubmit": [
     {
       "name": "FrameworksServicesTests",
       "file_patterns": ["(/|^)NetworkPolicy[^/]*\\.java"],
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 1e6e5cb..52a5dc1 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -735,19 +735,22 @@
         final List<UserInfo> activeUsers = mUm.getUsers();
         for (UserInfo userInfo : activeUsers) {
             int userId = userInfo.getUserHandle().getIdentifier();
-            if (isNASMigrationDone(userId)) {
+            if (isNASMigrationDone(userId) || mUm.isManagedProfile(userId)) {
                 continue;
             }
             if (mAssistants.hasUserSet(userId)) {
-                mAssistants.loadDefaultsFromConfig(false);
                 ComponentName defaultFromConfig = mAssistants.getDefaultFromConfig();
                 List<ComponentName> allowedComponents = mAssistants.getAllowedComponents(userId);
-                if (allowedComponents.contains(defaultFromConfig)) {
+                if (allowedComponents.size() == 0) {
+                    setNASMigrationDone(userId);
+                    mAssistants.clearDefaults();
+                    continue;
+                } else if (allowedComponents.contains(defaultFromConfig)) {
                     setNASMigrationDone(userId);
                     mAssistants.resetDefaultFromConfig();
                     continue;
                 }
-                //User selected different NAS or none, need onboarding
+                //User selected different NAS, need onboarding
                 enqueueNotificationInternal(getContext().getPackageName(),
                         getContext().getOpPackageName(), Binder.getCallingUid(),
                         Binder.getCallingPid(), TAG,
@@ -819,9 +822,11 @@
     }
 
     @VisibleForTesting
-    void setNASMigrationDone(int userId) {
-        Settings.Secure.putIntForUser(getContext().getContentResolver(),
-                Settings.Secure.NAS_SETTINGS_UPDATED, 1, userId);
+    void setNASMigrationDone(int baseUserId) {
+        for (int profileId : mUm.getProfileIds(baseUserId, false)) {
+            Settings.Secure.putIntForUser(getContext().getContentResolver(),
+                    Settings.Secure.NAS_SETTINGS_UPDATED, 1, profileId);
+        }
     }
 
     @VisibleForTesting
@@ -5171,12 +5176,7 @@
         @Override
         public ComponentName getDefaultNotificationAssistant() {
             checkCallerIsSystem();
-            ArraySet<ComponentName> defaultComponents = mAssistants.getDefaultComponents();
-            if (defaultComponents.size() > 1) {
-                Slog.w(TAG, "More than one default NotificationAssistant: "
-                        + defaultComponents.size());
-            }
-            return CollectionUtils.firstOrNull(defaultComponents);
+            return mAssistants.getDefaultFromConfig();
         }
 
         @Override
@@ -9403,6 +9403,9 @@
         }
 
         ComponentName getDefaultFromConfig() {
+            if (mDefaultFromConfig == null) {
+                loadDefaultsFromConfig(false);
+            }
             return mDefaultFromConfig;
         }
 
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index dd80e16..edd43af 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -1043,22 +1043,24 @@
                 return false;
             }
 
+            final PackageManagerInternal pmInt =
+                    LocalServices.getService(PackageManagerInternal.class);
             final int callingUid = injectBinderCallingUid();
+            final int state = pmInt.getComponentEnabledSetting(component, callingUid,
+                    user.getIdentifier());
+            switch (state) {
+                case PackageManager.COMPONENT_ENABLED_STATE_DEFAULT:
+                    break; // Need to check the manifest's enabled state.
+                case PackageManager.COMPONENT_ENABLED_STATE_ENABLED:
+                    return true;
+                case PackageManager.COMPONENT_ENABLED_STATE_DISABLED:
+                case PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER:
+                case PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:
+                    return false;
+            }
+
             final long ident = Binder.clearCallingIdentity();
             try {
-                final int state = mIPM.getComponentEnabledSetting(component, user.getIdentifier());
-                switch (state) {
-                    case PackageManager.COMPONENT_ENABLED_STATE_DEFAULT:
-                        break; // Need to check the manifest's enabled state.
-                    case PackageManager.COMPONENT_ENABLED_STATE_ENABLED:
-                        return true;
-                    case PackageManager.COMPONENT_ENABLED_STATE_DISABLED:
-                    case PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER:
-                    case PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:
-                        return false;
-                }
-                final PackageManagerInternal pmInt =
-                        LocalServices.getService(PackageManagerInternal.class);
                 ActivityInfo info = pmInt.getActivityInfo(component,
                         PackageManager.MATCH_DIRECT_BOOT_AWARE
                                 | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 0a484e2..27077b6 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -527,6 +527,14 @@
             throw new SecurityException("User restriction prevents installing");
         }
 
+        if (params.dataLoaderParams != null
+                && mContext.checkCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2)
+                        != PackageManager.PERMISSION_GRANTED) {
+            throw new SecurityException("You need the "
+                    + "com.android.permission.USE_INSTALLER_V2 permission "
+                    + "to use a data loader");
+        }
+
         // INSTALL_REASON_ROLLBACK allows an app to be rolled back without requiring the ROLLBACK
         // capability; ensure if this is set as the install reason the app has one of the necessary
         // signature permissions to perform the rollback.
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java
index e532790..b6a65dd 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerSession.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java
@@ -3636,12 +3636,14 @@
 
     @Override
     public DataLoaderParamsParcel getDataLoaderParams() {
+        mContext.enforceCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2, null);
         return params.dataLoaderParams != null ? params.dataLoaderParams.getData() : null;
     }
 
     @Override
     public void addFile(int location, String name, long lengthBytes, byte[] metadata,
             byte[] signature) {
+        mContext.enforceCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2, null);
         if (!isDataLoaderInstallation()) {
             throw new IllegalStateException(
                     "Cannot add files to non-data loader installation session.");
@@ -3674,6 +3676,7 @@
 
     @Override
     public void removeFile(int location, String name) {
+        mContext.enforceCallingOrSelfPermission(Manifest.permission.USE_INSTALLER_V2, null);
         if (!isDataLoaderInstallation()) {
             throw new IllegalStateException(
                     "Cannot add files to non-data loader installation session.");
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 59039ba..3c4a304 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1495,6 +1495,9 @@
     // List of packages names to keep cached, even if they are uninstalled for all users
     private List<String> mKeepUninstalledPackages;
 
+    // Cached reference to IDevicePolicyManager.
+    private IDevicePolicyManager mDevicePolicyManager = null;
+
     private File mCacheDir;
 
     private Future<?> mPrepareAppDataFuture;
@@ -20807,8 +20810,7 @@
     }
 
     private boolean isPackageDeviceAdmin(String packageName, int userId) {
-        IDevicePolicyManager dpm = IDevicePolicyManager.Stub.asInterface(
-                ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
+        final IDevicePolicyManager dpm = getDevicePolicyManager();
         try {
             if (dpm != null) {
                 final ComponentName deviceOwnerComponentName = dpm.getDeviceOwnerComponent(
@@ -20840,6 +20842,16 @@
         return false;
     }
 
+    /** Returns the device policy manager interface. */
+    private IDevicePolicyManager getDevicePolicyManager() {
+        if (mDevicePolicyManager == null) {
+            // No need to synchronize; worst-case scenario it will be fetched twice.
+            mDevicePolicyManager = IDevicePolicyManager.Stub.asInterface(
+                            ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
+        }
+        return mDevicePolicyManager;
+    }
+
     private boolean shouldKeepUninstalledPackageLPr(String packageName) {
         return mKeepUninstalledPackages != null && mKeepUninstalledPackages.contains(packageName);
     }
@@ -23616,11 +23628,17 @@
 
     @Override
     public int getComponentEnabledSetting(@NonNull ComponentName component, int userId) {
-        if (component == null) return COMPONENT_ENABLED_STATE_DEFAULT;
-        if (!mUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED;
         int callingUid = Binder.getCallingUid();
         enforceCrossUserPermission(callingUid, userId, false /*requireFullPermission*/,
                 false /*checkShell*/, "getComponentEnabled");
+        return getComponentEnabledSettingInternal(component, callingUid, userId);
+    }
+
+    private int getComponentEnabledSettingInternal(ComponentName component, int callingUid,
+            int userId) {
+        if (component == null) return COMPONENT_ENABLED_STATE_DEFAULT;
+        if (!mUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED;
+
         synchronized (mLock) {
             try {
                 if (shouldFilterApplicationLocked(
@@ -27066,6 +27084,13 @@
         }
 
         @Override
+        public @PackageManager.EnabledState int getComponentEnabledSetting(
+                @NonNull ComponentName componentName, int callingUid, int userId) {
+            return PackageManagerService.this.getComponentEnabledSettingInternal(componentName,
+                    callingUid, userId);
+        }
+
+        @Override
         public void setEnableRollbackCode(int token, int enableRollbackCode) {
             PackageManagerService.this.setEnableRollbackCode(token, enableRollbackCode);
         }
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java
index c6d98e7..464477d 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -92,6 +92,7 @@
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 /**
  * Package information used by {@link ShortcutService}.
@@ -721,7 +722,7 @@
 
         // If not reset yet, then reset.
         if (mLastResetTime < last) {
-            if (ShortcutService.DEBUG) {
+            if (ShortcutService.DEBUG || ShortcutService.DEBUG_REBOOT) {
                 Slog.d(TAG, String.format("%s: last reset=%d, now=%d, last=%d: resetting",
                         getPackageName(), mLastResetTime, now, last));
             }
@@ -1101,7 +1102,7 @@
         }
         final int manifestShortcutSize = newManifestShortcutList == null ? 0
                 : newManifestShortcutList.size();
-        if (ShortcutService.DEBUG) {
+        if (ShortcutService.DEBUG || ShortcutService.DEBUG_REBOOT) {
             Slog.d(TAG,
                     String.format("Package %s has %d manifest shortcut(s), and %d share target(s)",
                             getPackageName(), manifestShortcutSize, mShareTargets.size()));
@@ -1113,7 +1114,7 @@
             // disabled.
             return false;
         }
-        if (ShortcutService.DEBUG) {
+        if (ShortcutService.DEBUG || ShortcutService.DEBUG_REBOOT) {
             Slog.d(TAG, String.format("Package %s %s, version %d -> %d", getPackageName(),
                     (isNewApp ? "added" : "updated"),
                     getPackageInfo().getVersionCode(), pi.getLongVersionCode()));
@@ -1202,7 +1203,7 @@
     }
 
     private boolean publishManifestShortcuts(List<ShortcutInfo> newManifestShortcutList) {
-        if (ShortcutService.DEBUG) {
+        if (ShortcutService.DEBUG || ShortcutService.DEBUG_REBOOT) {
             Slog.d(TAG, String.format(
                     "Package %s: publishing manifest shortcuts", getPackageName()));
         }
@@ -1879,7 +1880,7 @@
                 final int depth = parser.getDepth();
 
                 final String tag = parser.getName();
-                if (ShortcutService.DEBUG_LOAD) {
+                if (ShortcutService.DEBUG_LOAD || ShortcutService.DEBUG_REBOOT) {
                     Slog.d(TAG, String.format("depth=%d type=%d name=%s", depth, type, tag));
                 }
                 if ((depth == 1) && TAG_ROOT.equals(tag)) {
@@ -2015,7 +2016,7 @@
             }
             final int depth = parser.getDepth();
             final String tag = parser.getName();
-            if (ShortcutService.DEBUG_LOAD) {
+            if (ShortcutService.DEBUG_LOAD || ShortcutService.DEBUG_REBOOT) {
                 Slog.d(TAG, String.format("  depth=%d type=%d name=%s",
                         depth, type, tag));
             }
@@ -2099,7 +2100,7 @@
             }
             final int depth = parser.getDepth();
             final String tag = parser.getName();
-            if (ShortcutService.DEBUG_LOAD) {
+            if (ShortcutService.DEBUG_LOAD || ShortcutService.DEBUG_REBOOT) {
                 Slog.d(TAG, String.format("  depth=%d type=%d name=%s",
                         depth, type, tag));
             }
@@ -2302,6 +2303,12 @@
             // No need to invoke AppSearch when there's nothing to save.
             return;
         }
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Saving shortcuts for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName() + " ids=["
+                    + shortcuts.stream().map(ShortcutInfo::getId)
+                    .collect(Collectors.joining(",")) + "]");
+        }
         awaitInAppSearch("Saving shortcuts", session -> {
             final AndroidFuture<Boolean> future = new AndroidFuture<>();
             session.put(new PutDocumentsRequest.Builder()
@@ -2374,6 +2381,10 @@
                 shortcutIds.add(id);
             }
         }
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Getting shortcuts for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName() + " ids: [" + String.join(",", ids) + "]");
+        }
         return awaitInAppSearch("Getting shortcut by id", session -> {
             final AndroidFuture<List<ShortcutInfo>> future = new AndroidFuture<>();
             session.getByUri(
@@ -2418,6 +2429,10 @@
 
     private void forEachShortcutMutateIf(@NonNull final String query,
             @NonNull final Function<ShortcutInfo, Boolean> cb) {
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Changing shortcuts for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName());
+        }
         final SearchResults res = awaitInAppSearch("Mutating shortcuts", session ->
                 AndroidFuture.completedFuture(session.search(query, getSearchSpec())));
         if (res == null) return;
@@ -2439,6 +2454,10 @@
 
     private void forEachShortcutStopWhen(
             @NonNull final String query, @NonNull final Function<ShortcutInfo, Boolean> cb) {
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Iterating shortcuts for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName());
+        }
         final SearchResults res = awaitInAppSearch("Iterating shortcuts", session ->
                 AndroidFuture.completedFuture(session.search(query, getSearchSpec())));
         if (res == null) return;
@@ -2452,6 +2471,10 @@
     }
 
     private List<ShortcutInfo> getNextPage(@NonNull final SearchResults res) {
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Get next page for search result for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName());
+        }
         final AndroidFuture<List<ShortcutInfo>> future = new AndroidFuture<>();
         final List<ShortcutInfo> ret = new ArrayList<>();
         final long callingIdentity = Binder.clearCallingIdentity();
@@ -2529,6 +2552,10 @@
     @NonNull
     private AndroidFuture<AppSearchSession> setupSchema(
             @NonNull final AppSearchSession session) {
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "Setup Schema for user=" + mShortcutUser.getUserId()
+                    + " pkg=" + getPackageName());
+        }
         SetSchemaRequest.Builder schemaBuilder = new SetSchemaRequest.Builder()
                 .addSchemas(AppSearchPerson.SCHEMA, AppSearchShortcutInfo.SCHEMA)
                 .setForceOverride(true);
@@ -2569,6 +2596,15 @@
     }
 
     private void restoreParsedShortcuts(final boolean replace) {
+        if (ShortcutService.DEBUG_REBOOT) {
+            if (replace) {
+                Slog.d(TAG, "Replacing all shortcuts with the ones parsed from xml for user="
+                        + mShortcutUser.getUserId() + " pkg=" + getPackageName());
+            } else {
+                Slog.d(TAG, "Restoring pinned shortcuts from xml for user="
+                        + mShortcutUser.getUserId() + " pkg=" + getPackageName());
+            }
+        }
         if (replace) {
             removeShortcuts();
         }
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index dcf730d..8d03fce 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -164,6 +164,7 @@
     static final boolean DEBUG = false; // STOPSHIP if true
     static final boolean DEBUG_LOAD = false; // STOPSHIP if true
     static final boolean DEBUG_PROCSTATE = false; // STOPSHIP if true
+    static final boolean DEBUG_REBOOT = true;
 
     @VisibleForTesting
     static final long DEFAULT_RESET_INTERVAL_SEC = 24 * 60 * 60; // 1 day
@@ -659,7 +660,7 @@
 
     /** lifecycle event */
     void onBootPhase(int phase) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "onBootPhase: " + phase);
         }
         switch (phase) {
@@ -674,7 +675,7 @@
 
     /** lifecycle event */
     void handleUnlockUser(int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "handleUnlockUser: user=" + userId);
         }
         synchronized (mUnlockedUsers) {
@@ -699,7 +700,7 @@
 
     /** lifecycle event */
     void handleStopUser(int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "handleStopUser: user=" + userId);
         }
         synchronized (mLock) {
@@ -713,7 +714,7 @@
 
     @GuardedBy("mLock")
     private void unloadUserLocked(int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "unloadUserLocked: user=" + userId);
         }
         // Save all dirty information.
@@ -945,7 +946,7 @@
     @VisibleForTesting
     void saveBaseStateLocked() {
         final AtomicFile file = getBaseStateFile();
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Saving to " + file.getBaseFile());
         }
 
@@ -978,7 +979,7 @@
         mRawLastResetTime = 0;
 
         final AtomicFile file = getBaseStateFile();
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Loading from " + file.getBaseFile());
         }
         try (FileInputStream in = file.openRead()) {
@@ -1028,7 +1029,7 @@
     @GuardedBy("mLock")
     private void saveUserLocked(@UserIdInt int userId) {
         final File path = getUserFile(userId);
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Saving to " + path);
         }
 
@@ -1086,7 +1087,7 @@
     @Nullable
     private ShortcutUser loadUserLocked(@UserIdInt int userId) {
         final File path = getUserFile(userId);
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Loading from " + path);
         }
         final AtomicFile file = new AtomicFile(path);
@@ -1095,7 +1096,7 @@
         try {
             in = file.openRead();
         } catch (FileNotFoundException e) {
-            if (DEBUG) {
+            if (DEBUG || DEBUG_REBOOT) {
                 Slog.d(TAG, "Not found " + path);
             }
             return null;
@@ -1132,7 +1133,7 @@
             final int depth = parser.getDepth();
 
             final String tag = parser.getName();
-            if (DEBUG_LOAD) {
+            if (DEBUG_LOAD || DEBUG_REBOOT) {
                 Slog.d(TAG, String.format("depth=%d type=%d name=%s",
                         depth, type, tag));
             }
@@ -1157,7 +1158,7 @@
     private final Runnable mSaveDirtyInfoRunner = this::saveDirtyInfo;
 
     private void scheduleSaveInner(@UserIdInt int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Scheduling to save for " + userId);
         }
         synchronized (mLock) {
@@ -1172,7 +1173,7 @@
 
     @VisibleForTesting
     void saveDirtyInfo() {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "saveDirtyInfo");
         }
         if (mShutdown.get()) {
@@ -2942,6 +2943,10 @@
                 @Nullable String packageName, @Nullable List<String> shortcutIds,
                 @Nullable List<LocusId> locusIds, @Nullable ComponentName componentName,
                 int queryFlags, int userId, int callingPid, int callingUid) {
+            if (DEBUG_REBOOT) {
+                Slog.d(TAG, "Getting shortcuts for launcher= " + callingPackage
+                        + "user=" + userId + " pkg=" + packageName);
+            }
             final ArrayList<ShortcutInfo> ret = new ArrayList<>();
 
             int flags = ShortcutInfo.CLONE_REMOVE_FOR_LAUNCHER;
@@ -3639,7 +3644,7 @@
      */
     @VisibleForTesting
     void checkPackageChanges(@UserIdInt int ownerUserId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "checkPackageChanges() ownerUserId=" + ownerUserId);
         }
         if (injectIsSafeModeEnabled()) {
@@ -3685,6 +3690,9 @@
 
     @GuardedBy("mLock")
     private void rescanUpdatedPackagesLocked(@UserIdInt int userId, long lastScanTime) {
+        if (DEBUG_REBOOT) {
+            Slog.d(TAG, "rescan updated package user=" + userId + " last scanned=" + lastScanTime);
+        }
         final ShortcutUser user = getUserShortcutsLocked(userId);
 
         // Note after each OTA, we'll need to rescan all system apps, as their lastUpdateTime
@@ -3708,7 +3716,7 @@
     }
 
     private void handlePackageAdded(String packageName, @UserIdInt int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, String.format("handlePackageAdded: %s user=%d", packageName, userId));
         }
         synchronized (mLock) {
@@ -3720,7 +3728,7 @@
     }
 
     private void handlePackageUpdateFinished(String packageName, @UserIdInt int userId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, String.format("handlePackageUpdateFinished: %s user=%d",
                     packageName, userId));
         }
@@ -3736,7 +3744,7 @@
     }
 
     private void handlePackageRemoved(String packageName, @UserIdInt int packageUserId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, String.format("handlePackageRemoved: %s user=%d", packageName,
                     packageUserId));
         }
@@ -3746,7 +3754,7 @@
     }
 
     private void handlePackageDataCleared(String packageName, int packageUserId) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, String.format("handlePackageDataCleared: %s user=%d", packageName,
                     packageUserId));
         }
@@ -3761,7 +3769,7 @@
             handlePackageRemoved(packageName, packageUserId);
             return;
         }
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, String.format("handlePackageChanged: %s user=%d", packageName,
                     packageUserId));
         }
@@ -3948,7 +3956,7 @@
 
     private void forUpdatedPackages(@UserIdInt int userId, long lastScanTime, boolean afterOta,
             Consumer<ApplicationInfo> callback) {
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "forUpdatedPackages for user " + userId + ", lastScanTime=" + lastScanTime
                     + " afterOta=" + afterOta);
         }
@@ -3960,7 +3968,7 @@
             // Also if it's right after an OTA, always re-scan all apps anyway, since the
             // shortcut parser might have changed.
             if (afterOta || (pi.lastUpdateTime >= lastScanTime)) {
-                if (DEBUG) {
+                if (DEBUG || DEBUG_REBOOT) {
                     Slog.d(TAG, "Found updated package " + pi.packageName
                             + " updateTime=" + pi.lastUpdateTime);
                 }
@@ -4313,7 +4321,7 @@
     @Override
     public void applyRestore(byte[] payload, @UserIdInt int userId) {
         enforceSystem();
-        if (DEBUG) {
+        if (DEBUG || DEBUG_REBOOT) {
             Slog.d(TAG, "Restoring user " + userId);
         }
         synchronized (mLock) {
diff --git a/services/core/java/com/android/server/pm/ShortcutUser.java b/services/core/java/com/android/server/pm/ShortcutUser.java
index 069944d..e66cb03 100644
--- a/services/core/java/com/android/server/pm/ShortcutUser.java
+++ b/services/core/java/com/android/server/pm/ShortcutUser.java
@@ -328,6 +328,10 @@
 
     public void rescanPackageIfNeeded(@NonNull String packageName, boolean forceRescan) {
         final boolean isNewApp = !mPackages.containsKey(packageName);
+        if (ShortcutService.DEBUG_REBOOT) {
+            Slog.d(TAG, "rescanPackageIfNeeded " + getUserId() + "@" + packageName
+                    + ", forceRescan=" + forceRescan + " , isNewApp=" + isNewApp);
+        }
 
         final ShortcutPackage shortcutPackage = getPackageShortcuts(packageName);
 
@@ -397,7 +401,7 @@
         } else {
             // Save each ShortcutPackageItem in a separate Xml file.
             final File path = getShortcutPackageItemFile(spi);
-            if (ShortcutService.DEBUG) {
+            if (ShortcutService.DEBUG || ShortcutService.DEBUG_REBOOT) {
                 Slog.d(TAG, "Saving package item " + spi.getPackageName() + " to " + path);
             }
 
diff --git a/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java b/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
index cd7f685..6f6bdac 100644
--- a/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
+++ b/services/core/java/com/android/server/policy/DeviceStateProviderImpl.java
@@ -394,13 +394,13 @@
                     throw new IllegalStateException("Have not received sensor event.");
                 }
 
-                if (latestEvent.values.length != mExpectedValues.size()) {
+                if (latestEvent.values.length < mExpectedValues.size()) {
                     throw new RuntimeException("Number of supplied numeric range(s) does not "
                             + "match the number of values in the latest sensor event for sensor: "
                             + mSensor);
                 }
 
-                for (int i = 0; i < latestEvent.values.length; i++) {
+                for (int i = 0; i < mExpectedValues.size(); i++) {
                     if (!adheresToRange(latestEvent.values[i], mExpectedValues.get(i))) {
                         return false;
                     }
diff --git a/services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java b/services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java
index 189f47f..35aff8d 100644
--- a/services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java
+++ b/services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java
@@ -21,8 +21,8 @@
 import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED;
 import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT;
 
-import static com.android.server.rotationresolver.RotationResolverManagerService.RESOLUTION_FAILURE;
-import static com.android.server.rotationresolver.RotationResolverManagerService.logRotationStats;
+import static com.android.server.rotationresolver.RotationResolverManagerService.errorCodeToProto;
+import static com.android.server.rotationresolver.RotationResolverManagerService.surfaceRotationToProto;
 
 import android.annotation.NonNull;
 import android.content.ComponentName;
@@ -173,8 +173,10 @@
                     request.mCallbackInternal.onSuccess(rotation);
                     final long timeToCalculate =
                             SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis;
-                    logRotationStats(request.mRemoteRequest.getProposedRotation(),
-                            request.mRemoteRequest.getCurrentRotation(), rotation, timeToCalculate);
+                    RotationResolverManagerService.logRotationStatsWithTimeToCalculate(
+                            request.mRemoteRequest.getProposedRotation(),
+                            request.mRemoteRequest.getCurrentRotation(),
+                            surfaceRotationToProto(rotation), timeToCalculate);
                     Slog.d(TAG, "onSuccess:" + rotation);
                     Slog.d(TAG, "timeToCalculate:" + timeToCalculate);
                 }
@@ -192,8 +194,9 @@
                     request.mCallbackInternal.onFailure(error);
                     final long timeToCalculate =
                             SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis;
-                    logRotationStats(request.mRemoteRequest.getProposedRotation(),
-                            request.mRemoteRequest.getCurrentRotation(), RESOLUTION_FAILURE,
+                    RotationResolverManagerService.logRotationStatsWithTimeToCalculate(
+                            request.mRemoteRequest.getProposedRotation(),
+                            request.mRemoteRequest.getCurrentRotation(), errorCodeToProto(error),
                             timeToCalculate);
                     Slog.d(TAG, "onFailure:" + error);
                     Slog.d(TAG, "timeToCalculate:" + timeToCalculate);
diff --git a/services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java b/services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java
index a749d18..19a246e 100644
--- a/services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java
+++ b/services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java
@@ -18,6 +18,9 @@
 
 import static android.provider.DeviceConfig.NAMESPACE_ROTATION_RESOLVER;
 import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED;
+import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_NOT_SUPPORTED;
+import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_PREEMPTED;
+import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT;
 
 import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0;
 import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_180;
@@ -37,6 +40,7 @@
 import android.provider.DeviceConfig;
 import android.rotationresolver.RotationResolverInternal;
 import android.service.rotationresolver.RotationResolutionRequest;
+import android.service.rotationresolver.RotationResolverService;
 import android.text.TextUtils;
 import android.util.IndentingPrintWriter;
 import android.util.Slog;
@@ -217,24 +221,37 @@
         }
     }
 
-    static void logRotationStats(int proposedRotation, int currentRotation,
-            int resolvedRotation, long timeToCalculate) {
+    static void logRotationStatsWithTimeToCalculate(int proposedRotation, int currentRotation,
+            int result, long timeToCalculate) {
         FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED,
                 /* previous_orientation= */ surfaceRotationToProto(currentRotation),
                 /* proposed_orientation= */ surfaceRotationToProto(proposedRotation),
-                /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation),
+                result,
                 /* process_duration_millis= */ timeToCalculate);
     }
 
     static void logRotationStats(int proposedRotation, int currentRotation,
-            int resolvedRotation) {
+            int result) {
         FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED,
                 /* previous_orientation= */ surfaceRotationToProto(currentRotation),
                 /* proposed_orientation= */ surfaceRotationToProto(proposedRotation),
-                /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation));
+                result);
     }
 
-    private static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) {
+    static int errorCodeToProto(@RotationResolverService.FailureCodes int error) {
+        switch (error) {
+            case ROTATION_RESULT_FAILURE_NOT_SUPPORTED:
+                return RESOLUTION_UNAVAILABLE;
+            case ROTATION_RESULT_FAILURE_TIMED_OUT:
+            case ROTATION_RESULT_FAILURE_PREEMPTED:
+            case ROTATION_RESULT_FAILURE_CANCELLED:
+                return ORIENTATION_UNKNOWN;
+            default:
+                return RESOLUTION_FAILURE;
+        }
+    }
+
+    static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) {
         switch (rotationPoseResult) {
             case Surface.ROTATION_0:
                 return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0;
@@ -245,7 +262,8 @@
             case Surface.ROTATION_270:
                 return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_270;
             default:
-                return ORIENTATION_UNKNOWN;
+                // Should not reach here.
+                return RESOLUTION_FAILURE;
         }
     }
 }
diff --git a/services/core/java/com/android/server/timedetector/EnvironmentImpl.java b/services/core/java/com/android/server/timedetector/EnvironmentImpl.java
index 072cc16f..7649958 100644
--- a/services/core/java/com/android/server/timedetector/EnvironmentImpl.java
+++ b/services/core/java/com/android/server/timedetector/EnvironmentImpl.java
@@ -82,6 +82,9 @@
                         handleAutoTimeDetectionChangedOnHandlerThread();
                     }
                 });
+        mServiceConfigAccessor.addListener(
+                () -> mHandler.post(
+                        EnvironmentImpl.this::handleAutoTimeDetectionChangedOnHandlerThread));
     }
 
     /** Internal method for handling the auto time setting being changed. */
diff --git a/services/core/java/com/android/server/timedetector/ServerFlags.java b/services/core/java/com/android/server/timedetector/ServerFlags.java
index d91e9c2..7145f5e 100644
--- a/services/core/java/com/android/server/timedetector/ServerFlags.java
+++ b/services/core/java/com/android/server/timedetector/ServerFlags.java
@@ -30,7 +30,9 @@
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.time.DateTimeException;
 import java.time.Duration;
+import java.time.Instant;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
@@ -62,6 +64,8 @@
             KEY_LOCATION_TIME_ZONE_DETECTION_UNCERTAINTY_DELAY_MILLIS,
             KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_OVERRIDE,
             KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT,
+            KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE,
+            KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE,
     })
     @Retention(RetentionPolicy.SOURCE)
     @interface DeviceConfigKey {}
@@ -135,6 +139,23 @@
     public static final String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT =
             "location_time_zone_detection_setting_enabled_default";
 
+    /**
+     * The key to override the time detector origin priorities configuration. A comma-separated list
+     * of strings that will be passed to {@link TimeDetectorStrategy#stringToOrigin(String)}.
+     * All values must be recognized or the override value will be ignored.
+     */
+    @DeviceConfigKey
+    public static final String KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE =
+            "time_detector_origin_priorities_override";
+
+    /**
+     * The key to override the time detector lower bound configuration. The values is the number of
+     * milliseconds since the beginning of the Unix epoch.
+     */
+    @DeviceConfigKey
+    public static final String KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE =
+            "time_detector_lower_bound_millis_override";
+
     @GuardedBy("mListeners")
     private final ArrayMap<ConfigurationChangeListener, Set<String>> mListeners = new ArrayMap<>();
 
@@ -209,6 +230,38 @@
     }
 
     /**
+     * Returns an optional string array value from {@link DeviceConfig} from the system_time
+     * namespace, returns {@link Optional#empty()} if there is no explicit value set.
+     */
+    @NonNull
+    public Optional<String[]> getOptionalStringArray(@DeviceConfigKey String key) {
+        Optional<String> string = getOptionalString(key);
+        if (!string.isPresent()) {
+            return Optional.empty();
+        }
+        return Optional.of(string.get().split(","));
+    }
+
+    /**
+     * Returns an {@link Instant} from {@link DeviceConfig} from the system_time
+     * namespace, returns the {@code defaultValue} if the value is missing or invalid.
+     */
+    @NonNull
+    public Optional<Instant> getOptionalInstant(@DeviceConfigKey String key) {
+        String value = DeviceConfig.getProperty(NAMESPACE_SYSTEM_TIME, key);
+        if (value == null) {
+            return Optional.empty();
+        }
+
+        try {
+            long millis = Long.parseLong(value);
+            return Optional.of(Instant.ofEpochMilli(millis));
+        } catch (DateTimeException | NumberFormatException e) {
+            return Optional.empty();
+        }
+    }
+
+    /**
      * Returns an optional boolean value from {@link DeviceConfig} from the system_time
      * namespace, returns {@link Optional#empty()} if there is no explicit value set.
      */
diff --git a/services/core/java/com/android/server/timedetector/ServiceConfigAccessor.java b/services/core/java/com/android/server/timedetector/ServiceConfigAccessor.java
index be4432a..dac8a0a 100644
--- a/services/core/java/com/android/server/timedetector/ServiceConfigAccessor.java
+++ b/services/core/java/com/android/server/timedetector/ServiceConfigAccessor.java
@@ -15,9 +15,10 @@
  */
 package com.android.server.timedetector;
 
+import static com.android.server.timedetector.ServerFlags.KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE;
+import static com.android.server.timedetector.ServerFlags.KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE;
 import static com.android.server.timedetector.TimeDetectorStrategy.ORIGIN_NETWORK;
 import static com.android.server.timedetector.TimeDetectorStrategy.ORIGIN_TELEPHONY;
-import static com.android.server.timedetector.TimeDetectorStrategy.stringToOrigin;
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
@@ -28,12 +29,17 @@
 
 import com.android.internal.R;
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.util.Preconditions;
+import com.android.server.timedetector.TimeDetectorStrategy.Origin;
 import com.android.server.timezonedetector.ConfigurationChangeListener;
 
 import java.time.Instant;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.Set;
+import java.util.function.Supplier;
 
 /**
  * A singleton that provides access to service configuration for time detection. This hides how
@@ -48,7 +54,7 @@
      * By default telephony and network only suggestions are accepted and telephony takes
      * precedence over network.
      */
-    private static final @TimeDetectorStrategy.Origin int[]
+    private static final @Origin int[]
             DEFAULT_AUTOMATIC_TIME_ORIGIN_PRIORITIES = { ORIGIN_TELEPHONY, ORIGIN_NETWORK };
 
     /**
@@ -60,6 +66,8 @@
 
     private static final Set<String> SERVER_FLAGS_KEYS_TO_WATCH = Collections.unmodifiableSet(
             new ArraySet<>(new String[] {
+                    KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE,
+                    KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE,
             }));
 
     private static final Object SLOCK = new Object();
@@ -70,8 +78,9 @@
     private static ServiceConfigAccessor sInstance;
 
     @NonNull private final Context mContext;
+    @NonNull private final ConfigOriginPrioritiesSupplier mConfigOriginPrioritiesSupplier;
+    @NonNull private final ServerFlagsOriginPrioritiesSupplier mServerFlagsOriginPrioritiesSupplier;
     @NonNull private final ServerFlags mServerFlags;
-    @NonNull private final int[] mOriginPriorities;
 
     /**
      * If a newly calculated system clock time and the current system clock time differs by this or
@@ -83,7 +92,9 @@
     private ServiceConfigAccessor(@NonNull Context context) {
         mContext = Objects.requireNonNull(context);
         mServerFlags = ServerFlags.getInstance(mContext);
-        mOriginPriorities = getOriginPrioritiesInternal();
+        mConfigOriginPrioritiesSupplier = new ConfigOriginPrioritiesSupplier(context);
+        mServerFlagsOriginPrioritiesSupplier =
+                new ServerFlagsOriginPrioritiesSupplier(mServerFlags);
         mSystemClockUpdateThresholdMillis =
                 SystemProperties.getInt("ro.sys.time_detector_update_diff",
                         SYSTEM_CLOCK_UPDATE_THRESHOLD_MILLIS_DEFAULT);
@@ -111,31 +122,109 @@
     }
 
     @NonNull
-    int[] getOriginPriorities() {
-        return mOriginPriorities;
+    @Origin int[] getOriginPriorities() {
+        int[] serverFlagsValue = mServerFlagsOriginPrioritiesSupplier.get();
+        if (serverFlagsValue != null) {
+            return serverFlagsValue;
+        }
+
+        int[] configValue = mConfigOriginPrioritiesSupplier.get();
+        if (configValue != null) {
+            return configValue;
+        }
+        return DEFAULT_AUTOMATIC_TIME_ORIGIN_PRIORITIES;
     }
 
     int systemClockUpdateThresholdMillis() {
         return mSystemClockUpdateThresholdMillis;
     }
 
+    @NonNull
     Instant autoTimeLowerBound() {
-        return TIME_LOWER_BOUND_DEFAULT;
+        return mServerFlags.getOptionalInstant(KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE)
+                .orElse(TIME_LOWER_BOUND_DEFAULT);
     }
 
-    private int[] getOriginPrioritiesInternal() {
-        String[] originStrings =
-                mContext.getResources().getStringArray(R.array.config_autoTimeSourcesPriority);
-        if (originStrings.length == 0) {
-            return DEFAULT_AUTOMATIC_TIME_ORIGIN_PRIORITIES;
-        } else {
-            int[] origins = new int[originStrings.length];
-            for (int i = 0; i < originStrings.length; i++) {
-                int origin = stringToOrigin(originStrings[i]);
-                origins[i] = origin;
-            }
+    /**
+     * A base supplier of an array of time origin integers in priority order.
+     * It handles memoization of the result to avoid repeated string parsing when nothing has
+     * changed.
+     */
+    private abstract static class BaseOriginPrioritiesSupplier implements Supplier<@Origin int[]> {
+        @GuardedBy("this") @Nullable private String[] mLastPriorityStrings;
+        @GuardedBy("this") @Nullable private int[] mLastPriorityInts;
 
-            return origins;
+        /** Returns an array of {@code ORIGIN_*} values, or {@code null}. */
+        @Override
+        @Nullable
+        public @Origin int[] get() {
+            String[] priorityStrings = lookupPriorityStrings();
+            synchronized (this) {
+                if (Arrays.equals(mLastPriorityStrings, priorityStrings)) {
+                    return mLastPriorityInts;
+                }
+
+                int[] priorityInts = null;
+                if (priorityStrings != null && priorityStrings.length > 0) {
+                    priorityInts = new int[priorityStrings.length];
+                    try {
+                        for (int i = 0; i < priorityInts.length; i++) {
+                            String priorityString = priorityStrings[i];
+                            Preconditions.checkArgument(priorityString != null);
+
+                            priorityString = priorityString.trim();
+                            priorityInts[i] = TimeDetectorStrategy.stringToOrigin(priorityString);
+                        }
+                    } catch (IllegalArgumentException e) {
+                        // If any strings were bad and they were ignored then the semantics of the
+                        // whole list could change, so return null.
+                        priorityInts = null;
+                    }
+                }
+                mLastPriorityStrings = priorityStrings;
+                mLastPriorityInts = priorityInts;
+                return priorityInts;
+            }
+        }
+
+        @Nullable
+        protected abstract String[] lookupPriorityStrings();
+    }
+
+    /** Supplies origin priorities from config_autoTimeSourcesPriority. */
+    private static class ConfigOriginPrioritiesSupplier extends BaseOriginPrioritiesSupplier {
+
+        @NonNull private final Context mContext;
+
+        private ConfigOriginPrioritiesSupplier(Context context) {
+            mContext = Objects.requireNonNull(context);
+        }
+
+        @Override
+        @Nullable
+        protected String[] lookupPriorityStrings() {
+            return mContext.getResources().getStringArray(R.array.config_autoTimeSourcesPriority);
+        }
+    }
+
+    /**
+     * Supplies origin priorities from device_config (server flags), see
+     * {@link ServerFlags#KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE}.
+     */
+    private static class ServerFlagsOriginPrioritiesSupplier extends BaseOriginPrioritiesSupplier {
+
+        @NonNull private final ServerFlags mServerFlags;
+
+        private ServerFlagsOriginPrioritiesSupplier(ServerFlags serverFlags) {
+            mServerFlags = Objects.requireNonNull(serverFlags);
+        }
+
+        @Override
+        @Nullable
+        protected String[] lookupPriorityStrings() {
+            Optional<String[]> priorityStrings = mServerFlags.getOptionalStringArray(
+                    KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE);
+            return priorityStrings.orElse(null);
         }
     }
 }
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorService.java b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
index 14cab38..0f14af4 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorService.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
@@ -30,6 +30,8 @@
 import android.content.Context;
 import android.os.Binder;
 import android.os.Handler;
+import android.os.ResultReceiver;
+import android.os.ShellCallback;
 import android.util.IndentingPrintWriter;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -100,6 +102,7 @@
     }
 
     @Override
+    @NonNull
     public TimeCapabilitiesAndConfig getCapabilitiesAndConfig() {
         int userId = mCallerIdentityInjector.getCallingUserId();
         return getTimeCapabilitiesAndConfig(userId);
@@ -119,7 +122,7 @@
     }
 
     @Override
-    public boolean updateConfiguration(TimeConfiguration timeConfiguration) {
+    public boolean updateConfiguration(@NonNull TimeConfiguration timeConfiguration) {
         enforceManageTimeDetectorPermission();
         // TODO(b/172891783) Add actual logic
         return false;
@@ -180,6 +183,13 @@
         ipw.flush();
     }
 
+    @Override
+    public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
+            String[] args, ShellCallback callback, ResultReceiver resultReceiver) {
+        new TimeDetectorShellCommand(this).exec(
+                this, in, out, err, args, callback, resultReceiver);
+    }
+
     private void enforceSuggestTelephonyTimePermission() {
         mContext.enforceCallingPermission(
                 android.Manifest.permission.SUGGEST_TELEPHONY_TIME_AND_ZONE,
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorShellCommand.java b/services/core/java/com/android/server/timedetector/TimeDetectorShellCommand.java
new file mode 100644
index 0000000..233cc57
--- /dev/null
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorShellCommand.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2021 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.timedetector;
+
+import static android.app.timedetector.TimeDetector.SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED;
+import static android.provider.DeviceConfig.NAMESPACE_SYSTEM_TIME;
+
+import static com.android.server.timedetector.ServerFlags.KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE;
+import static com.android.server.timedetector.ServerFlags.KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE;
+
+import android.os.ShellCommand;
+
+import java.io.PrintWriter;
+
+/** Implements the shell command interface for {@link TimeDetectorService}. */
+class TimeDetectorShellCommand extends ShellCommand {
+
+    private final TimeDetectorService mInterface;
+
+    TimeDetectorShellCommand(TimeDetectorService timeDetectorService) {
+        mInterface = timeDetectorService;
+    }
+
+    @Override
+    public int onCommand(String cmd) {
+        if (cmd == null) {
+            return handleDefaultCommands(cmd);
+        }
+
+        switch (cmd) {
+            case SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED:
+                return runIsAutoDetectionEnabled();
+            default: {
+                return handleDefaultCommands(cmd);
+            }
+        }
+    }
+
+    private int runIsAutoDetectionEnabled() {
+        final PrintWriter pw = getOutPrintWriter();
+        boolean enabled = mInterface.getCapabilitiesAndConfig()
+                .getTimeConfiguration()
+                .isAutoDetectionEnabled();
+        pw.println(enabled);
+        return 0;
+    }
+
+    @Override
+    public void onHelp() {
+        final PrintWriter pw = getOutPrintWriter();
+        pw.println("Time Detector (time_detector) commands:");
+        pw.println("  help");
+        pw.println("    Print this help text.");
+        pw.printf("  %s\n", SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED);
+        pw.println("    Prints true/false according to the automatic time detection setting");
+        pw.println();
+        pw.printf("This service is also affected by the following device_config flags in the"
+                + " %s namespace:\n", NAMESPACE_SYSTEM_TIME);
+        pw.printf("    %s - the lower bound used to validate time suggestions when they are"
+                        + " received.\n", KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE);
+        pw.println("         Specified in milliseconds since the start of the Unix epoch.");
+        pw.printf("    %s - [default=null], a comma separated list of origins. See"
+                + " TimeDetectorStrategy for details\n",
+                KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE);
+        pw.println();
+        pw.println("Example:");
+        pw.printf("    $ adb shell cmd device_config put %s %s %s\n",
+                NAMESPACE_SYSTEM_TIME, KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE,
+                "external");
+        pw.println("See adb shell cmd device_config for more information.");
+        pw.println();
+    }
+}
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
index be382f0..ff5060e 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
@@ -27,10 +27,13 @@
 import android.os.TimestampedValue;
 import android.util.IndentingPrintWriter;
 
+import com.android.internal.util.Preconditions;
 import com.android.server.timezonedetector.Dumpable;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 /**
  * The interface for the class that implements the time detection algorithm used by the
@@ -44,9 +47,9 @@
  */
 public interface TimeDetectorStrategy extends Dumpable {
 
-    @IntDef({ ORIGIN_TELEPHONY, ORIGIN_MANUAL, ORIGIN_NETWORK, ORIGIN_GNSS,
-        ORIGIN_EXTERNAL })
+    @IntDef({ ORIGIN_TELEPHONY, ORIGIN_MANUAL, ORIGIN_NETWORK, ORIGIN_GNSS, ORIGIN_EXTERNAL })
     @Retention(RetentionPolicy.SOURCE)
+    @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
     @interface Origin {}
 
     /** Used when a time value originated from a telephony signal. */
@@ -126,9 +129,11 @@
 
     /**
      * Converts a human readable config string to one of the {@code ORIGIN_} constants.
-     * Throws an {@link IllegalArgumentException} if the value is unrecognized.
+     * Throws an {@link IllegalArgumentException} if the value is unrecognized or {@code null}.
      */
     static @Origin int stringToOrigin(String originString) {
+        Preconditions.checkArgument(originString != null);
+
         switch (originString) {
             case "manual":
                 return ORIGIN_MANUAL;
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
index db8a59e..357c232 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
@@ -325,9 +325,9 @@
         ipw.println("mEnvironment.systemClockMillis()=" + mEnvironment.systemClockMillis());
         ipw.println("mEnvironment.systemClockUpdateThresholdMillis()="
                 + mEnvironment.systemClockUpdateThresholdMillis());
+        Instant autoTimeLowerBound = mEnvironment.autoTimeLowerBound();
         ipw.printf("mEnvironment.autoTimeLowerBound()=%s(%s)\n",
-                mEnvironment.autoTimeLowerBound(),
-                mEnvironment.autoTimeLowerBound().toEpochMilli());
+                autoTimeLowerBound, autoTimeLowerBound.toEpochMilli());
         String priorities =
                 Arrays.stream(mEnvironment.autoOriginPriorities())
                         .mapToObj(TimeDetectorStrategy::originToString)
diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
index c20400a..457dc43 100644
--- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
+++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
@@ -321,6 +321,13 @@
         ipw.flush();
     }
 
+    @Override
+    public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
+            String[] args, ShellCallback callback, ResultReceiver resultReceiver) {
+        new TimeZoneDetectorShellCommand(this).exec(
+                this, in, out, err, args, callback, resultReceiver);
+    }
+
     private void enforceManageTimeZoneDetectorPermission() {
         mContext.enforceCallingPermission(
                 android.Manifest.permission.MANAGE_TIME_AND_ZONE_DETECTION,
@@ -346,13 +353,5 @@
                 android.Manifest.permission.SUGGEST_MANUAL_TIME_AND_ZONE,
                 "suggest manual time and time zone");
     }
-
-    @Override
-    public void onShellCommand(FileDescriptor in, FileDescriptor out,
-            FileDescriptor err, String[] args, ShellCallback callback,
-            ResultReceiver resultReceiver) {
-        new TimeZoneDetectorShellCommand(this).exec(
-                this, in, out, err, args, callback, resultReceiver);
-    }
 }
 
diff --git a/services/core/java/com/android/server/vcn/VcnGatewayConnection.java b/services/core/java/com/android/server/vcn/VcnGatewayConnection.java
index 23fb95b..38f5dd6 100644
--- a/services/core/java/com/android/server/vcn/VcnGatewayConnection.java
+++ b/services/core/java/com/android/server/vcn/VcnGatewayConnection.java
@@ -2127,7 +2127,7 @@
                 (VcnControlPlaneIkeConfig) mConnectionConfig.getControlPlaneConfig();
         final IkeSessionParams.Builder builder =
                 new IkeSessionParams.Builder(controlPlaneConfig.getIkeSessionParams());
-        builder.setConfiguredNetwork(network);
+        builder.setNetwork(network);
 
         return builder.build();
     }
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 89b7bbd..9acbdcc 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -2378,6 +2378,46 @@
         }
     }
 
+    /**
+     * Propagate a wake event to the wallpaper engine.
+     */
+    public void notifyWakingUp(int x, int y, @NonNull Bundle extras) {
+        synchronized (mLock) {
+            final WallpaperData data = mWallpaperMap.get(mCurrentUserId);
+            data.connection.forEachDisplayConnector(
+                    displayConnector -> {
+                        if (displayConnector.mEngine != null) {
+                            try {
+                                displayConnector.mEngine.dispatchWallpaperCommand(
+                                        WallpaperManager.COMMAND_WAKING_UP, x, y, -1, extras);
+                            } catch (RemoteException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+        }
+    }
+
+    /**
+     * Propagate a sleep event to the wallpaper engine.
+     */
+    public void notifyGoingToSleep(int x, int y, @NonNull Bundle extras) {
+        synchronized (mLock) {
+            final WallpaperData data = mWallpaperMap.get(mCurrentUserId);
+            data.connection.forEachDisplayConnector(
+                    displayConnector -> {
+                        if (displayConnector.mEngine != null) {
+                            try {
+                                displayConnector.mEngine.dispatchWallpaperCommand(
+                                        WallpaperManager.COMMAND_GOING_TO_SLEEP, x, y, -1, extras);
+                            } catch (RemoteException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+        }
+    }
+
     @Override
     public boolean setLockWallpaperCallback(IWallpaperManagerCallback cb) {
         checkPermission(android.Manifest.permission.INTERNAL_SYSTEM_WINDOW);
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index aa9727a..c39358e 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -1926,12 +1926,16 @@
     }
 
     void scheduleAddStartingWindow() {
-        // Note: we really want to do sendMessageAtFrontOfQueue() because we
-        // want to process the message ASAP, before any other queued
-        // messages.
-        if (!mWmService.mAnimationHandler.hasCallbacks(mAddStartingWindow)) {
-            ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Enqueueing ADD_STARTING");
-            mWmService.mAnimationHandler.postAtFrontOfQueue(mAddStartingWindow);
+        if (StartingSurfaceController.DEBUG_ENABLE_SHELL_DRAWER) {
+            mAddStartingWindow.run();
+        } else {
+            // Note: we really want to do sendMessageAtFrontOfQueue() because we
+            // want to process the message ASAP, before any other queued
+            // messages.
+            if (!mWmService.mAnimationHandler.hasCallbacks(mAddStartingWindow)) {
+                ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Enqueueing ADD_STARTING");
+                mWmService.mAnimationHandler.postAtFrontOfQueue(mAddStartingWindow);
+            }
         }
     }
 
@@ -1943,7 +1947,9 @@
             final StartingData startingData;
             synchronized (mWmService.mGlobalLock) {
                 // There can only be one adding request, silly caller!
-                mWmService.mAnimationHandler.removeCallbacks(this);
+                if (!StartingSurfaceController.DEBUG_ENABLE_SHELL_DRAWER) {
+                    mWmService.mAnimationHandler.removeCallbacks(this);
+                }
 
                 if (mStartingData == null) {
                     // Animation has been canceled... do nothing.
@@ -2192,17 +2198,22 @@
                 + " startingView=%s Callers=%s", this, mStartingWindow, mStartingSurface,
                 Debug.getCallers(5));
 
-
-        // Use the same thread to remove the window as we used to add it, as otherwise we end up
-        // with things in the view hierarchy being called from different threads.
-        mWmService.mAnimationHandler.post(() -> {
+        final Runnable removeSurface = () -> {
             ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Removing startingView=%s", surface);
             try {
                 surface.remove(prepareAnimation);
             } catch (Exception e) {
                 Slog.w(TAG_WM, "Exception when removing starting window", e);
             }
-        });
+        };
+
+        if (StartingSurfaceController.DEBUG_ENABLE_SHELL_DRAWER) {
+            removeSurface.run();
+        } else {
+            // Use the same thread to remove the window as we used to add it, as otherwise we end up
+            // with things in the view hierarchy being called from different threads.
+            mWmService.mAnimationHandler.post(removeSurface);
+        }
     }
 
     private void removeAppTokenFromDisplay() {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index a0beee4..b83945e 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -4514,11 +4514,9 @@
                             .setContentTitle(text)
                             .setContentText(
                                     mContext.getText(R.string.heavy_weight_notification_detail))
-                            // TODO(b/175194709) Please replace FLAG_MUTABLE_UNAUDITED below
-                            // with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
                             .setContentIntent(PendingIntent.getActivityAsUser(mContext, 0,
                                     intent, PendingIntent.FLAG_CANCEL_CURRENT
-                                    | PendingIntent.FLAG_MUTABLE_UNAUDITED, null,
+                                    | PendingIntent.FLAG_IMMUTABLE, null,
                                     new UserHandle(userId)))
                             .build();
             try {
diff --git a/services/core/java/com/android/server/wm/DisplayHashController.java b/services/core/java/com/android/server/wm/DisplayHashController.java
index 5a8af45..af0c3e3 100644
--- a/services/core/java/com/android/server/wm/DisplayHashController.java
+++ b/services/core/java/com/android/server/wm/DisplayHashController.java
@@ -16,8 +16,8 @@
 
 package com.android.server.wm;
 
-import static android.service.displayhash.DisplayHasherService.EXTRA_VERIFIED_DISPLAY_HASH;
-import static android.service.displayhash.DisplayHasherService.SERVICE_META_DATA;
+import static android.service.displayhash.DisplayHashingService.EXTRA_VERIFIED_DISPLAY_HASH;
+import static android.service.displayhash.DisplayHashingService.SERVICE_META_DATA;
 import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM;
 import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS;
 import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_UNKNOWN;
@@ -52,8 +52,8 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.service.displayhash.DisplayHashParams;
-import android.service.displayhash.DisplayHasherService;
-import android.service.displayhash.IDisplayHasherService;
+import android.service.displayhash.DisplayHashingService;
+import android.service.displayhash.IDisplayHashingService;
 import android.util.AttributeSet;
 import android.util.Size;
 import android.util.Slog;
@@ -79,7 +79,7 @@
 import java.util.function.BiConsumer;
 
 /**
- * Handles requests into {@link android.service.displayhash.DisplayHasherService}
+ * Handles requests into {@link DisplayHashingService}
  *
  * Do not hold the {@link WindowManagerService#mGlobalLock} when calling methods since they are
  * blocking calls into another service.
@@ -91,7 +91,7 @@
     private final Object mServiceConnectionLock = new Object();
 
     @GuardedBy("mServiceConnectionLock")
-    private DisplayHasherServiceConnection mServiceConnection;
+    private DisplayHashingServiceConnection mServiceConnection;
 
     private final Context mContext;
 
@@ -150,7 +150,7 @@
     private boolean mDisplayHashThrottlingEnabled = true;
 
     private interface Command {
-        void run(IDisplayHasherService service) throws RemoteException;
+        void run(IDisplayHashingService service) throws RemoteException;
     }
 
     DisplayHashController(Context context) {
@@ -233,7 +233,7 @@
                     (float) size.getHeight() / boundsInWindow.height());
         }
 
-        args.setGrayscale(displayHashParams.isGrayscaleBuffer());
+        args.setGrayscale(displayHashParams.isUseGrayscale());
 
         SurfaceControl.ScreenshotHardwareBuffer screenshotHardwareBuffer =
                 SurfaceControl.captureLayers(args.build());
@@ -405,9 +405,9 @@
                 }
             }
 
-            TypedArray sa = res.obtainAttributes(attrs, R.styleable.DisplayHasherService);
+            TypedArray sa = res.obtainAttributes(attrs, R.styleable.DisplayHashingService);
             mThrottleDurationMillis = sa.getInt(
-                    R.styleable.DisplayHasherService_throttleDurationMillis, 0);
+                    R.styleable.DisplayHashingService_throttleDurationMillis, 0);
             sa.recycle();
             mParsedXml = true;
             return true;
@@ -424,7 +424,7 @@
                 if (DEBUG) Slog.v(TAG, "creating connection");
 
                 // Create the connection
-                mServiceConnection = new DisplayHasherServiceConnection();
+                mServiceConnection = new DisplayHashingServiceConnection();
 
                 final ComponentName component = getServiceComponentName();
                 if (DEBUG) Slog.v(TAG, "binding to: " + component);
@@ -455,7 +455,7 @@
             return null;
         }
 
-        final Intent intent = new Intent(DisplayHasherService.SERVICE_INTERFACE);
+        final Intent intent = new Intent(DisplayHashingService.SERVICE_INTERFACE);
         intent.setPackage(packageName);
         final ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent,
                 PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
@@ -472,10 +472,10 @@
         if (serviceInfo == null) return null;
 
         final ComponentName name = new ComponentName(serviceInfo.packageName, serviceInfo.name);
-        if (!Manifest.permission.BIND_DISPLAY_HASHER_SERVICE
+        if (!Manifest.permission.BIND_DISPLAY_HASHING_SERVICE
                 .equals(serviceInfo.permission)) {
             Slog.w(TAG, name.flattenToShortString() + " requires permission "
-                    + Manifest.permission.BIND_DISPLAY_HASHER_SERVICE);
+                    + Manifest.permission.BIND_DISPLAY_HASHING_SERVICE);
             return null;
         }
 
@@ -488,7 +488,7 @@
         private Bundle mResult;
         private final CountDownLatch mCountDownLatch = new CountDownLatch(1);
 
-        public Bundle run(BiConsumer<IDisplayHasherService, RemoteCallback> func) {
+        public Bundle run(BiConsumer<IDisplayHashingService, RemoteCallback> func) {
             connectAndRun(service -> {
                 RemoteCallback callback = new RemoteCallback(result -> {
                     mResult = result;
@@ -507,9 +507,9 @@
         }
     }
 
-    private class DisplayHasherServiceConnection implements ServiceConnection {
+    private class DisplayHashingServiceConnection implements ServiceConnection {
         @GuardedBy("mServiceConnectionLock")
-        private IDisplayHasherService mRemoteService;
+        private IDisplayHashingService mRemoteService;
 
         @GuardedBy("mServiceConnectionLock")
         private ArrayList<Command> mQueuedCommands;
@@ -518,7 +518,7 @@
         public void onServiceConnected(ComponentName name, IBinder service) {
             if (DEBUG) Slog.v(TAG, "onServiceConnected(): " + name);
             synchronized (mServiceConnectionLock) {
-                mRemoteService = IDisplayHasherService.Stub.asInterface(service);
+                mRemoteService = IDisplayHashingService.Stub.asInterface(service);
                 if (mQueuedCommands != null) {
                     final int size = mQueuedCommands.size();
                     if (DEBUG) Slog.d(TAG, "running " + size + " queued commands");
diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java
index 4bb48b0b..9f9ac3e 100644
--- a/services/core/java/com/android/server/wm/RecentTasks.java
+++ b/services/core/java/com/android/server/wm/RecentTasks.java
@@ -1436,20 +1436,18 @@
 
     /** @return whether the given task can be trimmed even if it is outside the visible range. */
     protected boolean isTrimmable(Task task) {
-        final Task rootTask = task.getRootTask();
-
-        // No stack for task, just trim it
-        if (rootTask == null) {
+        // The task was detached, just trim it.
+        if (!task.isAttached()) {
             return true;
         }
 
         // Ignore tasks from different displays
         // TODO (b/115289124): No Recents on non-default displays.
-        if (!rootTask.isOnHomeDisplay()) {
+        if (!task.isOnHomeDisplay()) {
             return false;
         }
 
-        final Task rootHomeTask = rootTask.getDisplayArea().getRootHomeTask();
+        final Task rootHomeTask = task.getDisplayArea().getRootHomeTask();
         // Home task does not exist. Don't trim the task.
         if (rootHomeTask == null) {
             return false;
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 129a6ce..19c2e73 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -675,6 +675,8 @@
         }
         final SurfaceControl.Transaction t = mDisplayContent.getPendingTransaction();
         final WindowContainer parent = navToken.getParent();
+        t.setLayer(navToken.getSurfaceControl(), navToken.getLastLayer());
+
         if (animate) {
             final NavBarFadeAnimationController navBarFadeAnimationController =
                     mDisplayContent.getDisplayPolicy().getNavBarFadeAnimationController();
diff --git a/services/core/java/com/android/server/wm/StartingSurfaceController.java b/services/core/java/com/android/server/wm/StartingSurfaceController.java
index 603bfd1..a9b06ca 100644
--- a/services/core/java/com/android/server/wm/StartingSurfaceController.java
+++ b/services/core/java/com/android/server/wm/StartingSurfaceController.java
@@ -61,7 +61,7 @@
         synchronized (mService.mGlobalLock) {
             final Task task = activity.getTask();
             if (task != null && mService.mAtmService.mTaskOrganizerController.addStartingWindow(
-                    task, activity.token, theme)) {
+                    task, activity.token, theme, null /* taskSnapshot */)) {
                 return new ShellStartingSurface(task);
             }
         }
@@ -128,7 +128,7 @@
             }
             if (DEBUG_ENABLE_SHELL_DRAWER) {
                 mService.mAtmService.mTaskOrganizerController.addStartingWindow(task,
-                        activity.token, 0 /* launchTheme */);
+                        activity.token, 0 /* launchTheme */, taskSnapshot);
                 return new ShellStartingSurface(task);
             }
         }
diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java
index 565804f..ccc0916 100644
--- a/services/core/java/com/android/server/wm/TaskOrganizerController.java
+++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java
@@ -43,6 +43,7 @@
 import android.window.ITaskOrganizerController;
 import android.window.StartingWindowInfo;
 import android.window.TaskAppearedInfo;
+import android.window.TaskSnapshot;
 import android.window.WindowContainerToken;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -118,25 +119,25 @@
             return mTaskOrganizer.asBinder();
         }
 
-        void addStartingWindow(Task task, IBinder appToken, int launchTheme) {
+        void addStartingWindow(Task task, IBinder appToken, int launchTheme,
+                TaskSnapshot taskSnapshot) {
             final StartingWindowInfo info = task.getStartingWindowInfo();
             if (launchTheme != 0) {
                 info.splashScreenThemeResId = launchTheme;
             }
-            mDeferTaskOrgCallbacksConsumer.accept(() -> {
-                try {
-                    mTaskOrganizer.addStartingWindow(info, appToken);
-                } catch (RemoteException e) {
-                    Slog.e(TAG, "Exception sending onTaskStart callback", e);
-                }
-            });
+            info.mTaskSnapshot = taskSnapshot;
+            // make this happen prior than prepare surface
+            try {
+                mTaskOrganizer.addStartingWindow(info, appToken);
+            } catch (RemoteException e) {
+                Slog.e(TAG, "Exception sending onTaskStart callback", e);
+            }
         }
 
         void removeStartingWindow(Task task, boolean prepareAnimation) {
-            mDeferTaskOrgCallbacksConsumer.accept(() -> {
-                SurfaceControl firstWindowLeash = null;
-                Rect mainFrame = null;
-                // TODO enable shift up animation once we fix flicker test
+            SurfaceControl firstWindowLeash = null;
+            Rect mainFrame = null;
+            // TODO enable shift up animation once we fix flicker test
 //                final boolean playShiftUpAnimation = !task.inMultiWindowMode();
 //                if (prepareAnimation && playShiftUpAnimation) {
 //                    final ActivityRecord topActivity = task.topActivityWithStartingWindow();
@@ -144,32 +145,29 @@
 //                        final WindowState mainWindow =
 //                                topActivity.findMainWindow(false/* includeStartingApp */);
 //                        if (mainWindow != null) {
-                // TODO create proper leash instead of the copied SC
+            // TODO create proper leash instead of the copied SC
 //                            firstWindowLeash = new SurfaceControl(mainWindow.getSurfaceControl(),
 //                                    "TaskOrganizerController.removeStartingWindow");
 //                            mainFrame = mainWindow.getRelativeFrame();
 //                        }
 //                    }
 //                }
-                try {
-                    mTaskOrganizer.removeStartingWindow(task.mTaskId, firstWindowLeash, mainFrame,
-                    /* TODO(183004107) Revert this when jankiness is solved
-                        prepareAnimation); */ false);
+            try {
+                mTaskOrganizer.removeStartingWindow(task.mTaskId, firstWindowLeash, mainFrame,
+                /* TODO(183004107) Revert this when jankiness is solved
+                    prepareAnimation); */ false);
 
-                } catch (RemoteException e) {
-                    Slog.e(TAG, "Exception sending onStartTaskFinished callback", e);
-                }
-            });
+            } catch (RemoteException e) {
+                Slog.e(TAG, "Exception sending onStartTaskFinished callback", e);
+            }
         }
 
         void copySplashScreenView(Task task) {
-            mDeferTaskOrgCallbacksConsumer.accept(() -> {
-                try {
-                    mTaskOrganizer.copySplashScreenView(task.mTaskId);
-                } catch (RemoteException e) {
-                    Slog.e(TAG, "Exception sending copyStartingWindowView callback", e);
-                }
-            });
+            try {
+                mTaskOrganizer.copySplashScreenView(task.mTaskId);
+            } catch (RemoteException e) {
+                Slog.e(TAG, "Exception sending copyStartingWindowView callback", e);
+            }
         }
 
         SurfaceControl prepareLeash(Task task, boolean visible, String reason) {
@@ -266,8 +264,9 @@
             mUid = uid;
         }
 
-        void addStartingWindow(Task t, IBinder appToken, int launchTheme) {
-            mOrganizer.addStartingWindow(t, appToken, launchTheme);
+        void addStartingWindow(Task t, IBinder appToken, int launchTheme,
+                TaskSnapshot taskSnapshot) {
+            mOrganizer.addStartingWindow(t, appToken, launchTheme, taskSnapshot);
         }
 
         void removeStartingWindow(Task t, boolean prepareAnimation) {
@@ -505,14 +504,15 @@
         return !ArrayUtils.contains(UNSUPPORTED_WINDOWING_MODES, winMode);
     }
 
-    boolean addStartingWindow(Task task, IBinder appToken, int launchTheme) {
+    boolean addStartingWindow(Task task, IBinder appToken, int launchTheme,
+            TaskSnapshot taskSnapshot) {
         final Task rootTask = task.getRootTask();
         if (rootTask == null || rootTask.mTaskOrganizer == null) {
             return false;
         }
         final TaskOrganizerState state =
                 mTaskOrganizerStates.get(rootTask.mTaskOrganizer.asBinder());
-        state.addStartingWindow(task, appToken, launchTheme);
+        state.addStartingWindow(task, appToken, launchTheme, taskSnapshot);
         return true;
     }
 
diff --git a/services/core/java/com/android/server/wm/WindowContextListenerController.java b/services/core/java/com/android/server/wm/WindowContextListenerController.java
index 5e75996..0bb56e4 100644
--- a/services/core/java/com/android/server/wm/WindowContextListenerController.java
+++ b/services/core/java/com/android/server/wm/WindowContextListenerController.java
@@ -231,7 +231,7 @@
         }
 
         @Override
-        public void onRequestedOverrideConfigurationChanged(Configuration overrideConfiguration) {
+        public void onMergedOverrideConfigurationChanged(Configuration mergedOverrideConfig) {
             reportConfigToWindowTokenClient();
         }
 
diff --git a/services/core/jni/com_android_server_pm_PackageManagerShellCommandDataLoader.cpp b/services/core/jni/com_android_server_pm_PackageManagerShellCommandDataLoader.cpp
index f0210ee..db52683 100644
--- a/services/core/jni/com_android_server_pm_PackageManagerShellCommandDataLoader.cpp
+++ b/services/core/jni/com_android_server_pm_PackageManagerShellCommandDataLoader.cpp
@@ -171,17 +171,23 @@
     return result;
 }
 
-static inline std::vector<char> readBytes(borrowed_fd fd) {
-    int32_t size = readLEInt32(fd);
-    std::vector<char> result(size);
-    android::base::ReadFully(fd, result.data(), size);
-    return result;
+static inline bool skipBytes(borrowed_fd fd, int* max_size) {
+    int32_t size = std::min(readLEInt32(fd), *max_size);
+    if (size <= 0) {
+        return false;
+    }
+    *max_size -= size;
+    return (TEMP_FAILURE_RETRY(lseek64(fd.get(), size, SEEK_CUR)) >= 0);
 }
 
 static inline int32_t skipIdSigHeaders(borrowed_fd fd) {
-    readLEInt32(fd);        // version
-    readBytes(fd);          // hashingInfo
-    readBytes(fd);          // signingInfo
+    // version
+    auto version = readLEInt32(fd);
+    int max_size = INCFS_MAX_SIGNATURE_SIZE - sizeof(version);
+    // hashingInfo and signingInfo
+    if (!skipBytes(fd, &max_size) || !skipBytes(fd, &max_size)) {
+        return -1;
+    }
     return readLEInt32(fd); // size of the verity tree
 }
 
@@ -253,8 +259,12 @@
 
     unique_fd idsigFd = openLocalFile(env, jni, shellCommand, idsigPath);
     if (idsigFd.ok()) {
-        auto treeSize = verityTreeSizeForFile(size);
         auto actualTreeSize = skipIdSigHeaders(idsigFd);
+        if (actualTreeSize < 0) {
+            ALOGE("Error reading .idsig file: wrong format.");
+            return {};
+        }
+        auto treeSize = verityTreeSizeForFile(size);
         if (treeSize != actualTreeSize) {
             ALOGE("Verity tree size mismatch: %d vs .idsig: %d.", int(treeSize),
                   int(actualTreeSize));
diff --git a/services/incremental/Android.bp b/services/incremental/Android.bp
index 5140b9f..0bd737b 100644
--- a/services/incremental/Android.bp
+++ b/services/incremental/Android.bp
@@ -77,6 +77,7 @@
         "libcutils",
         "libincfs",
         "liblog",
+        "libpermission",
         "libz",
     ],
 }
diff --git a/services/incremental/TEST_MAPPING b/services/incremental/TEST_MAPPING
index d935256..6aa8a93 100644
--- a/services/incremental/TEST_MAPPING
+++ b/services/incremental/TEST_MAPPING
@@ -24,7 +24,9 @@
     },
     {
       "name": "CtsIncrementalInstallHostTestCases"
-    },
+    }
+  ],
+  "presubmit-large": [
     {
       "name": "CtsInstalledLoadingProgressHostTests"
     }
diff --git a/services/people/java/com/android/server/people/data/DataManager.java b/services/people/java/com/android/server/people/data/DataManager.java
index 9f24d9a..d913d4e 100644
--- a/services/people/java/com/android/server/people/data/DataManager.java
+++ b/services/people/java/com/android/server/people/data/DataManager.java
@@ -111,7 +111,8 @@
     private static final long RECENT_NOTIFICATIONS_MAX_AGE_MS = 10 * DateUtils.DAY_IN_MILLIS;
     private static final long QUERY_EVENTS_MAX_AGE_MS = 5L * DateUtils.MINUTE_IN_MILLIS;
     private static final long USAGE_STATS_QUERY_INTERVAL_SEC = 120L;
-    @VisibleForTesting static final int MAX_CACHED_RECENT_SHORTCUTS = 30;
+    @VisibleForTesting
+    static final int MAX_CACHED_RECENT_SHORTCUTS = 30;
 
     private final Context mContext;
     private final Injector mInjector;
@@ -256,14 +257,23 @@
     @Nullable
     private ConversationChannel getConversationChannel(String packageName, int userId,
             String shortcutId, ConversationInfo conversationInfo) {
+        ShortcutInfo shortcutInfo = getShortcut(packageName, userId, shortcutId);
+        return getConversationChannel(shortcutInfo, conversationInfo);
+    }
+
+    @Nullable
+    private ConversationChannel getConversationChannel(ShortcutInfo shortcutInfo,
+            ConversationInfo conversationInfo) {
         if (conversationInfo == null) {
             return null;
         }
-        ShortcutInfo shortcutInfo = getShortcut(packageName, userId, shortcutId);
         if (shortcutInfo == null) {
-            Slog.e(TAG, " Shortcut no longer found: " + shortcutId);
+            Slog.e(TAG, " Shortcut no longer found");
             return null;
         }
+        String packageName = shortcutInfo.getPackage();
+        String shortcutId = shortcutInfo.getId();
+        int userId = shortcutInfo.getUserId();
         int uid = mPackageManagerInternal.getPackageUid(packageName, 0, userId);
         NotificationChannel parentChannel =
                 mNotificationManagerInternal.getNotificationChannel(packageName, uid,
@@ -363,7 +373,9 @@
                     }
                 }
                 builder.setStatuses(newStatuses);
-                cs.addOrUpdate(builder.build());
+                updateConversationStoreThenNotifyListeners(cs, builder.build(),
+                        packageData.getPackageName(),
+                        packageData.getUserId());
             });
         });
     }
@@ -397,11 +409,7 @@
         ConversationInfo convToModify = getConversationInfoOrThrow(cs, conversationId);
         ConversationInfo.Builder builder = new ConversationInfo.Builder(convToModify);
         builder.addOrUpdateStatus(status);
-        ConversationInfo modifiedConv = builder.build();
-        cs.addOrUpdate(modifiedConv);
-        ConversationChannel conversation = getConversationChannel(packageName, userId,
-                conversationId, modifiedConv);
-        notifyConversationsListeners(Arrays.asList(conversation));
+        updateConversationStoreThenNotifyListeners(cs, builder.build(), packageName, userId);
 
         if (status.getEndTimeMillis() >= 0) {
             mStatusExpReceiver.scheduleExpiration(
@@ -416,7 +424,7 @@
         ConversationInfo convToModify = getConversationInfoOrThrow(cs, conversationId);
         ConversationInfo.Builder builder = new ConversationInfo.Builder(convToModify);
         builder.clearStatus(statusId);
-        cs.addOrUpdate(builder.build());
+        updateConversationStoreThenNotifyListeners(cs, builder.build(), packageName, userId);
     }
 
     public void clearStatuses(String packageName, int userId, String conversationId) {
@@ -424,7 +432,7 @@
         ConversationInfo convToModify = getConversationInfoOrThrow(cs, conversationId);
         ConversationInfo.Builder builder = new ConversationInfo.Builder(convToModify);
         builder.setStatuses(null);
-        cs.addOrUpdate(builder.build());
+        updateConversationStoreThenNotifyListeners(cs, builder.build(), packageName, userId);
     }
 
     public @NonNull List<ConversationStatus> getStatuses(String packageName, int userId,
@@ -882,7 +890,8 @@
                 }
             }
         }
-        conversationStore.addOrUpdate(builder.build());
+        updateConversationStoreThenNotifyListeners(conversationStore, builder.build(),
+                shortcutInfo);
     }
 
     @VisibleForTesting
@@ -945,6 +954,7 @@
                     conversationSelector.mConversationStore =
                             packageData.getConversationStore();
                     conversationSelector.mConversationInfo = ci;
+                    conversationSelector.mPackageName = packageData.getPackageName();
                 }
             });
             if (conversationSelector.mConversationInfo == null) {
@@ -955,13 +965,16 @@
                     new ConversationInfo.Builder(conversationSelector.mConversationInfo);
             builder.setContactStarred(helper.isStarred());
             builder.setContactPhoneNumber(helper.getPhoneNumber());
-            conversationSelector.mConversationStore.addOrUpdate(builder.build());
+            updateConversationStoreThenNotifyListeners(conversationSelector.mConversationStore,
+                    builder.build(),
+                    conversationSelector.mPackageName, userId);
             mLastUpdatedTimestamp = helper.getLastUpdatedTimestamp();
         }
 
         private class ConversationSelector {
             private ConversationStore mConversationStore = null;
             private ConversationInfo mConversationInfo = null;
+            private String mPackageName = null;
         }
     }
 
@@ -1140,6 +1153,7 @@
                         .setLastEventTimestamp(sbn.getPostTime())
                         .setParentNotificationChannelId(sbn.getNotification().getChannelId())
                         .build();
+                // Don't update listeners on notifications posted.
                 packageData.getConversationStore().addOrUpdate(updated);
 
                 EventHistoryImpl eventHistory = packageData.getEventStore().getOrCreateEventHistory(
@@ -1215,7 +1229,8 @@
                     builder.setBubbled(false);
                     break;
             }
-            conversationStore.addOrUpdate(builder.build());
+            updateConversationStoreThenNotifyListeners(conversationStore, builder.build(), pkg,
+                    packageData.getUserId());
         }
 
         synchronized boolean hasActiveNotifications(String packageName, String shortcutId) {
@@ -1253,7 +1268,9 @@
                 ConversationInfo updated = new ConversationInfo.Builder(conversationInfo)
                         .setLastEventTimestamp(event.getTimestamp())
                         .build();
-                packageData.getConversationStore().addOrUpdate(updated);
+                updateConversationStoreThenNotifyListeners(packageData.getConversationStore(),
+                        updated,
+                        packageData.getPackageName(), packageData.getUserId());
             }
         }
     }
@@ -1266,7 +1283,27 @@
         }
     }
 
-    // TODO(b/178792356): Trigger ConversationsListener on all-related data changes.
+    private void updateConversationStoreThenNotifyListeners(ConversationStore cs,
+            ConversationInfo modifiedConv,
+            String packageName, int userId) {
+        cs.addOrUpdate(modifiedConv);
+        ConversationChannel channel = getConversationChannel(packageName, userId,
+                modifiedConv.getShortcutId(), modifiedConv);
+        if (channel != null) {
+            notifyConversationsListeners(Arrays.asList(channel));
+        }
+    }
+
+    private void updateConversationStoreThenNotifyListeners(ConversationStore cs,
+            ConversationInfo modifiedConv, ShortcutInfo shortcutInfo) {
+        cs.addOrUpdate(modifiedConv);
+        ConversationChannel channel = getConversationChannel(shortcutInfo, modifiedConv);
+        if (channel != null) {
+            notifyConversationsListeners(Arrays.asList(channel));
+        }
+    }
+
+
     @VisibleForTesting
     void notifyConversationsListeners(
             @Nullable final List<ConversationChannel> changedConversations) {
diff --git a/services/tests/mockingservicestests/src/com/android/server/job/controllers/ConnectivityControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/job/controllers/ConnectivityControllerTest.java
index 0cd470ae..ffbcc45 100644
--- a/services/tests/mockingservicestests/src/com/android/server/job/controllers/ConnectivityControllerTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/job/controllers/ConnectivityControllerTest.java
@@ -137,7 +137,7 @@
 
     @Test
     public void testUsable() throws Exception {
-        final Network net = new Network(101);
+        final Network net = mock(Network.class);
         final JobInfo.Builder job = createJob()
                 .setEstimatedNetworkBytes(DataUnit.MEBIBYTES.toBytes(1),
                         DataUnit.MEBIBYTES.toBytes(1))
@@ -148,52 +148,52 @@
 
         // Slow network is too slow
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1)
-                        .setLinkDownstreamBandwidthKbps(1), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1)
+                        .setLinkDownstreamBandwidthKbps(1).build(), mConstants));
         // Slow downstream
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1024)
-                        .setLinkDownstreamBandwidthKbps(1), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1024)
+                        .setLinkDownstreamBandwidthKbps(1).build(), mConstants));
         // Slow upstream
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1)
-                        .setLinkDownstreamBandwidthKbps(1024), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1)
+                        .setLinkDownstreamBandwidthKbps(1024).build(), mConstants));
         // Fast network looks great
         assertTrue(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1024)
-                        .setLinkDownstreamBandwidthKbps(1024), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1024)
+                        .setLinkDownstreamBandwidthKbps(1024).build(), mConstants));
         // Slow network still good given time
         assertTrue(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(130)
-                        .setLinkDownstreamBandwidthKbps(130), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(130)
+                        .setLinkDownstreamBandwidthKbps(130).build(), mConstants));
 
         when(mService.getMaxJobExecutionTimeMs(any())).thenReturn(60_000L);
 
         // Slow network is too slow
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1)
-                        .setLinkDownstreamBandwidthKbps(1), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1)
+                        .setLinkDownstreamBandwidthKbps(1).build(), mConstants));
         // Slow downstream
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(137)
-                        .setLinkDownstreamBandwidthKbps(1), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(137)
+                        .setLinkDownstreamBandwidthKbps(1).build(), mConstants));
         // Slow upstream
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1)
-                        .setLinkDownstreamBandwidthKbps(137), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1)
+                        .setLinkDownstreamBandwidthKbps(137).build(), mConstants));
         // Network good enough
         assertTrue(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(137)
-                        .setLinkDownstreamBandwidthKbps(137), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(137)
+                        .setLinkDownstreamBandwidthKbps(137).build(), mConstants));
         // Network slightly too slow given reduced time
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(130)
-                        .setLinkDownstreamBandwidthKbps(130), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(130)
+                        .setLinkDownstreamBandwidthKbps(130).build(), mConstants));
     }
 
     @Test
     public void testInsane() throws Exception {
-        final Network net = new Network(101);
+        final Network net = mock(Network.class);
         final JobInfo.Builder job = createJob()
                 .setEstimatedNetworkBytes(DataUnit.MEBIBYTES.toBytes(1),
                         DataUnit.MEBIBYTES.toBytes(1))
@@ -205,14 +205,15 @@
 
         // Suspended networks aren't usable.
         assertFalse(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().removeCapability(NET_CAPABILITY_NOT_SUSPENDED)
-                        .setLinkUpstreamBandwidthKbps(1024).setLinkDownstreamBandwidthKbps(1024),
+                createCapabilitiesBuilder().removeCapability(NET_CAPABILITY_NOT_SUSPENDED)
+                        .setLinkUpstreamBandwidthKbps(1024).setLinkDownstreamBandwidthKbps(1024)
+                        .build(),
                 mConstants));
 
         // Not suspended networks are usable.
         assertTrue(controller.isSatisfied(createJobStatus(job), net,
-                createCapabilities().setLinkUpstreamBandwidthKbps(1024)
-                        .setLinkDownstreamBandwidthKbps(1024), mConstants));
+                createCapabilitiesBuilder().setLinkUpstreamBandwidthKbps(1024)
+                        .setLinkDownstreamBandwidthKbps(1024).build(), mConstants));
     }
 
     @Test
@@ -229,17 +230,17 @@
 
         // Uncongested network is whenever
         {
-            final Network net = new Network(101);
-            final NetworkCapabilities caps = createCapabilities()
-                    .addCapability(NET_CAPABILITY_NOT_CONGESTED);
+            final Network net = mock(Network.class);
+            final NetworkCapabilities caps = createCapabilitiesBuilder()
+                    .addCapability(NET_CAPABILITY_NOT_CONGESTED).build();
             assertTrue(controller.isSatisfied(early, net, caps, mConstants));
             assertTrue(controller.isSatisfied(late, net, caps, mConstants));
         }
 
         // Congested network is more selective
         {
-            final Network net = new Network(101);
-            final NetworkCapabilities caps = createCapabilities();
+            final Network net = mock(Network.class);
+            final NetworkCapabilities caps = createCapabilitiesBuilder().build();
             assertFalse(controller.isSatisfied(early, net, caps, mConstants));
             assertTrue(controller.isSatisfied(late, net, caps, mConstants));
         }
@@ -263,10 +264,11 @@
 
         // Unmetered network is whenever
         {
-            final Network net = new Network(101);
-            final NetworkCapabilities caps = createCapabilities()
+            final Network net = mock(Network.class);
+            final NetworkCapabilities caps = createCapabilitiesBuilder()
                     .addCapability(NET_CAPABILITY_NOT_CONGESTED)
-                    .addCapability(NET_CAPABILITY_NOT_METERED);
+                    .addCapability(NET_CAPABILITY_NOT_METERED)
+                    .build();
             assertTrue(controller.isSatisfied(early, net, caps, mConstants));
             assertTrue(controller.isSatisfied(late, net, caps, mConstants));
             assertTrue(controller.isSatisfied(earlyPrefetch, net, caps, mConstants));
@@ -275,9 +277,10 @@
 
         // Metered network is only when prefetching and late
         {
-            final Network net = new Network(101);
-            final NetworkCapabilities caps = createCapabilities()
-                    .addCapability(NET_CAPABILITY_NOT_CONGESTED);
+            final Network net = mock(Network.class);
+            final NetworkCapabilities caps = createCapabilitiesBuilder()
+                    .addCapability(NET_CAPABILITY_NOT_CONGESTED)
+                    .build();
             assertFalse(controller.isSatisfied(early, net, caps, mConstants));
             assertFalse(controller.isSatisfied(late, net, caps, mConstants));
             assertFalse(controller.isSatisfied(earlyPrefetch, net, caps, mConstants));
@@ -301,11 +304,12 @@
 
         final ConnectivityController controller = new ConnectivityController(mService);
 
-        final Network meteredNet = new Network(101);
-        final NetworkCapabilities meteredCaps = createCapabilities();
-        final Network unmeteredNet = new Network(202);
-        final NetworkCapabilities unmeteredCaps = createCapabilities()
-                .addCapability(NET_CAPABILITY_NOT_METERED);
+        final Network meteredNet = mock(Network.class);
+        final NetworkCapabilities meteredCaps = createCapabilitiesBuilder().build();
+        final Network unmeteredNet = mock(Network.class);
+        final NetworkCapabilities unmeteredCaps = createCapabilitiesBuilder()
+                .addCapability(NET_CAPABILITY_NOT_METERED)
+                .build();
 
         final JobStatus red = createJobStatus(createJob()
                 .setEstimatedNetworkBytes(DataUnit.MEBIBYTES.toBytes(1), 0)
@@ -610,9 +614,9 @@
         networked.setStandbyBucket(FREQUENT_INDEX);
         unnetworked.setStandbyBucket(FREQUENT_INDEX);
 
-        final Network cellularNet = new Network(101);
+        final Network cellularNet = mock(Network.class);
         final NetworkCapabilities cellularCaps =
-                createCapabilities().addTransportType(TRANSPORT_CELLULAR);
+                createCapabilitiesBuilder().addTransportType(TRANSPORT_CELLULAR).build();
 
         final ConnectivityController controller = new ConnectivityController(mService);
         controller.maybeStartTrackingJobLocked(networked, null);
@@ -660,8 +664,8 @@
         }
     }
 
-    private static NetworkCapabilities createCapabilities() {
-        return new NetworkCapabilities().addCapability(NET_CAPABILITY_INTERNET)
+    private static NetworkCapabilities.Builder createCapabilitiesBuilder() {
+        return new NetworkCapabilities.Builder().addCapability(NET_CAPABILITY_INTERNET)
                 .addCapability(NET_CAPABILITY_NOT_SUSPENDED)
                 .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
                 .addCapability(NET_CAPABILITY_VALIDATED);
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java
index 49a54ec..aecc794 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java
@@ -112,14 +112,13 @@
     private MockableRebootEscrowInjected mInjected;
     private RebootEscrowManager mService;
     private SecretKey mAesKey;
+    private MockInjector mMockInjector;
 
     public interface MockableRebootEscrowInjected {
         int getBootCount();
 
         long getCurrentTimeMillis();
 
-        boolean forceServerBased();
-
         void reportMetric(boolean success, int errorCode, int serviceType, int attemptCount,
                 int escrowDurationInSeconds, int vbmetaDigestStatus, int durationSinceBootComplete);
     }
@@ -127,11 +126,12 @@
     static class MockInjector extends RebootEscrowManager.Injector {
         private final IRebootEscrow mRebootEscrow;
         private final ResumeOnRebootServiceConnection mServiceConnection;
-        private final RebootEscrowProviderInterface mRebootEscrowProvider;
+        private final RebootEscrowProviderInterface mDefaultRebootEscrowProvider;
         private final UserManager mUserManager;
         private final MockableRebootEscrowInjected mInjected;
         private final RebootEscrowKeyStoreManager mKeyStoreManager;
-        private final boolean mServerBased;
+        private boolean mServerBased;
+        private RebootEscrowProviderInterface mRebootEscrowProviderInUse;
 
         MockInjector(Context context, UserManager userManager,
                 IRebootEscrow rebootEscrow,
@@ -149,7 +149,7 @@
                             return mRebootEscrow;
                         }
                     };
-            mRebootEscrowProvider = new RebootEscrowProviderHalImpl(halInjector);
+            mDefaultRebootEscrowProvider = new RebootEscrowProviderHalImpl(halInjector);
             mUserManager = userManager;
             mKeyStoreManager = keyStoreManager;
             mInjected = injected;
@@ -166,7 +166,8 @@
             mServerBased = true;
             RebootEscrowProviderServerBasedImpl.Injector injector =
                     new RebootEscrowProviderServerBasedImpl.Injector(serviceConnection);
-            mRebootEscrowProvider = new RebootEscrowProviderServerBasedImpl(storage, injector);
+            mDefaultRebootEscrowProvider = new RebootEscrowProviderServerBasedImpl(
+                    storage, injector);
             mUserManager = userManager;
             mKeyStoreManager = keyStoreManager;
             mInjected = injected;
@@ -184,15 +185,23 @@
 
         @Override
         public boolean serverBasedResumeOnReboot() {
-            if (mInjected.forceServerBased()) {
-                return true;
-            }
             return mServerBased;
         }
 
         @Override
+        public RebootEscrowProviderInterface createRebootEscrowProviderIfNeeded() {
+            mRebootEscrowProviderInUse = mDefaultRebootEscrowProvider;
+            return mRebootEscrowProviderInUse;
+        }
+
+        @Override
         public RebootEscrowProviderInterface getRebootEscrowProvider() {
-            return mRebootEscrowProvider;
+            return mRebootEscrowProviderInUse;
+        }
+
+        @Override
+        public void clearRebootEscrowProvider() {
+            mRebootEscrowProviderInUse = null;
         }
 
         @Override
@@ -264,13 +273,15 @@
         when(mCallbacks.isUserSecure(NONSECURE_SECONDARY_USER_ID)).thenReturn(false);
         when(mCallbacks.isUserSecure(SECURE_SECONDARY_USER_ID)).thenReturn(true);
         mInjected = mock(MockableRebootEscrowInjected.class);
-        mService = new RebootEscrowManager(new MockInjector(mContext, mUserManager, mRebootEscrow,
-                mKeyStoreManager, mStorage, mInjected), mCallbacks, mStorage);
+        mMockInjector = new MockInjector(mContext, mUserManager, mRebootEscrow,
+                mKeyStoreManager, mStorage, mInjected);
+        mService = new RebootEscrowManager(mMockInjector, mCallbacks, mStorage);
     }
 
     private void setServerBasedRebootEscrowProvider() throws Exception {
-        mService = new RebootEscrowManager(new MockInjector(mContext, mUserManager,
-                mServiceConnection, mKeyStoreManager, mStorage, mInjected), mCallbacks, mStorage);
+        mMockInjector = new MockInjector(mContext, mUserManager, mServiceConnection,
+                mKeyStoreManager, mStorage, mInjected);
+        mService = new RebootEscrowManager(mMockInjector, mCallbacks, mStorage);
     }
 
     @Test
@@ -317,6 +328,7 @@
         doThrow(ServiceSpecificException.class).when(mRebootEscrow).storeKey(any());
         mService.clearRebootEscrow();
         verify(mRebootEscrow).storeKey(eq(new byte[32]));
+        assertNull(mMockInjector.getRebootEscrowProvider());
     }
 
     @Test
@@ -785,7 +797,7 @@
         assertNull(
                 mStorage.getString(RebootEscrowManager.REBOOT_ESCROW_ARMED_KEY, null, USER_SYSTEM));
         // Change the provider to server based, expect the reboot to fail
-        when(mInjected.forceServerBased()).thenReturn(true);
+        mMockInjector.mServerBased = true;
         assertEquals(ARM_REBOOT_ERROR_PROVIDER_MISMATCH, mService.armRebootEscrowIfNeeded());
         assertNull(
                 mStorage.getString(RebootEscrowManager.REBOOT_ESCROW_ARMED_KEY, null, USER_SYSTEM));
diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
index 352832b..da6c30e 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
@@ -1093,7 +1093,7 @@
         // first, pretend that wifi network comes online. no policy active,
         // which means we shouldn't push limit to interface.
         snapshots = List.of(buildWifi());
-        when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
+        when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
 
         mPolicyListener.expect().onMeteredIfacesChanged(any());
         mServiceContext.sendBroadcast(new Intent(CONNECTIVITY_ACTION));
@@ -1101,7 +1101,7 @@
 
         // now change cycle to be on 15th, and test in early march, to verify we
         // pick cycle day in previous month.
-        when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
+        when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
 
         // pretend that 512 bytes total have happened
         stats = new NetworkStats(getElapsedRealtime(), 1)
@@ -1362,7 +1362,7 @@
                 .insertEntry(TEST_IFACE, 0L, 0L, 0L, 0L);
 
         {
-            when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
+            when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
             when(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15,
                     currentTimeMillis())).thenReturn(stats.getTotalBytes());
 
@@ -1485,7 +1485,7 @@
     }
 
     private PersistableBundle setupUpdateMobilePolicyCycleTests() throws RemoteException {
-        when(mConnManager.getAllNetworkStateSnapshot())
+        when(mConnManager.getAllNetworkStateSnapshots())
                 .thenReturn(new ArrayList<NetworkStateSnapshot>());
 
         setupTelephonySubscriptionManagers(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
@@ -1498,7 +1498,7 @@
 
     @Test
     public void testUpdateMobilePolicyCycleWithNullConfig() throws RemoteException {
-        when(mConnManager.getAllNetworkStateSnapshot())
+        when(mConnManager.getAllNetworkStateSnapshots())
                 .thenReturn(new ArrayList<NetworkStateSnapshot>());
 
         setupTelephonySubscriptionManagers(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
@@ -2089,7 +2089,7 @@
                 TEST_NETWORK,
                 buildNetworkCapabilities(TEST_SUB_ID, roaming),
                 buildLinkProperties(TEST_IFACE), TEST_IMSI, TYPE_MOBILE));
-        when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
+        when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
     }
 
     private void expectDefaultCarrierConfig() throws Exception {
diff --git a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
index 7709edb..6c1e915b 100644
--- a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
@@ -135,24 +135,41 @@
     private static final String PARENT_NOTIFICATION_CHANNEL_ID = "test";
     private static final long MILLIS_PER_MINUTE = 1000L * 60L;
 
-    @Mock private Context mContext;
-    @Mock private ShortcutServiceInternal mShortcutServiceInternal;
-    @Mock private UsageStatsManagerInternal mUsageStatsManagerInternal;
-    @Mock private PackageManagerInternal mPackageManagerInternal;
-    @Mock private NotificationManagerInternal mNotificationManagerInternal;
-    @Mock private UserManager mUserManager;
-    @Mock private PackageManager mPackageManager;
-    @Mock private TelephonyManager mTelephonyManager;
-    @Mock private TelecomManager mTelecomManager;
-    @Mock private ContentResolver mContentResolver;
-    @Mock private JobScheduler mJobScheduler;
-    @Mock private StatusBarNotification mStatusBarNotification;
-    @Mock private Notification mNotification;
-    @Mock private AlarmManager mAlarmManager;
+    @Mock
+    private Context mContext;
+    @Mock
+    private ShortcutServiceInternal mShortcutServiceInternal;
+    @Mock
+    private UsageStatsManagerInternal mUsageStatsManagerInternal;
+    @Mock
+    private PackageManagerInternal mPackageManagerInternal;
+    @Mock
+    private NotificationManagerInternal mNotificationManagerInternal;
+    @Mock
+    private UserManager mUserManager;
+    @Mock
+    private PackageManager mPackageManager;
+    @Mock
+    private TelephonyManager mTelephonyManager;
+    @Mock
+    private TelecomManager mTelecomManager;
+    @Mock
+    private ContentResolver mContentResolver;
+    @Mock
+    private JobScheduler mJobScheduler;
+    @Mock
+    private StatusBarNotification mStatusBarNotification;
+    @Mock
+    private Notification mNotification;
+    @Mock
+    private AlarmManager mAlarmManager;
 
-    @Captor private ArgumentCaptor<ShortcutChangeCallback> mShortcutChangeCallbackCaptor;
-    @Captor private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor;
-    @Captor private ArgumentCaptor<Integer> mQueryFlagsCaptor;
+    @Captor
+    private ArgumentCaptor<ShortcutChangeCallback> mShortcutChangeCallbackCaptor;
+    @Captor
+    private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor;
+    @Captor
+    private ArgumentCaptor<Integer> mQueryFlagsCaptor;
 
     private ScheduledExecutorService mExecutorService;
     private NotificationChannel mNotificationChannel;
@@ -556,6 +573,7 @@
                 TEST_SHORTCUT_ID_2,
                 buildPerson());
         mDataManager.addOrUpdateConversationInfo(shortcut2);
+        mLooper.dispatchAll();
         ConversationChannel conversationChannel2 = mDataManager.getConversation(TEST_PKG_NAME,
                 USER_ID_PRIMARY,
                 TEST_SHORTCUT_ID_2);
@@ -583,6 +601,7 @@
         ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
                 buildPerson());
         mDataManager.addOrUpdateConversationInfo(shortcut);
+        mLooper.dispatchAll();
         PeopleService.ConversationsListener listener = mock(
                 PeopleService.ConversationsListener.class);
         mDataManager.addConversationsListener(listener);
@@ -631,7 +650,7 @@
     public void testGetConversation() {
         mDataManager.onUserUnlocked(USER_ID_PRIMARY);
         assertThat(mDataManager.getConversation(TEST_PKG_NAME, USER_ID_PRIMARY,
-            TEST_SHORTCUT_ID)).isNull();
+                TEST_SHORTCUT_ID)).isNull();
 
         ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
                 buildPerson());
@@ -781,16 +800,25 @@
     @Test
     public void testShortcutAddedOrUpdated() {
         mDataManager.onUserUnlocked(USER_ID_PRIMARY);
+        PeopleService.ConversationsListener listener = mock(
+                PeopleService.ConversationsListener.class);
+        mDataManager.addConversationsListener(listener);
 
         ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
                 buildPerson());
         mShortcutChangeCallback.onShortcutsAddedOrUpdated(TEST_PKG_NAME,
                 Collections.singletonList(shortcut), UserHandle.of(USER_ID_PRIMARY));
+        mLooper.dispatchAll();
 
         List<ConversationInfo> conversations = getConversationsInPrimary();
 
         assertEquals(1, conversations.size());
         assertEquals(TEST_SHORTCUT_ID, conversations.get(0).getShortcutId());
+        ArgumentCaptor<List<ConversationChannel>> capturedConversation = ArgumentCaptor.forClass(
+                List.class);
+        verify(listener, times(1)).onConversationsUpdate(capturedConversation.capture());
+        ConversationChannel result = Iterables.getOnlyElement(capturedConversation.getValue());
+        assertEquals(result.getShortcutInfo().getId(), TEST_SHORTCUT_ID);
     }
 
     @Test
@@ -978,8 +1006,13 @@
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs1);
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs2);
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs3);
+        mLooper.dispatchAll();
 
+        PeopleService.ConversationsListener listener = mock(
+                PeopleService.ConversationsListener.class);
+        mDataManager.addConversationsListener(listener);
         mDataManager.pruneDataForUser(USER_ID_PRIMARY, mCancellationSignal);
+        mLooper.dispatchAll();
 
         assertThat(mDataManager.getStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID))
                 .doesNotContain(cs1);
@@ -987,6 +1020,13 @@
                 .contains(cs2);
         assertThat(mDataManager.getStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID))
                 .contains(cs3);
+        ArgumentCaptor<List<ConversationChannel>> capturedConversation = ArgumentCaptor.forClass(
+                List.class);
+        verify(listener, times(1)).onConversationsUpdate(capturedConversation.capture());
+        List<ConversationChannel> results = capturedConversation.getValue();
+        ConversationChannel result = Iterables.getOnlyElement(capturedConversation.getValue());
+        // CHeck cs1 has been removed and only cs2 and cs3 remain.
+        assertThat(result.getStatuses()).containsExactly(cs2, cs3);
     }
 
     @Test
@@ -1236,13 +1276,23 @@
         ConversationStatus cs2 = new ConversationStatus.Builder("id2", ACTIVITY_GAME).build();
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs);
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs2);
+        mLooper.dispatchAll();
 
+        PeopleService.ConversationsListener listener = mock(
+                PeopleService.ConversationsListener.class);
+        mDataManager.addConversationsListener(listener);
         mDataManager.clearStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs2.getId());
+        mLooper.dispatchAll();
 
         assertThat(mDataManager.getStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID))
                 .contains(cs);
         assertThat(mDataManager.getStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID))
                 .doesNotContain(cs2);
+        ArgumentCaptor<List<ConversationChannel>> capturedConversation = ArgumentCaptor.forClass(
+                List.class);
+        verify(listener, times(1)).onConversationsUpdate(capturedConversation.capture());
+        ConversationChannel result = Iterables.getOnlyElement(capturedConversation.getValue());
+        assertThat(result.getStatuses()).containsExactly(cs);
     }
 
     @Test
@@ -1257,11 +1307,21 @@
         ConversationStatus cs2 = new ConversationStatus.Builder("id2", ACTIVITY_GAME).build();
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs);
         mDataManager.addOrUpdateStatus(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID, cs2);
+        mLooper.dispatchAll();
 
+        PeopleService.ConversationsListener listener = mock(
+                PeopleService.ConversationsListener.class);
+        mDataManager.addConversationsListener(listener);
         mDataManager.clearStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID);
+        mLooper.dispatchAll();
 
         assertThat(mDataManager.getStatuses(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID))
                 .isEmpty();
+        ArgumentCaptor<List<ConversationChannel>> capturedConversation = ArgumentCaptor.forClass(
+                List.class);
+        verify(listener, times(1)).onConversationsUpdate(capturedConversation.capture());
+        ConversationChannel result = Iterables.getOnlyElement(capturedConversation.getValue());
+        assertThat(result.getStatuses()).isEmpty();
     }
 
     @Test
@@ -1403,7 +1463,7 @@
                 .setLongLived(true)
                 .setIntent(new Intent("TestIntent"));
         if (person != null) {
-            builder.setPersons(new Person[] {person});
+            builder.setPersons(new Person[]{person});
         }
         return builder.build();
     }
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 c11ac3a..6722fff 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
@@ -213,7 +213,7 @@
         mAssistants.loadDefaultsFromConfig();
         assertEquals(new ArraySet<>(Arrays.asList(oldDefaultComponent)),
                 mAssistants.getDefaultComponents());
-        assertNull(mAssistants.getDefaultFromConfig());
+        assertNull(mAssistants.mDefaultFromConfig);
 
         // Test loadDefaultFromConfig(false) only updates the mDefaultFromConfig
         when(mContext.getResources().getString(
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 37d7198..a810acc 100755
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -5753,11 +5753,12 @@
     }
 
     @Test
-    public void testNASSettingUpgrade_userSetNull_showOnBoarding() throws RemoteException {
+    public void testNASSettingUpgrade_userSetNull_noOnBoarding() throws RemoteException {
         ComponentName newDefaultComponent = ComponentName.unflattenFromString("package/Component1");
         TestableNotificationManagerService service = spy(mService);
         int userId = 11;
         setUsers(new int[]{userId});
+        when(mUm.getProfileIds(userId, false)).thenReturn(new int[]{userId});
         setNASMigrationDone(false, userId);
         when(mAssistants.getDefaultFromConfig())
                 .thenReturn(newDefaultComponent);
@@ -5766,29 +5767,29 @@
         when(mAssistants.hasUserSet(userId)).thenReturn(true);
 
         service.migrateDefaultNASShowNotificationIfNecessary();
-        assertFalse(service.isNASMigrationDone(userId));
-        verify(service, times(1)).createNASUpgradeNotification(eq(userId));
-        verify(mAssistants, times(0)).resetDefaultFromConfig();
+        assertTrue(service.isNASMigrationDone(userId));
+        verify(service, times(0)).createNASUpgradeNotification(eq(userId));
+        verify(mAssistants, times(1)).clearDefaults();
+    }
 
-        //Test user clear data before enable/disable from onboarding notification
-        ArrayMap<Boolean, ArrayList<ComponentName>> changedListeners =
-                generateResetComponentValues();
-        when(mListeners.resetComponents(anyString(), anyInt())).thenReturn(changedListeners);
-        ArrayMap<Boolean, ArrayList<ComponentName>> changes = new ArrayMap<>();
-        changes.put(true, new ArrayList(Arrays.asList(newDefaultComponent)));
-        changes.put(false, new ArrayList());
-        when(mAssistants.resetComponents(anyString(), anyInt())).thenReturn(changes);
+    @Test
+    public void testNASSettingUpgrade_userSetSameDefault_noOnBoarding() throws RemoteException {
+        ComponentName defaultComponent = ComponentName.unflattenFromString("package/Component1");
+        TestableNotificationManagerService service = spy(mService);
+        int userId = 11;
+        setUsers(new int[]{userId});
+        when(mUm.getProfileIds(userId, false)).thenReturn(new int[]{userId});
+        setNASMigrationDone(false, userId);
+        when(mAssistants.getDefaultFromConfig())
+                .thenReturn(defaultComponent);
+        when(mAssistants.getAllowedComponents(anyInt()))
+                .thenReturn(new ArrayList(Arrays.asList(defaultComponent)));
+        when(mAssistants.hasUserSet(userId)).thenReturn(true);
 
-        //Clear data
-        service.getBinderService().clearData("package", userId, false);
-        //Test migrate flow again
         service.migrateDefaultNASShowNotificationIfNecessary();
-
-        //The notification should be still there
-        assertFalse(service.isNASMigrationDone(userId));
-        verify(service, times(2)).createNASUpgradeNotification(eq(userId));
-        verify(mAssistants, times(0)).resetDefaultFromConfig();
-        assertEquals(null, service.getApprovedAssistant(userId));
+        assertTrue(service.isNASMigrationDone(userId));
+        verify(service, times(0)).createNASUpgradeNotification(eq(userId));
+        verify(mAssistants, times(1)).resetDefaultFromConfig();
     }
 
     @Test
@@ -5842,6 +5843,9 @@
         int userId1 = 11;
         int userId2 = 12;
         setUsers(new int[]{userId1, userId2});
+        when(mUm.getProfileIds(userId1, false)).thenReturn(new int[]{userId1});
+        when(mUm.getProfileIds(userId2, false)).thenReturn(new int[]{userId2});
+
         setNASMigrationDone(false, userId1);
         setNASMigrationDone(false, userId2);
         when(mAssistants.getDefaultComponents())
@@ -5868,6 +5872,43 @@
     }
 
     @Test
+    public void testNASSettingUpgrade_multiProfile() throws RemoteException {
+        ComponentName oldDefaultComponent = ComponentName.unflattenFromString("package/Component1");
+        ComponentName newDefaultComponent = ComponentName.unflattenFromString("package/Component2");
+        TestableNotificationManagerService service = spy(mService);
+        int userId1 = 11;
+        int userId2 = 12; //work profile
+        setUsers(new int[]{userId1, userId2});
+        when(mUm.isManagedProfile(userId2)).thenReturn(true);
+        when(mUm.getProfileIds(userId1, false)).thenReturn(new int[]{userId1, userId2});
+
+        setNASMigrationDone(false, userId1);
+        setNASMigrationDone(false, userId2);
+        when(mAssistants.getDefaultComponents())
+                .thenReturn(new ArraySet<>(Arrays.asList(oldDefaultComponent)));
+        when(mAssistants.getDefaultFromConfig())
+                .thenReturn(newDefaultComponent);
+        //Both profiles: need onboarding
+        when(mAssistants.getAllowedComponents(userId1))
+                .thenReturn(Arrays.asList(oldDefaultComponent));
+        when(mAssistants.getAllowedComponents(userId2))
+                .thenReturn(Arrays.asList(oldDefaultComponent));
+
+        when(mAssistants.hasUserSet(userId1)).thenReturn(true);
+        when(mAssistants.hasUserSet(userId2)).thenReturn(true);
+
+        service.migrateDefaultNASShowNotificationIfNecessary();
+        assertFalse(service.isNASMigrationDone(userId1));
+        assertFalse(service.isNASMigrationDone(userId2));
+
+        // only user1 get notification
+        verify(service, times(1)).createNASUpgradeNotification(eq(userId1));
+        verify(service, times(0)).createNASUpgradeNotification(eq(userId2));
+    }
+
+
+
+    @Test
     public void testNASSettingUpgrade_clearDataAfterMigrationIsDone() throws RemoteException {
         ComponentName defaultComponent = ComponentName.unflattenFromString("package/Component");
         TestableNotificationManagerService service = spy(mService);
@@ -5898,15 +5939,21 @@
     }
 
     @Test
-    public void testNASUpgradeNotificationDisableBroadcast() {
-        int userId = 11;
-        setUsers(new int[]{userId});
+    public void testNASUpgradeNotificationDisableBroadcast_multiProfile() {
+        int userId1 = 11;
+        int userId2 = 12;
+        setUsers(new int[]{userId1, userId2});
+        when(mUm.isManagedProfile(userId2)).thenReturn(true);
+        when(mUm.getProfileIds(userId1, false)).thenReturn(new int[]{userId1, userId2});
+
         TestableNotificationManagerService service = spy(mService);
-        setNASMigrationDone(false, userId);
+        setNASMigrationDone(false, userId1);
+        setNASMigrationDone(false, userId2);
 
-        simulateNASUpgradeBroadcast(ACTION_DISABLE_NAS, userId);
+        simulateNASUpgradeBroadcast(ACTION_DISABLE_NAS, userId1);
 
-        assertTrue(service.isNASMigrationDone(userId));
+        assertTrue(service.isNASMigrationDone(userId1));
+        assertTrue(service.isNASMigrationDone(userId2));
         // User disabled the NAS from notification, the default stored in xml should be null
         // rather than the new default
         verify(mAssistants, times(1)).clearDefaults();
@@ -5914,7 +5961,7 @@
 
         //No more notification after disabled
         service.migrateDefaultNASShowNotificationIfNecessary();
-        verify(service, times(0)).createNASUpgradeNotification(eq(userId));
+        verify(service, times(0)).createNASUpgradeNotification(anyInt());
     }
 
     @Test
@@ -5922,6 +5969,8 @@
         int userId1 = 11;
         int userId2 = 12;
         setUsers(new int[]{userId1, userId2});
+        when(mUm.getProfileIds(userId1, false)).thenReturn(new int[]{userId1});
+
         TestableNotificationManagerService service = spy(mService);
         setNASMigrationDone(false, userId1);
         setNASMigrationDone(false, userId2);
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 124f6dd..8cede6d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -2358,21 +2358,6 @@
     }
 
     @Test
-    public void testAddRemoveRace() {
-        registerTestStartingWindowOrganizer();
-        // There was once a race condition between adding and removing starting windows
-        final ActivityRecord appToken = new ActivityBuilder(mAtm).setCreateTask(true).build();
-        for (int i = 0; i < 1000; i++) {
-            appToken.addStartingWindow(mPackageName,
-                    android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
-                    false, false);
-            appToken.removeStartingWindow();
-            waitUntilHandlersIdle();
-            assertNoStartingWindow(appToken);
-        }
-    }
-
-    @Test
     public void testTransferStartingWindow() {
         registerTestStartingWindowOrganizer();
         final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true).build();
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
index 5d6a5c0..73404eb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
@@ -641,7 +641,6 @@
 
     @Test
     public void testVisibleTasks_excludedFromRecents() {
-        mRecentTasks.setOnlyTestVisibleRange();
         mRecentTasks.setParameters(-1 /* min */, 4 /* max */, -1 /* ms */);
 
         Task excludedTask1 = createTaskBuilder(".ExcludedTask1")
@@ -650,15 +649,26 @@
         Task excludedTask2 = createTaskBuilder(".ExcludedTask2")
                 .setFlags(FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
                 .build();
+        Task detachedExcludedTask = createTaskBuilder(".DetachedExcludedTask")
+                .setFlags(FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
+                .build();
 
+        // Move home to front so other task can satisfy the condition in RecentTasks#isTrimmable.
+        mRootWindowContainer.getDefaultTaskDisplayArea().getRootHomeTask().moveToFront("test");
+        // Avoid Task#autoRemoveFromRecents when removing from parent.
+        detachedExcludedTask.setHasBeenVisible(true);
+        detachedExcludedTask.removeImmediately();
+        assertFalse(detachedExcludedTask.isAttached());
+
+        mRecentTasks.add(detachedExcludedTask);
         mRecentTasks.add(excludedTask1);
         mRecentTasks.add(mTasks.get(0));
         mRecentTasks.add(mTasks.get(1));
         mRecentTasks.add(mTasks.get(2));
         mRecentTasks.add(excludedTask2);
 
-        // The last excluded task should be trimmed, while the first-most excluded task should not
-        triggerTrimAndAssertTrimmed(excludedTask1);
+        // Except the first-most excluded task, other excluded tasks should be trimmed.
+        triggerTrimAndAssertTrimmed(excludedTask1, detachedExcludedTask);
     }
 
     @Test
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 153fd3a..23d57b8 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -518,6 +518,7 @@
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, false);
         verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
+        verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
 
         final WindowContainer parent = navToken.getParent();
         final NavBarFadeAnimationController navBarFadeAnimationController =
@@ -526,6 +527,7 @@
         mController.cleanupAnimation(REORDER_MOVE_TO_TOP);
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, true);
+        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
         verify(transaction).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl());
         verify(navBarFadeAnimationController).fadeWindowToken(true);
     }
@@ -543,6 +545,7 @@
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, false);
         verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
+        verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
 
         final WindowContainer parent = navToken.getParent();
         final NavBarFadeAnimationController navBarFadeAnimationController =
@@ -551,6 +554,7 @@
         mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, true);
+        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
         verify(transaction).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl());
         verify(navBarFadeAnimationController, never()).fadeWindowToken(anyBoolean());
     }
@@ -579,6 +583,7 @@
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, false);
         verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
+        verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
 
         final WindowContainer parent = navToken.getParent();
         final NavBarFadeAnimationController navBarFadeAnimationController =
@@ -591,6 +596,7 @@
         mController.cleanupAnimation(REORDER_MOVE_TO_TOP);
         verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
                 mDefaultDisplay.mDisplayId, true);
+        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
         verify(mockController).setOnShowRunnable(any());
         verify(transaction, times(0)).reparent(navToken.getSurfaceControl(),
                 parent.getSurfaceControl());
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
index 6f701f7..ba7aaab 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java
@@ -24,6 +24,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.content.ComponentName;
+import android.content.ContentCaptureOptions;
 import android.content.Context;
 import android.content.Intent;
 import android.hardware.soundtrigger.IRecognitionStatusCallback;
@@ -34,10 +35,12 @@
 import android.media.AudioRecord;
 import android.media.MediaRecorder;
 import android.os.Bundle;
+import android.os.IBinder;
 import android.os.IRemoteCallback;
 import android.os.ParcelFileDescriptor;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
+import android.os.ServiceManager;
 import android.os.SharedMemory;
 import android.service.voice.HotwordDetectedResult;
 import android.service.voice.HotwordDetectionService;
@@ -47,6 +50,7 @@
 import android.service.voice.IMicrophoneHotwordDetectionVoiceInteractionCallback;
 import android.util.Pair;
 import android.util.Slog;
+import android.view.contentcapture.IContentCaptureManager;
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.IHotwordRecognitionStatusCallback;
@@ -135,6 +139,7 @@
             return;
         }
         updateStateWithCallbackLocked(options, sharedMemory, callback);
+        updateContentCaptureManager();
     }
 
     private void updateStateWithCallbackLocked(PersistableBundle options,
@@ -193,6 +198,15 @@
                 });
     }
 
+    private void updateContentCaptureManager() {
+        IBinder b = ServiceManager
+                .getService(Context.CONTENT_CAPTURE_MANAGER_SERVICE);
+        IContentCaptureManager binderService = IContentCaptureManager.Stub.asInterface(b);
+        mRemoteHotwordDetectionService.post(
+                service -> service.updateContentCaptureManager(binderService,
+                        new ContentCaptureOptions(null)));
+    }
+
     private boolean isBound() {
         synchronized (mLock) {
             return mBound;
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 4886789..1953af4 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1011,6 +1011,7 @@
      * Enable READ_PHONE_STATE protection on APIs querying and notifying call state, such as
      * {@code TelecomManager#getCallState}, {@link TelephonyManager#getCallStateForSubscription()},
      * and {@link android.telephony.TelephonyCallback.CallStateListener}.
+     * @hide
      */
     @ChangeId
     @EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index 96e715e..1d7a476 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -62,6 +62,7 @@
         switch (transportType) {
             case TRANSPORT_TYPE_WWAN: return "WWAN";
             case TRANSPORT_TYPE_WLAN: return "WLAN";
+            case TRANSPORT_TYPE_INVALID: return "INVALID";
             default: return Integer.toString(transportType);
         }
     }
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index b914972..8b9fc0f 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -4216,7 +4216,6 @@
          * it will override the framework default.
          * @hide
          */
-        @SystemApi
         public static final String KEY_PUBLISH_SERVICE_DESC_FEATURE_TAG_MAP_OVERRIDE_STRING_ARRAY =
                 KEY_PREFIX + "publish_service_desc_feature_tag_map_override_string_array";
 
diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java
index bde62fb..ac01afa 100644
--- a/telephony/java/android/telephony/CellSignalStrengthNr.java
+++ b/telephony/java/android/telephony/CellSignalStrengthNr.java
@@ -134,7 +134,7 @@
      *
      * Range [0, 15] for each CQI.
      */
-    private List<Integer> mCsiCqiReport;;
+    private List<Integer> mCsiCqiReport;
     private int mSsRsrp;
     private int mSsRsrq;
     private int mSsSinr;
@@ -172,13 +172,13 @@
      * @hide
      */
     public CellSignalStrengthNr(int csiRsrp, int csiRsrq, int csiSinr, int csiCqiTableIndex,
-            List<Integer> csiCqiReport, int ssRsrp, int ssRsrq, int ssSinr) {
+            List<Byte> csiCqiReport, int ssRsrp, int ssRsrq, int ssSinr) {
         mCsiRsrp = inRangeOrUnavailable(csiRsrp, -140, -44);
         mCsiRsrq = inRangeOrUnavailable(csiRsrq, -20, -3);
         mCsiSinr = inRangeOrUnavailable(csiSinr, -23, 23);
         mCsiCqiTableIndex = inRangeOrUnavailable(csiCqiTableIndex, 1, 3);
-        mCsiCqiReport =  csiCqiReport.stream()
-                .map(cqi -> new Integer(inRangeOrUnavailable(cqi.intValue(), 1, 3)))
+        mCsiCqiReport = csiCqiReport.stream()
+                .map(cqi -> new Integer(inRangeOrUnavailable(Byte.toUnsignedInt(cqi), 1, 3)))
                 .collect(Collectors.toList());
         mSsRsrp = inRangeOrUnavailable(ssRsrp, -140, -44);
         mSsRsrq = inRangeOrUnavailable(ssRsrq, -43, 20);
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c525118..8475cab 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -10075,14 +10075,15 @@
 
     /**
      * Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not
-     * CDMA capable, this method does nothing.
+     * CDMA capable, this method throws an IllegalStateException.
      *
      * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
      * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
      *
      * @param mode CDMA roaming mode.
      * @throws SecurityException if the caller does not have the permission.
-     * @throws IllegalStateException if the Telephony process or radio is not currently available.
+     * @throws IllegalStateException if the Telephony process or radio is not currently available,
+     *         the device is not CDMA capable, or the request fails.
      *
      * @see #CDMA_ROAMING_MODE_RADIO_DEFAULT
      * @see #CDMA_ROAMING_MODE_HOME
@@ -10098,7 +10099,9 @@
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     public void setCdmaRoamingMode(@CdmaRoamingMode int mode) {
-        if (getPhoneType() != PHONE_TYPE_CDMA) return;
+        if (getPhoneType() != PHONE_TYPE_CDMA) {
+            throw new IllegalStateException("Phone does not support CDMA.");
+        }
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null) {
@@ -10180,11 +10183,12 @@
 
     /**
      * Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not
-     * CDMA capable, this method does nothing.
+     * CDMA capable, this method throws an IllegalStateException.
      *
      * @param mode CDMA subscription mode.
      * @throws SecurityException if the caller does not have the permission.
-     * @throws IllegalStateException if the Telephony process is not currently available.
+     * @throws IllegalStateException if the Telephony process or radio is not currently available,
+     *         the device is not CDMA capable, or the request fails.
      *
      * @see #CDMA_SUBSCRIPTION_UNKNOWN
      * @see #CDMA_SUBSCRIPTION_RUIM_SIM
@@ -10199,7 +10203,9 @@
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     public void setCdmaSubscriptionMode(@CdmaSubscription int mode) {
-        if (getPhoneType() != PHONE_TYPE_CDMA) return;
+        if (getPhoneType() != PHONE_TYPE_CDMA) {
+            throw new IllegalStateException("Phone does not support CDMA.");
+        }
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null) {
diff --git a/telephony/java/android/telephony/data/QosBearerFilter.java b/telephony/java/android/telephony/data/QosBearerFilter.java
index 6c1c653..5642549 100644
--- a/telephony/java/android/telephony/data/QosBearerFilter.java
+++ b/telephony/java/android/telephony/data/QosBearerFilter.java
@@ -31,7 +31,6 @@
 import java.util.List;
 import java.util.Objects;
 
-
 /**
  * Class that stores QOS filter parameters as defined in
  * 3gpp 24.008 10.5.6.12 and 3gpp 24.501 9.11.4.13.
diff --git a/telephony/java/android/telephony/data/TrafficDescriptor.java b/telephony/java/android/telephony/data/TrafficDescriptor.java
index d813bc5..f400a5e 100644
--- a/telephony/java/android/telephony/data/TrafficDescriptor.java
+++ b/telephony/java/android/telephony/data/TrafficDescriptor.java
@@ -21,6 +21,7 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import java.util.Arrays;
 import java.util.Objects;
 
 /**
@@ -31,11 +32,11 @@
  */
 public final class TrafficDescriptor implements Parcelable {
     private final String mDnn;
-    private final String mOsAppId;
+    private final byte[] mOsAppId;
 
     private TrafficDescriptor(@NonNull Parcel in) {
         mDnn = in.readString();
-        mOsAppId = in.readString();
+        mOsAppId = in.createByteArray();
     }
 
     /**
@@ -45,14 +46,15 @@
      *
      * @hide
      */
-    public TrafficDescriptor(String dnn, String osAppId) {
+    public TrafficDescriptor(String dnn, byte[] osAppId) {
         mDnn = dnn;
         mOsAppId = osAppId;
     }
 
     /**
      * DNN stands for Data Network Name and represents an APN as defined in 3GPP TS 23.003.
-     * @return the DNN of this traffic descriptor.
+     * @return the DNN of this traffic descriptor if one is included by the network, null
+     * otherwise.
      */
     public @Nullable String getDataNetworkName() {
         return mDnn;
@@ -60,10 +62,11 @@
 
     /**
      * OsAppId is the app id as defined in 3GPP TS 24.526 Section 5.2, and it identifies a traffic
-     * category.
-     * @return the OS App ID of this traffic descriptor.
+     * category. It includes the OS Id component of the field as defined in the specs.
+     * @return the OS App ID of this traffic descriptor if one is included by the network, null
+     * otherwise.
      */
-    public @Nullable String getOsAppId() {
+    public @Nullable byte[] getOsAppId() {
         return mOsAppId;
     }
 
@@ -80,7 +83,7 @@
     @Override
     public void writeToParcel(@NonNull Parcel dest, int flags) {
         dest.writeString(mDnn);
-        dest.writeString(mOsAppId);
+        dest.writeByteArray(mOsAppId);
     }
 
     public static final @NonNull Parcelable.Creator<TrafficDescriptor> CREATOR =
@@ -101,7 +104,7 @@
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
         TrafficDescriptor that = (TrafficDescriptor) o;
-        return Objects.equals(mDnn, that.mDnn) && Objects.equals(mOsAppId, that.mOsAppId);
+        return Objects.equals(mDnn, that.mDnn) && Arrays.equals(mOsAppId, that.mOsAppId);
     }
 
     @Override
@@ -121,10 +124,12 @@
      *     .setDnn("")
      *     .build();
      * </code></pre>
+     *
+     * @hide
      */
     public static final class Builder {
         private String mDnn = null;
-        private String mOsAppId = null;
+        private byte[] mOsAppId = null;
 
         /**
          * Default constructor for Builder.
@@ -144,12 +149,12 @@
         }
 
         /**
-         * Set the OS App ID.
+         * Set the OS App ID (including OS Id as defind in the specs).
          *
          * @return The same instance of the builder.
          */
         @NonNull
-        public Builder setOsAppId(@NonNull String osAppId) {
+        public Builder setOsAppId(@NonNull byte[] osAppId) {
             this.mOsAppId = osAppId;
             return this;
         }
diff --git a/telephony/java/android/telephony/data/UrspRule.java b/telephony/java/android/telephony/data/UrspRule.java
index e2c47fd..fbe1999 100644
--- a/telephony/java/android/telephony/data/UrspRule.java
+++ b/telephony/java/android/telephony/data/UrspRule.java
@@ -84,8 +84,8 @@
             android.hardware.radio.V1_6.TrafficDescriptor td) {
         String dnn = td.dnn.getDiscriminator() == OptionalDnn.hidl_discriminator.noinit
                 ? null : td.dnn.value();
-        String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
-                ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId));
+        byte[] osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
+                ? null : arrayListToPrimitiveArray(td.osAppId.value().osAppId);
         TrafficDescriptor.Builder builder = new TrafficDescriptor.Builder();
         if (dnn != null) {
             builder.setDataNetworkName(dnn);
diff --git a/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java b/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
index 8762b6a..0d63f7b 100644
--- a/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
+++ b/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
@@ -501,6 +501,10 @@
      * {@link SipMessage} was using the latest configuration during creation and not a stale
      * configuration due to race conditions between the configuration being updated and the RCS
      * application not receiving the updated configuration before generating a new message.
+     * <p>
+     * The version number should be a positive number that starts at 0 and increments sequentially
+     * as new {@link SipDelegateImsConfiguration} instances are created to update the IMS
+     * configuration state.
      *
      * @return the version number associated with this {@link SipDelegateImsConfiguration}.
      */
diff --git a/tests/net/common/java/ParseExceptionTest.kt b/tests/net/common/java/ParseExceptionTest.kt
new file mode 100644
index 0000000..f17715a
--- /dev/null
+++ b/tests/net/common/java/ParseExceptionTest.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+import android.net.ParseException
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import junit.framework.Assert.assertEquals
+import junit.framework.Assert.assertNull
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class ParseExceptionTest {
+    @Test
+    fun testConstructor_WithCause() {
+        val testMessage = "Test message"
+        val base = Exception("Test")
+        val exception = ParseException(testMessage, base)
+
+        assertEquals(testMessage, exception.response)
+        assertEquals(base, exception.cause)
+    }
+
+    @Test
+    fun testConstructor_NoCause() {
+        val testMessage = "Test message"
+        val exception = ParseException(testMessage)
+
+        assertEquals(testMessage, exception.response)
+        assertNull(exception.cause)
+    }
+}
\ No newline at end of file
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index b71be59..7ebed39 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -1791,7 +1791,7 @@
         assertNull(mCm.getActiveNetworkForUid(Process.myUid()));
         // Test getAllNetworks()
         assertEmpty(mCm.getAllNetworks());
-        assertEmpty(mCm.getAllNetworkStateSnapshot());
+        assertEmpty(mCm.getAllNetworkStateSnapshots());
     }
 
     /**
@@ -12016,7 +12016,7 @@
     }
 
     @Test
-    public void testGetAllNetworkStateSnapshot() throws Exception {
+    public void testGetAllNetworkStateSnapshots() throws Exception {
         verifyNoNetwork();
 
         // Setup test cellular network with specified LinkProperties and NetworkCapabilities,
@@ -12040,7 +12040,7 @@
         mCellNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_CELLULAR, cellLp, cellNcTemplate);
         mCellNetworkAgent.connect(true);
         cellCb.expectAvailableCallbacksUnvalidated(mCellNetworkAgent);
-        List<NetworkStateSnapshot> snapshots = mCm.getAllNetworkStateSnapshot();
+        List<NetworkStateSnapshot> snapshots = mCm.getAllNetworkStateSnapshots();
         assertLength(1, snapshots);
 
         // Compose the expected cellular snapshot for verification.
@@ -12062,7 +12062,7 @@
                 mWiFiNetworkAgent.getNetwork(), wifiNc, new LinkProperties(), null,
                 ConnectivityManager.TYPE_WIFI);
 
-        snapshots = mCm.getAllNetworkStateSnapshot();
+        snapshots = mCm.getAllNetworkStateSnapshots();
         assertLength(2, snapshots);
         assertContainsAll(snapshots, cellSnapshot, wifiSnapshot);
 
@@ -12071,20 +12071,20 @@
         //  temporary shortage of connectivity of a connected network.
         mCellNetworkAgent.suspend();
         waitForIdle();
-        snapshots = mCm.getAllNetworkStateSnapshot();
+        snapshots = mCm.getAllNetworkStateSnapshots();
         assertLength(1, snapshots);
         assertEquals(wifiSnapshot, snapshots.get(0));
 
         // Disconnect wifi, verify the snapshots contain nothing.
         mWiFiNetworkAgent.disconnect();
         waitForIdle();
-        snapshots = mCm.getAllNetworkStateSnapshot();
+        snapshots = mCm.getAllNetworkStateSnapshots();
         assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
         assertLength(0, snapshots);
 
         mCellNetworkAgent.resume();
         waitForIdle();
-        snapshots = mCm.getAllNetworkStateSnapshot();
+        snapshots = mCm.getAllNetworkStateSnapshots();
         assertLength(1, snapshots);
         assertEquals(cellSnapshot, snapshots.get(0));
 
diff --git a/tests/vcn/java/android/net/vcn/VcnControlPlaneIkeConfigTest.java b/tests/vcn/java/android/net/vcn/VcnControlPlaneIkeConfigTest.java
index 2333718..43b80e4 100644
--- a/tests/vcn/java/android/net/vcn/VcnControlPlaneIkeConfigTest.java
+++ b/tests/vcn/java/android/net/vcn/VcnControlPlaneIkeConfigTest.java
@@ -22,12 +22,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
 
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.Network;
 import android.net.ipsec.ike.ChildSaProposal;
 import android.net.ipsec.ike.IkeFqdnIdentification;
 import android.net.ipsec.ike.IkeSaProposal;
@@ -56,20 +51,13 @@
                         .addPseudorandomFunction(PSEUDORANDOM_FUNCTION_AES128_XCBC)
                         .build();
 
-        Context mockContext = mock(Context.class);
-        ConnectivityManager mockConnectManager = mock(ConnectivityManager.class);
-        doReturn(mockConnectManager)
-                .when(mockContext)
-                .getSystemService(Context.CONNECTIVITY_SERVICE);
-        doReturn(mock(Network.class)).when(mockConnectManager).getActiveNetwork();
-
         final String serverHostname = "192.0.2.100";
         final String testLocalId = "test.client.com";
         final String testRemoteId = "test.server.com";
         final byte[] psk = "psk".getBytes();
 
         IKE_PARAMS =
-                new IkeSessionParams.Builder(mockContext)
+                new IkeSessionParams.Builder()
                         .setServerHostname(serverHostname)
                         .addSaProposal(ikeProposal)
                         .setLocalIdentification(new IkeFqdnIdentification(testLocalId))
diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java
index bfe8c73..acc8bf9 100644
--- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java
+++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java
@@ -58,8 +58,7 @@
                 ArgumentCaptor.forClass(IkeSessionParams.class);
         verify(mDeps).newIkeSession(any(), paramsCaptor.capture(), any(), any(), any());
         assertEquals(
-                TEST_UNDERLYING_NETWORK_RECORD_1.network,
-                paramsCaptor.getValue().getConfiguredNetwork());
+                TEST_UNDERLYING_NETWORK_RECORD_1.network, paramsCaptor.getValue().getNetwork());
     }
 
     @Test