Merge "Run `RepositionFixedPortraitAppTest` in both orientations" into main
diff --git a/Android.bp b/Android.bp
index 811755d..d4776f5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -170,12 +170,6 @@
         //same purpose.
         "//external/robolectric:__subpackages__",
         "//frameworks/layoutlib:__subpackages__",
-
-        // This is for the same purpose as robolectric -- to build "framework.jar" for host-side
-        // testing.
-        // TODO: Once Ravenwood is stable, move the host side jar targets to this directory,
-        // and remove this line.
-        "//frameworks/base/tools/hoststubgen:__subpackages__",
     ],
 }
 
diff --git a/Ravenwood.bp b/Ravenwood.bp
index ec58210..2e038e0 100644
--- a/Ravenwood.bp
+++ b/Ravenwood.bp
@@ -12,256 +12,19 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// We need this "trampoline" rule to force soong to give a host-side jar to
-// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
-// a dex jar.
-java_library {
-    name: "framework-minus-apex-for-hoststubgen",
-    installable: false, // host only jar.
-    static_libs: [
-        "framework-minus-apex",
-    ],
-    sdk_version: "core_platform",
-    visibility: ["//visibility:private"],
-}
-
-// Process framework-all with hoststubgen for Ravenwood.
-// This step takes several tens of seconds, so we manually shard it to multiple modules.
-// All the copies have to be kept in sync.
-// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
-// making a better build rule.
-
-genrule_defaults {
-    name: "framework-minus-apex.ravenwood-base_defaults",
-    defaults: ["ravenwood-internal-only-visibility-genrule"],
-    tools: ["hoststubgen"],
-    srcs: [
-        ":framework-minus-apex-for-hoststubgen",
-        ":ravenwood-framework-policies",
-        ":ravenwood-standard-options",
-        ":ravenwood-annotation-allowed-classes",
-    ],
-    out: [
-        "ravenwood.jar",
-        "hoststubgen_framework-minus-apex.log",
-    ],
-}
-
-framework_minus_apex_cmd = "$(location hoststubgen) " +
-    "@$(location :ravenwood-standard-options) " +
-    "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
-    "--out-jar $(location ravenwood.jar) " +
-    "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
-    "--policy-override-file $(location :ravenwood-framework-policies) " +
-    "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X0",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X1",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X2",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X3",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X4",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X5",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X6",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X7",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X8",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
-}
-
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_X9",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
-}
-
-// Build framework-minus-apex.ravenwood-base without sharding.
-// We extract the various dump files from this one, rather than the sharded ones, because
-// some dumps use the output from other classes (e.g. base classes) which may not be in the
-// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
-// the output contains the information from all the input classes, rather than the output classes.
-// Not using sharding is fine for this module because it's only used for collecting the
-// dump / stats files, which don't have to happen regularly.
-java_genrule {
-    name: "framework-minus-apex.ravenwood-base_all",
-    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
-    cmd: framework_minus_apex_cmd +
-        "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
-        "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
-        "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
-        "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
-
-    out: [
-        "hoststubgen_framework-minus-apex_keep_all.txt",
-        "hoststubgen_framework-minus-apex_dump.txt",
-        "hoststubgen_framework-minus-apex_stats.csv",
-        "hoststubgen_framework-minus-apex_apis.csv",
-    ],
-}
-
-// Marge all the sharded jars
-java_genrule {
-    name: "framework-minus-apex.ravenwood",
-    defaults: ["ravenwood-internal-only-visibility-java"],
-    cmd: "$(location merge_zips) $(out) $(in)",
-    tools: ["merge_zips"],
-    srcs: [
-        ":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
-        ":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
-    ],
-    out: [
-        "framework-minus-apex.ravenwood.jar",
-    ],
-}
+// "framework-minus-apex" and "all-updatable-modules-system-stubs" are not
+// visible publicly. We re-export them to Ravenwood in this file.
 
 java_library {
-    name: "services.core-for-hoststubgen",
-    installable: false, // host only jar.
-    static_libs: [
-        "services.core",
-    ],
-    sdk_version: "core_platform",
-    visibility: ["//visibility:private"],
-}
-
-java_genrule {
-    name: "services.core.ravenwood-base",
-    tools: ["hoststubgen"],
-    cmd: "$(location hoststubgen) " +
-        "@$(location :ravenwood-standard-options) " +
-
-        "--debug-log $(location hoststubgen_services.core.log) " +
-        "--stats-file $(location hoststubgen_services.core_stats.csv) " +
-        "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
-
-        "--out-jar $(location ravenwood.jar) " +
-
-        "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
-        "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
-
-        "--in-jar $(location :services.core-for-hoststubgen) " +
-        "--policy-override-file $(location :ravenwood-services-policies) " +
-        "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
-    srcs: [
-        ":services.core-for-hoststubgen",
-        ":ravenwood-services-policies",
-        ":ravenwood-standard-options",
-        ":ravenwood-annotation-allowed-classes",
-    ],
-    out: [
-        "ravenwood.jar",
-
-        // Following files are created just as FYI.
-        "hoststubgen_services.core_keep_all.txt",
-        "hoststubgen_services.core_dump.txt",
-
-        "hoststubgen_services.core.log",
-        "hoststubgen_services.core_stats.csv",
-        "hoststubgen_services.core_apis.csv",
-    ],
-    defaults: ["ravenwood-internal-only-visibility-genrule"],
-}
-
-java_genrule {
-    name: "services.core.ravenwood",
-    defaults: ["ravenwood-internal-only-visibility-genrule"],
-    cmd: "cp $(in) $(out)",
-    srcs: [
-        ":services.core.ravenwood-base{ravenwood.jar}",
-    ],
-    out: [
-        "services.core.ravenwood.jar",
-    ],
-}
-
-// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
-// but services.core.ravenwood has complex dependencies, so it'll take more than
-// just using hoststubgen "rename"s.
-java_library {
-    name: "services.core.ravenwood-jarjar",
-    defaults: ["ravenwood-internal-only-visibility-java"],
+    name: "framework-minus-apex-for-host",
     installable: false,
-    static_libs: [
-        "services.core.ravenwood",
-    ],
-    jarjar_rules: ":ravenwood-services-jarjar-rules",
+    static_libs: ["framework-minus-apex"],
+    visibility: ["//frameworks/base/ravenwood"],
 }
 
-// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
-// Rename some of the dependencies to make sure they're included in the intended order.
 java_library {
-    name: "100-framework-minus-apex.ravenwood",
-    defaults: ["ravenwood-internal-only-visibility-java"],
-    static_libs: [
-        "framework-minus-apex.ravenwood",
-    ],
-    sdk_version: "core_platform",
-    // See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename.
-    // jarjar_rules: ":ravenwood-framework-jarjar-rules",
-}
-
-java_genrule {
-    // Use 200 to make sure it comes before the mainline stub ("all-updatable...").
-    name: "200-kxml2-android",
-    defaults: ["ravenwood-internal-only-visibility-genrule"],
-    cmd: "cp $(in) $(out)",
-    srcs: [":kxml2-android"],
-    out: ["200-kxml2-android.jar"],
-}
-
-java_genrule {
-    name: "z00-all-updatable-modules-system-stubs",
-    defaults: ["ravenwood-internal-only-visibility-genrule"],
-    cmd: "cp $(in) $(out)",
-    srcs: [":all-updatable-modules-system-stubs"],
-    out: ["z00-all-updatable-modules-system-stubs.jar"],
+    name: "all-updatable-modules-system-stubs-for-host",
+    installable: false,
+    static_libs: ["all-updatable-modules-system-stubs"],
+    visibility: ["//frameworks/base/ravenwood"],
 }
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index bc7ebce..8b33417 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -115,6 +115,7 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.ContrastColorUtil;
 import com.android.internal.util.NotificationBigTextNormalizer;
+import com.android.internal.widget.NotificationProgressModel;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -7318,12 +7319,16 @@
          */
         @VisibleForTesting
         public static int ensureButtonFillContrast(int color, int bg) {
-            return isColorDark(bg)
-                    ? ContrastColorUtil.findContrastColorAgainstDark(color, bg, true, 1.3)
-                    : ContrastColorUtil.findContrastColor(color, bg, true, 1.3);
+            return ensureColorContrast(color, bg, 1.3);
         }
 
 
+        private static int ensureColorContrast(int color, int bg, double contrastRatio) {
+            return isColorDark(bg)
+                    ? ContrastColorUtil.findContrastColorAgainstDark(color, bg, true, contrastRatio)
+                    : ContrastColorUtil.findContrastColor(color, bg, true, contrastRatio);
+        }
+
         /**
          * @return Whether we are currently building a notification from a legacy (an app that
          *         doesn't create material notifications by itself) app.
@@ -11657,6 +11662,7 @@
             StandardTemplateParams p = mBuilder.mParams.reset()
                     .viewType(StandardTemplateParams.VIEW_TYPE_BIG)
                     .allowTextWithProgress(true)
+                    .hideProgress(true)
                     .fillTextsFrom(mBuilder);
 
             // Replace the text with the big text, but only if the big text is not empty.
@@ -11678,10 +11684,28 @@
                 contentView.setViewVisibility(R.id.notification_progress_end_icon, View.GONE);
             }
 
+            contentView.setViewVisibility(R.id.progress, View.VISIBLE);
+
+            final int backgroundColor = mBuilder.getColors(p).getBackgroundColor();
+            final int defaultProgressColor = mBuilder.getPrimaryAccentColor(p);
+            final NotificationProgressModel model = createProgressModel(
+                    defaultProgressColor, backgroundColor);
+            contentView.setBundle(R.id.progress,
+                    "setProgressModel", model.toBundle());
+
+            if (mTrackerIcon != null) {
+                contentView.setIcon(R.id.progress,
+                        "setProgressTrackerIcon",
+                        mTrackerIcon);
+            }
+
             return contentView;
         }
 
-        private static @NonNull ArrayList<Bundle> getProgressSegmentsAsBundleList(
+        /**
+         * @hide
+         */
+        public static @NonNull ArrayList<Bundle> getProgressSegmentsAsBundleList(
                 @Nullable List<Segment> progressSegments) {
             final ArrayList<Bundle> segments = new ArrayList<>();
             if (progressSegments != null && !progressSegments.isEmpty()) {
@@ -11703,7 +11727,10 @@
             return segments;
         }
 
-        private static @NonNull List<Segment> getProgressSegmentsFromBundleList(
+        /**
+         * @hide
+         */
+        public  static @NonNull List<Segment> getProgressSegmentsFromBundleList(
                 @Nullable List<Bundle> segmentBundleList) {
             final ArrayList<Segment> segments = new ArrayList<>();
             if (segmentBundleList != null && !segmentBundleList.isEmpty()) {
@@ -11726,8 +11753,10 @@
 
             return segments;
         }
-
-        private static @NonNull ArrayList<Bundle> getProgressPointsAsBundleList(
+        /**
+         * @hide
+         */
+        public static @NonNull ArrayList<Bundle> getProgressPointsAsBundleList(
                 @Nullable List<Point> progressPoints) {
             final ArrayList<Bundle> points = new ArrayList<>();
             if (progressPoints != null && !progressPoints.isEmpty()) {
@@ -11749,7 +11778,10 @@
             return points;
         }
 
-        private static @NonNull List<Point> getProgressPointsFromBundleList(
+        /**
+         * @hide
+         */
+        public static @NonNull List<Point> getProgressPointsFromBundleList(
                 @Nullable List<Bundle> pointBundleList) {
             final ArrayList<Point> points = new ArrayList<>();
 
@@ -11771,6 +11803,78 @@
             return points;
         }
 
+        @NonNull
+        private NotificationProgressModel createProgressModel(int defaultProgressColor,
+                int backgroundColor) {
+            final NotificationProgressModel model;
+            if (mIndeterminate) {
+                final int indeterminateColor;
+                if (!mProgressSegments.isEmpty()) {
+                    indeterminateColor = mProgressSegments.get(0).mColor;
+                } else {
+                    indeterminateColor = defaultProgressColor;
+                }
+
+                model = new NotificationProgressModel(
+                        sanitizeProgressColor(indeterminateColor,
+                                backgroundColor, defaultProgressColor));
+            } else {
+
+                // Ensure segment color contrasts.
+                final List<Segment> segments = new ArrayList<>();
+                for (Segment segment : mProgressSegments) {
+                    segments.add(sanitizeSegment(segment, backgroundColor,
+                            defaultProgressColor));
+                }
+
+                // Create default segment when no segments are provided.
+                if (segments.isEmpty()) {
+                    segments.add(sanitizeSegment(new Segment(100), backgroundColor,
+                            defaultProgressColor));
+                }
+
+                // Ensure point color contrasts.
+                final List<Point> points = new ArrayList<>();
+                for (Point point : mProgressPoints) {
+                    points.add(sanitizePoint(point, backgroundColor, defaultProgressColor));
+                }
+
+                model = new NotificationProgressModel(segments, points,
+                        mProgress, mIsStyledByProgress);
+            }
+            return model;
+        }
+
+        private Segment sanitizeSegment(@NonNull Segment segment,
+                @ColorInt int bg,
+                @ColorInt int defaultColor) {
+            return new Segment(segment.getLength())
+                    .setId(segment.getId())
+                    .setColor(sanitizeProgressColor(segment.getColor(), bg, defaultColor));
+        }
+
+        private Point sanitizePoint(@NonNull Point point,
+                @ColorInt int bg,
+                @ColorInt int defaultColor) {
+            return new Point(point.getPosition()).setId(point.getId())
+                    .setColor(sanitizeProgressColor(point.getColor(), bg, defaultColor));
+        }
+
+        /**
+         * Finds steps and points fill color with sufficient contrast over bg (1.3:1) that
+         * has the same hue as the original color, but is lightened or darkened depending on
+         * whether the background is dark or light.
+         *
+         */
+        private int sanitizeProgressColor(@ColorInt int color,
+                @ColorInt int bg,
+                @ColorInt int defaultColor) {
+            return Builder.ensureColorContrast(
+                    Color.alpha(color) == 0 ? defaultColor : color,
+                    bg,
+                    1.3);
+        }
+
         /**
          * A segment of the progress bar, which defines its length and color.
          * Segments allow for creating progress bars with multiple colors or sections
diff --git a/core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java b/core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java
index fa77e79..cb21d1f 100644
--- a/core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java
+++ b/core/java/android/app/appfunctions/AppFunctionManagerConfiguration.java
@@ -20,7 +20,6 @@
 
 import android.annotation.NonNull;
 import android.content.Context;
-import android.content.pm.PackageManager;
 
 /**
  * Represents the system configuration of support for the {@code AppFunctionManager} and associated
@@ -29,15 +28,13 @@
  * @hide
  */
 public class AppFunctionManagerConfiguration {
-    private final Context mContext;
-
     /**
      * Constructs a new instance of {@code AppFunctionManagerConfiguration}.
      *
      * @param context context
      */
     public AppFunctionManagerConfiguration(@NonNull final Context context) {
-        mContext = context;
+        // Context can be used to access system features, etc.
     }
 
     /**
@@ -46,7 +43,7 @@
      * @return {@code true} if supported; otherwise {@code false}
      */
     public boolean isSupported() {
-        return enableAppFunctionManager() && !isWatch();
+        return enableAppFunctionManager();
     }
 
     /**
@@ -58,8 +55,4 @@
     public static boolean isSupported(@NonNull final Context context) {
         return new AppFunctionManagerConfiguration(context).isSupported();
     }
-
-    private boolean isWatch() {
-        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
-    }
 }
diff --git a/core/java/android/content/pm/multiuser.aconfig b/core/java/android/content/pm/multiuser.aconfig
index ff0a3dd..7de7131 100644
--- a/core/java/android/content/pm/multiuser.aconfig
+++ b/core/java/android/content/pm/multiuser.aconfig
@@ -68,6 +68,16 @@
 }
 
 flag {
+    name: "multiple_alarm_notifications_support"
+    namespace: "multiuser"
+    description: "Implement handling of multiple simultaneous alarms/timers on bg users"
+    bug: "367615180"
+    metadata {
+        purpose: PURPOSE_BUGFIX
+  }
+}
+
+flag {
     name: "enable_biometrics_to_unlock_private_space"
     is_exported: true
     namespace: "profile_experiences"
diff --git a/core/java/android/view/ImeInsetsSourceConsumer.java b/core/java/android/view/ImeInsetsSourceConsumer.java
index 229e8ee7..4f74198 100644
--- a/core/java/android/view/ImeInsetsSourceConsumer.java
+++ b/core/java/android/view/ImeInsetsSourceConsumer.java
@@ -221,13 +221,13 @@
 
     @Override
     public boolean setControl(@Nullable InsetsSourceControl control, int[] showTypes,
-            int[] hideTypes) {
+            int[] hideTypes, int[] cancelTypes) {
         if (Flags.refactorInsetsController()) {
-            return super.setControl(control, showTypes, hideTypes);
+            return super.setControl(control, showTypes, hideTypes, cancelTypes);
         } else {
             ImeTracing.getInstance().triggerClientDump("ImeInsetsSourceConsumer#setControl",
                     mController.getHost().getInputMethodManager(), null /* icProto */);
-            if (!super.setControl(control, showTypes, hideTypes)) {
+            if (!super.setControl(control, showTypes, hideTypes, cancelTypes)) {
                 return false;
             }
             if (control == null && !mIsRequestedVisibleAwaitingLeash) {
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index 97facc1..4fead2a 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -371,6 +371,7 @@
         mPendingInsets = mLayoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN
                 ? mShownInsets : mHiddenInsets;
         mPendingAlpha = 1f;
+        mPendingFraction = 1f;
         applyChangeInsets(null);
         mCancelled = true;
         mListener.onCancelled(mReadyDispatched ? this : null);
@@ -486,6 +487,17 @@
         if (controls == null) {
             return;
         }
+
+        final boolean visible = mPendingFraction == 0
+                // The first frame of ANIMATION_TYPE_SHOW should be invisible since it is
+                // animated from the hidden state.
+                ? mAnimationType != ANIMATION_TYPE_SHOW
+                : mPendingFraction < 1f || (mFinished
+                        ? mShownOnFinish
+                        // If the animation is cancelled, mFinished and mShownOnFinish are not set.
+                        // Here uses mLayoutInsetsDuringAnimation to decide if it should be visible.
+                        : mLayoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN);
+
         // TODO: Implement behavior when inset spans over multiple types
         for (int i = controls.size() - 1; i >= 0; i--) {
             final InsetsSourceControl control = controls.valueAt(i);
@@ -498,12 +510,6 @@
             }
             addTranslationToMatrix(side, offset, mTmpMatrix, mTmpFrame);
 
-            // The first frame of ANIMATION_TYPE_SHOW should be invisible since it is animated from
-            // the hidden state.
-            final boolean visible = mPendingFraction == 0
-                    ? mAnimationType != ANIMATION_TYPE_SHOW
-                    : !mFinished || mShownOnFinish;
-
             if (outState != null && source != null) {
                 outState.addSource(new InsetsSource(source)
                         .setVisible(visible)
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 8ac5532..d08873c 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -957,6 +957,7 @@
         int consumedControlCount = 0;
         final @InsetsType int[] showTypes = new int[1];
         final @InsetsType int[] hideTypes = new int[1];
+        final @InsetsType int[] cancelTypes = new int[1];
         ImeTracker.Token statsToken = null;
 
         // Ensure to update all existing source consumers
@@ -982,7 +983,7 @@
 
             // control may be null, but we still need to update the control to null if it got
             // revoked.
-            consumer.setControl(control, showTypes, hideTypes);
+            consumer.setControl(control, showTypes, hideTypes, cancelTypes);
         }
 
         // Ensure to create source consumers if not available yet.
@@ -990,7 +991,7 @@
             for (int i = mTmpControlArray.size() - 1; i >= 0; i--) {
                 final InsetsSourceControl control = mTmpControlArray.valueAt(i);
                 getSourceConsumer(control.getId(), control.getType())
-                        .setControl(control, showTypes, hideTypes);
+                        .setControl(control, showTypes, hideTypes, cancelTypes);
             }
         }
 
@@ -1002,6 +1003,10 @@
         }
         mTmpControlArray.clear();
 
+        if (cancelTypes[0] != 0) {
+            cancelExistingControllers(cancelTypes[0]);
+        }
+
         // Do not override any animations that the app started in the OnControllableInsetsChanged
         // listeners.
         int animatingTypes = invokeControllableInsetsChangedListeners();
@@ -2154,12 +2159,12 @@
                         new InsetsSourceControl(ID_IME_CAPTION_BAR, captionBar(),
                                 null /* leash */, false /* initialVisible */,
                                 new Point(), Insets.NONE),
-                        new int[1], new int[1]);
+                        new int[1], new int[1], new int[1]);
             } else {
                 mState.removeSource(ID_IME_CAPTION_BAR);
                 InsetsSourceConsumer sourceConsumer = mSourceConsumers.get(ID_IME_CAPTION_BAR);
                 if (sourceConsumer != null) {
-                    sourceConsumer.setControl(null, new int[1], new int[1]);
+                    sourceConsumer.setControl(null, new int[1], new int[1], new int[1]);
                 }
             }
             mHost.notifyInsetsChanged();
diff --git a/core/java/android/view/InsetsSourceConsumer.java b/core/java/android/view/InsetsSourceConsumer.java
index da788a7..17f33c1 100644
--- a/core/java/android/view/InsetsSourceConsumer.java
+++ b/core/java/android/view/InsetsSourceConsumer.java
@@ -122,7 +122,7 @@
 
     /**
      * Updates the control delivered from the server.
-
+     *
      * @param showTypes An integer array with a single entry that determines which types a show
      *                  animation should be run after setting the control.
      * @param hideTypes An integer array with a single entry that determines which types a hide
@@ -130,7 +130,7 @@
      * @return Whether the control has changed from the server
      */
     public boolean setControl(@Nullable InsetsSourceControl control,
-            @InsetsType int[] showTypes, @InsetsType int[] hideTypes) {
+            @InsetsType int[] showTypes, @InsetsType int[] hideTypes, int[] cancelTypes) {
         if (Objects.equals(mSourceControl, control)) {
             if (mSourceControl != null && mSourceControl != control) {
                 mSourceControl.release(SurfaceControl::release);
@@ -165,6 +165,12 @@
             // Reset the applier to the default one which has the most lightweight implementation.
             setSurfaceParamsApplier(InsetsAnimationControlRunner.SurfaceParamsApplier.DEFAULT);
         } else {
+            if (lastControl != null && InsetsSource.getInsetSide(lastControl.getInsetsHint())
+                    != InsetsSource.getInsetSide(control.getInsetsHint())) {
+                // The source has been moved to a different side. The coordinates are stale.
+                // Canceling existing animation if there is any.
+                cancelTypes[0] |= mType;
+            }
             final boolean requestedVisible = isRequestedVisibleAwaitingControl();
             final SurfaceControl oldLeash = lastControl != null ? lastControl.getLeash() : null;
             final SurfaceControl newLeash = control.getLeash();
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index 0c5c853..d34bca6 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -88,6 +88,13 @@
     }
 
     /**
+     * Amount of RAM that used by shared memory (shmem) and tmpfs
+     */
+    public long getShmemSizeKb() {
+        return mInfos[Debug.MEMINFO_SHMEM];
+    }
+
+    /**
      * Amount of RAM that the kernel is being used for caches, not counting caches
      * that are mapped in to processes.
      */
diff --git a/core/java/com/android/internal/widget/NotificationProgressBar.java b/core/java/com/android/internal/widget/NotificationProgressBar.java
index 12e1dd9..3e597d7 100644
--- a/core/java/com/android/internal/widget/NotificationProgressBar.java
+++ b/core/java/com/android/internal/widget/NotificationProgressBar.java
@@ -16,15 +16,22 @@
 
 package com.android.internal.widget;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.Notification.ProgressStyle;
 import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
+import android.os.Bundle;
 import android.util.AttributeSet;
+import android.view.RemotableViewMethod;
 import android.widget.ProgressBar;
 import android.widget.RemoteViews;
 
 import androidx.annotation.ColorInt;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.Preconditions;
 import com.android.internal.widget.NotificationProgressDrawable.Part;
 import com.android.internal.widget.NotificationProgressDrawable.Point;
 import com.android.internal.widget.NotificationProgressDrawable.Segment;
@@ -42,6 +49,10 @@
  */
 @RemoteViews.RemoteView
 public class NotificationProgressBar extends ProgressBar {
+    private NotificationProgressModel mProgressModel;
+    @Nullable
+    private Drawable mProgressTrackerDrawable = null;
+
     public NotificationProgressBar(Context context) {
         this(context, null);
     }
@@ -60,6 +71,53 @@
     }
 
     /**
+     * Setter for the notification progress model.
+     *
+     * @see NotificationProgressModel#fromBundle
+     * @see #setProgressModelAsync
+     */
+    @RemotableViewMethod(asyncImpl = "setProgressModelAsync")
+    public void setProgressModel(@Nullable Bundle bundle) {
+        Preconditions.checkArgument(bundle != null,
+                "Bundle shouldn't be null");
+
+        mProgressModel = NotificationProgressModel.fromBundle(bundle);
+    }
+
+    private void setProgressModel(@NonNull NotificationProgressModel model) {
+        mProgressModel = model;
+    }
+
+    /**
+     * Setter for the progress tracker icon.
+     *
+     * @see #setProgressTrackerIconAsync
+     */
+    @RemotableViewMethod(asyncImpl = "setProgressTrackerIconAsync")
+    public void setProgressTrackerIcon(@Nullable Icon icon) {
+    }
+
+
+    /**
+     * Async version of {@link #setProgressTrackerIcon}
+     */
+    public Runnable setProgressTrackerIconAsync(@Nullable Icon icon) {
+        final Drawable progressTrackerDrawable;
+        if (icon != null) {
+            progressTrackerDrawable = icon.loadDrawable(getContext());
+        } else {
+            progressTrackerDrawable = null;
+        }
+        return () -> {
+            setProgressTrackerDrawable(progressTrackerDrawable);
+        };
+    }
+
+    private void setProgressTrackerDrawable(@Nullable  Drawable drawable) {
+        mProgressTrackerDrawable = drawable;
+    }
+
+    /**
      * Processes the ProgressStyle data and convert to list of {@code
      * NotificationProgressDrawable.Part}.
      */
diff --git a/core/java/com/android/internal/widget/NotificationProgressModel.java b/core/java/com/android/internal/widget/NotificationProgressModel.java
new file mode 100644
index 0000000..e51ea99
--- /dev/null
+++ b/core/java/com/android/internal/widget/NotificationProgressModel.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.widget;
+
+
+import android.annotation.ColorInt;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
+import android.app.Flags;
+import android.app.Notification;
+import android.app.Notification.ProgressStyle.Point;
+import android.app.Notification.ProgressStyle.Segment;
+import android.graphics.Color;
+import android.os.Bundle;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Data model for {@link NotificationProgressBar}.
+ *
+ * This class holds the necessary data to render the notification progressbar.
+ * It is used to bind the progress style progress data to {@link NotificationProgressBar}.
+ *
+ * @hide
+ * @see NotificationProgressModel#toBundle
+ * @see NotificationProgressModel#fromBundle
+ */
+@FlaggedApi(Flags.FLAG_API_RICH_ONGOING)
+public final class NotificationProgressModel {
+    private static final int INVALID_INDETERMINATE_COLOR = Color.TRANSPARENT;
+    private static final String KEY_SEGMENTS = "segments";
+    private static final String KEY_POINTS = "points";
+    private static final String KEY_PROGRESS = "progress";
+    private static final String KEY_IS_STYLED_BY_PROGRESS = "isStyledByProgress";
+    private static final String KEY_INDETERMINATE_COLOR = "indeterminateColor";
+    private final List<Segment> mSegments;
+    private final List<Point> mPoints;
+    private final int mProgress;
+    private final boolean mIsStyledByProgress;
+    @ColorInt
+    private final int mIndeterminateColor;
+
+    public NotificationProgressModel(
+            @NonNull List<Segment> segments,
+            @NonNull List<Point> points,
+            int progress,
+            boolean isStyledByProgress
+    ) {
+        Preconditions.checkArgument(progress >= 0);
+        Preconditions.checkArgument(!segments.isEmpty());
+        mSegments = segments;
+        mPoints = points;
+        mProgress = progress;
+        mIsStyledByProgress = isStyledByProgress;
+        mIndeterminateColor = INVALID_INDETERMINATE_COLOR;
+    }
+
+    public NotificationProgressModel(
+            @ColorInt int indeterminateColor
+    ) {
+        Preconditions.checkArgument(indeterminateColor != INVALID_INDETERMINATE_COLOR);
+        mSegments = Collections.emptyList();
+        mPoints = Collections.emptyList();
+        mProgress = 0;
+        mIsStyledByProgress = false;
+        mIndeterminateColor = indeterminateColor;
+    }
+
+    public List<Segment> getSegments() {
+        return mSegments;
+    }
+
+    public List<Point> getPoints() {
+        return mPoints;
+    }
+
+    public int getProgress() {
+        return mProgress;
+    }
+
+    public boolean isStyledByProgress() {
+        return mIsStyledByProgress;
+    }
+
+    @ColorInt
+    public int getIndeterminateColor() {
+        return mIndeterminateColor;
+    }
+
+    public boolean isIndeterminate() {
+        return mIndeterminateColor != INVALID_INDETERMINATE_COLOR;
+    }
+
+    /**
+     * Returns a {@link Bundle} representation of this {@link NotificationProgressModel}.
+     */
+    @NonNull
+    public Bundle toBundle() {
+        final Bundle bundle = new Bundle();
+        if (mIndeterminateColor != INVALID_INDETERMINATE_COLOR) {
+            bundle.putInt(KEY_INDETERMINATE_COLOR, mIndeterminateColor);
+        } else {
+            bundle.putParcelableList(KEY_SEGMENTS,
+                    Notification.ProgressStyle.getProgressSegmentsAsBundleList(mSegments));
+            bundle.putParcelableList(KEY_POINTS,
+                    Notification.ProgressStyle.getProgressPointsAsBundleList(mPoints));
+            bundle.putInt(KEY_PROGRESS, mProgress);
+            bundle.putBoolean(KEY_IS_STYLED_BY_PROGRESS, mIsStyledByProgress);
+        }
+        return bundle;
+    }
+
+    /**
+     * Creates a {@link NotificationProgressModel} from a {@link Bundle}.
+     */
+    @NonNull
+    public static NotificationProgressModel fromBundle(@NonNull Bundle bundle) {
+        final int indeterminateColor = bundle.getInt(KEY_INDETERMINATE_COLOR,
+                INVALID_INDETERMINATE_COLOR);
+        if (indeterminateColor != INVALID_INDETERMINATE_COLOR) {
+            return new NotificationProgressModel(indeterminateColor);
+        } else {
+            final List<Segment> segments =
+                    Notification.ProgressStyle.getProgressSegmentsFromBundleList(
+                            bundle.getParcelableArrayList(KEY_SEGMENTS, Bundle.class));
+            final List<Point> points =
+                    Notification.ProgressStyle.getProgressPointsFromBundleList(
+                            bundle.getParcelableArrayList(KEY_POINTS, Bundle.class));
+            final int progress = bundle.getInt(KEY_PROGRESS);
+            final boolean isStyledByProgress = bundle.getBoolean(KEY_IS_STYLED_BY_PROGRESS);
+            return new NotificationProgressModel(segments, points, progress, isStyledByProgress);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "NotificationProgressModel{"
+                + "mSegments=" + mSegments
+                + ", mPoints=" + mPoints
+                + ", mProgress=" + mProgress
+                + ", mIsStyledByProgress=" + mIsStyledByProgress
+                + ", mIndeterminateColor=" + mIndeterminateColor + "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        final NotificationProgressModel that = (NotificationProgressModel) o;
+        return mProgress == that.mProgress
+                && mIsStyledByProgress == that.mIsStyledByProgress
+                && mIndeterminateColor == that.mIndeterminateColor
+                && Objects.equals(mSegments, that.mSegments)
+                && Objects.equals(mPoints, that.mPoints);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mSegments,
+                mPoints,
+                mProgress,
+                mIsStyledByProgress,
+                mIndeterminateColor);
+    }
+}
diff --git a/core/jni/platform/host/HostRuntime.cpp b/core/jni/platform/host/HostRuntime.cpp
index 27417c0..06621c9 100644
--- a/core/jni/platform/host/HostRuntime.cpp
+++ b/core/jni/platform/host/HostRuntime.cpp
@@ -20,7 +20,9 @@
 #include <android_runtime/AndroidRuntime.h>
 #include <jni_wrappers.h>
 #include <nativehelper/JNIHelp.h>
+#include <nativehelper/ScopedUtfChars.h>
 #include <nativehelper/jni_macros.h>
+#include <unicode/locid.h>
 #include <unicode/putil.h>
 #include <unicode/udata.h>
 
@@ -64,8 +66,8 @@
 };
 
 int register_libcore_util_NativeAllocationRegistry(JNIEnv* env) {
-    return jniRegisterNativeMethods(env, "libcore/util/NativeAllocationRegistry", gMethods,
-                                    NELEM(gMethods));
+    return android::RegisterMethodsOrDie(env, "libcore/util/NativeAllocationRegistry", gMethods,
+                                         NELEM(gMethods));
 }
 
 namespace android {
@@ -259,35 +261,67 @@
 #endif
 }
 
-// Loads the ICU data file from the location specified in the system property ro.icu.data.path
-static void loadIcuData() {
-    string icuPath = base::GetProperty("ro.icu.data.path", "");
-    if (!icuPath.empty()) {
-        // Set the location of ICU data
-        void* addr = mmapFile(icuPath.c_str());
-        UErrorCode err = U_ZERO_ERROR;
-        udata_setCommonData(addr, &err);
-        if (err != U_ZERO_ERROR) {
-            ALOGE("Unable to load ICU data\n");
-        }
-    }
-}
-
-static int register_android_core_classes(JNIEnv* env) {
+// returns result from java.lang.System.getProperty
+static string getJavaProperty(JNIEnv* env, const char* property_name) {
     jclass system = FindClassOrDie(env, "java/lang/System");
     jmethodID getPropertyMethod =
             GetStaticMethodIDOrDie(env, system, "getProperty",
                                    "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
 
-    // Get the names of classes that need to register their native methods
-    auto nativesClassesJString =
-            (jstring)env->CallStaticObjectMethod(system, getPropertyMethod,
-                                                 env->NewStringUTF("core_native_classes"),
-                                                 env->NewStringUTF(""));
-    const char* nativesClassesArray = env->GetStringUTFChars(nativesClassesJString, nullptr);
-    string nativesClassesString(nativesClassesArray);
+    auto jString = (jstring)env->CallStaticObjectMethod(system, getPropertyMethod,
+                                                        env->NewStringUTF(property_name),
+                                                        env->NewStringUTF(""));
+    ScopedUtfChars chars(env, jString);
+    return string(chars.c_str());
+}
+
+static void loadIcuData(string icuPath) {
+    void* addr = mmapFile(icuPath.c_str());
+    UErrorCode err = U_ZERO_ERROR;
+    udata_setCommonData(addr, &err);
+    if (err != U_ZERO_ERROR) {
+        ALOGE("Unable to load ICU data\n");
+    }
+}
+
+// Loads the ICU data file from the location specified in properties.
+// First try specified in the system property ro.icu.data.path,
+// then fallback to java property icu.data.path
+static void loadIcuData() {
+    JNIEnv* env = AndroidRuntime::getJNIEnv();
+    string icuPath = base::GetProperty("ro.icu.data.path", "");
+    if (!icuPath.empty()) {
+        loadIcuData(icuPath);
+    } else {
+        // fallback to read from java.lang.System.getProperty
+        string icuPathFromJava = getJavaProperty(env, "icu.data.path");
+        if (!icuPathFromJava.empty()) {
+            loadIcuData(icuPathFromJava);
+        }
+    }
+
+    // Check for the ICU default locale property. In Libcore, the default ICU
+    // locale is set when ICU.setDefaultLocale is called, which is called by
+    // Libcore's implemenentation of Java's Locale.setDefault. The default
+    // locale is used in cases such as when ucol_open(NULL, ...) is called, for
+    // example in SQLite's 'COLLATE UNICODE'.
+    string icuLocaleDefault = getJavaProperty(env, "icu.locale.default");
+    if (!icuLocaleDefault.empty()) {
+        UErrorCode status = U_ZERO_ERROR;
+        icu::Locale locale = icu::Locale::forLanguageTag(icuLocaleDefault.c_str(), status);
+        if (U_SUCCESS(status)) {
+            icu::Locale::setDefault(locale, status);
+        }
+        if (U_FAILURE(status)) {
+            fprintf(stderr, "Failed to set the ICU default locale to '%s' (error code %d)\n",
+                    icuLocaleDefault.c_str(), status);
+        }
+    }
+}
+
+static int register_android_core_classes(JNIEnv* env) {
+    string nativesClassesString = getJavaProperty(env, "core_native_classes");
     vector<string> classesToRegister = parseCsv(nativesClassesString);
-    env->ReleaseStringUTFChars(nativesClassesJString, nativesClassesArray);
 
     if (register_jni_procs(gRegJNIMap, classesToRegister, env) < 0) {
         return JNI_ERR;
@@ -359,6 +393,11 @@
 
 void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote) {
     JNIEnv* env = AndroidRuntime::getJNIEnv();
+
+    auto method_binding_format = getJavaProperty(env, "method_binding_format");
+
+    setJniMethodFormat(method_binding_format);
+
     // Register native functions.
     if (startReg(env) < 0) {
         ALOGE("Unable to register all android native methods\n");
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 549f8df..5693d66 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -155,6 +155,7 @@
 
     <protected-broadcast android:name="android.bluetooth.intent.DISCOVERABLE_TIMEOUT" />
     <protected-broadcast android:name="android.bluetooth.action.AUTO_ON_STATE_CHANGED" />
+    <protected-broadcast android:name="android.bluetooth.action.CONNECTION_STATE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.adapter.action.SCAN_MODE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED" />
@@ -240,6 +241,8 @@
     <protected-broadcast
         android:name="android.bluetooth.avrcp-controller.profile.action.FOLDER_LIST" />
     <protected-broadcast
+        android:name="android.bluetooth.avrcp-controller.profile.action.PLAYER_SETTING" />
+    <protected-broadcast
         android:name="android.bluetooth.avrcp-controller.profile.action.TRACK_EVENT" />
     <protected-broadcast
         android:name="android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED" />
@@ -266,6 +269,7 @@
     <protected-broadcast
         android:name="android.bluetooth.pan.profile.action.CONNECTION_STATE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.action.HAP_CONNECTION_STATE_CHANGED" />
+    <protected-broadcast android:name="android.bluetooth.action.HAP_DEVICE_AVAILABLE" />
     <protected-broadcast android:name="android.bluetooth.action.LE_AUDIO_CONNECTION_STATE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.action.LE_AUDIO_ACTIVE_DEVICE_CHANGED" />
     <protected-broadcast android:name="android.bluetooth.action.LE_AUDIO_CONF_CHANGED" />
diff --git a/core/res/res/layout/input_method_switch_dialog_new.xml b/core/res/res/layout/input_method_switch_dialog_new.xml
index 058fe3f..118f93b 100644
--- a/core/res/res/layout/input_method_switch_dialog_new.xml
+++ b/core/res/res/layout/input_method_switch_dialog_new.xml
@@ -39,7 +39,7 @@
                 android:id="@+id/list"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:paddingVertical="8dp"
+                android:paddingTop="8dp"
                 android:clipToPadding="false"
                 android:layoutManager="com.android.internal.widget.LinearLayoutManager"/>
 
@@ -74,8 +74,7 @@
             android:text="@string/input_method_switcher_settings_button"
             android:fontFamily="google-sans-text"
             android:textAppearance="?attr/textAppearance"
-            android:contentDescription="@string/input_method_language_settings"
-            android:visibility="gone"/>
+            android:contentDescription="@string/input_method_language_settings"/>
 
     </LinearLayout>
 
diff --git a/core/res/res/layout/input_method_switch_item_divider.xml b/core/res/res/layout/input_method_switch_item_divider.xml
new file mode 100644
index 0000000..4f8c963
--- /dev/null
+++ b/core/res/res/layout/input_method_switch_item_divider.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2024 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:layout_marginHorizontal="16dp"
+    android:layout_marginTop="8dp"
+    android:layout_marginBottom="16dp">
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="?attr/materialColorOutlineVariant"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="24dp"
+        android:importantForAccessibility="no"/>
+
+</LinearLayout>
diff --git a/core/res/res/layout/input_method_switch_item_header.xml b/core/res/res/layout/input_method_switch_item_header.xml
new file mode 100644
index 0000000..f0080a6
--- /dev/null
+++ b/core/res/res/layout/input_method_switch_item_header.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2024 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:layout_marginHorizontal="16dp"
+    android:layout_marginTop="4dp"
+    android:layout_marginBottom="16dp">
+
+    <TextView
+        android:id="@+id/header_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginHorizontal="8dp"
+        android:ellipsize="end"
+        android:singleLine="true"
+        android:fontFamily="google-sans-text"
+        android:textAppearance="?attr/textAppearance"
+        android:accessibilityHeading="true"
+        android:textColor="?attr/materialColorPrimary"/>
+
+</LinearLayout>
diff --git a/core/res/res/layout/input_method_switch_item_new.xml b/core/res/res/layout/input_method_switch_item_new.xml
index 10d938c..f8710cc 100644
--- a/core/res/res/layout/input_method_switch_item_new.xml
+++ b/core/res/res/layout/input_method_switch_item_new.xml
@@ -16,76 +16,45 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/list_item"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingHorizontal="16dp"
-    android:paddingBottom="8dp">
-
-    <View
-        android:id="@+id/divider"
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:background="?attr/materialColorSurfaceVariant"
-        android:layout_marginStart="20dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginBottom="12dp"
-        android:visibility="gone"
-        android:importantForAccessibility="no"/>
-
-    <TextView
-        android:id="@+id/header_text"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:padding="8dp"
-        android:ellipsize="end"
-        android:singleLine="true"
-        android:fontFamily="google-sans-text"
-        android:textAppearance="?attr/textAppearance"
-        android:textColor="?attr/materialColorPrimary"
-        android:visibility="gone"/>
+    android:layout_height="72dp"
+    android:background="@drawable/input_method_switch_item_background"
+    android:gravity="center_vertical"
+    android:orientation="horizontal"
+    android:layout_marginHorizontal="16dp"
+    android:layout_marginBottom="8dp"
+    android:paddingStart="20dp"
+    android:paddingEnd="24dp">
 
     <LinearLayout
-        android:id="@+id/list_item"
-        android:layout_width="match_parent"
-        android:layout_height="72dp"
-        android:background="@drawable/input_method_switch_item_background"
-        android:gravity="center_vertical"
-        android:orientation="horizontal"
-        android:paddingStart="20dp"
-        android:paddingEnd="24dp">
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="start|center_vertical"
+        android:orientation="vertical">
 
-        <LinearLayout
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:gravity="start|center_vertical"
-            android:orientation="vertical">
-
-            <TextView
-                android:id="@+id/text"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:singleLine="true"
-                android:fontFamily="google-sans-text"
-                android:textColor="@color/input_method_switch_on_item"
-                android:textAppearance="?attr/textAppearanceListItem"/>
-
-        </LinearLayout>
-
-        <ImageView
-            android:id="@+id/image"
-            android:layout_width="24dp"
-            android:layout_height="24dp"
-            android:gravity="center_vertical"
-            android:layout_marginStart="12dp"
-            android:src="@drawable/ic_check_24dp"
-            android:tint="@color/input_method_switch_on_item"
-            android:visibility="gone"
-            android:importantForAccessibility="no"/>
+        <TextView
+            android:id="@+id/text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:ellipsize="marquee"
+            android:singleLine="true"
+            android:fontFamily="google-sans-text"
+            android:textColor="@color/input_method_switch_on_item"
+            android:textAppearance="?attr/textAppearanceListItem"/>
 
     </LinearLayout>
 
+    <ImageView
+        android:id="@+id/image"
+        android:layout_width="24dp"
+        android:layout_height="24dp"
+        android:gravity="center_vertical"
+        android:layout_marginStart="12dp"
+        android:src="@drawable/ic_check_24dp"
+        android:tint="@color/input_method_switch_on_item"
+        android:visibility="gone"
+        android:importantForAccessibility="no"/>
+
 </LinearLayout>
diff --git a/core/res/res/layout/notification_template_material_progress.xml b/core/res/res/layout/notification_template_material_progress.xml
index b413c70..fdcefcc 100644
--- a/core/res/res/layout/notification_template_material_progress.xml
+++ b/core/res/res/layout/notification_template_material_progress.xml
@@ -75,10 +75,11 @@
                         />
 
 
-                    <include
+                    <com.android.internal.widget.NotificationProgressBar
+                        android:id="@+id/progress"
                         android:layout_width="0dp"
                         android:layout_height="@dimen/notification_progress_bar_height"
-                        layout="@layout/notification_template_progress"
+                        style="@style/Widget.Material.Light.ProgressBar.Horizontal"
                         android:layout_weight="1"
                         />
 
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index c1893ab..4f63fac 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1582,6 +1582,8 @@
   <java-symbol type="layout" name="input_method" />
   <java-symbol type="layout" name="input_method_extract_view" />
   <java-symbol type="layout" name="input_method_switch_item" />
+  <java-symbol type="layout" name="input_method_switch_item_divider" />
+  <java-symbol type="layout" name="input_method_switch_item_header" />
   <java-symbol type="layout" name="input_method_switch_item_new" />
   <java-symbol type="layout" name="input_method_switch_dialog_new" />
   <java-symbol type="layout" name="input_method_switch_dialog_title" />
diff --git a/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java b/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java
index ba6f62c..d7f6a29 100644
--- a/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java
+++ b/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java
@@ -100,14 +100,14 @@
         topConsumer.setControl(
                 new InsetsSourceControl(ID_STATUS_BAR, WindowInsets.Type.statusBars(),
                         mStatusLeash, true, new Point(0, 0), Insets.of(0, 100, 0, 0)),
-                new int[1], new int[1]);
+                new int[1], new int[1], new int[1]);
 
         InsetsSourceConsumer navConsumer = new InsetsSourceConsumer(ID_NAVIGATION_BAR,
                 WindowInsets.Type.navigationBars(), mInsetsState, mMockController);
         navConsumer.setControl(
                 new InsetsSourceControl(ID_NAVIGATION_BAR, WindowInsets.Type.navigationBars(),
                         mNavLeash, true, new Point(400, 0), Insets.of(0, 0, 100, 0)),
-                new int[1], new int[1]);
+                new int[1], new int[1], new int[1]);
         mMockController.setRequestedVisibleTypes(0, WindowInsets.Type.navigationBars());
         navConsumer.applyLocalVisibilityOverride();
 
diff --git a/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java b/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java
index d6d45e8..3a8f7ee 100644
--- a/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java
+++ b/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java
@@ -117,7 +117,23 @@
         mConsumer.setControl(
                 new InsetsSourceControl(ID_STATUS_BAR, statusBars(), mLeash,
                         true /* initialVisible */, new Point(), Insets.NONE),
-                new int[1], new int[1]);
+                new int[1], new int[1], new int[1]);
+    }
+
+    @Test
+    public void testSetControl_cancelAnimation() {
+        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
+            final InsetsSourceControl newControl = new InsetsSourceControl(mConsumer.getControl());
+
+            // Change the side of the insets hint.
+            newControl.setInsetsHint(Insets.of(0, 0, 0, 100));
+
+            int[] cancelTypes = {0};
+            mConsumer.setControl(newControl, new int[1], new int[1], cancelTypes);
+
+            assertEquals(statusBars(), cancelTypes[0]);
+        });
+
     }
 
     @Test
@@ -180,7 +196,7 @@
     @Test
     public void testRestore() {
         InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
-            mConsumer.setControl(null, new int[1], new int[1]);
+            mConsumer.setControl(null, new int[1], new int[1], new int[1]);
             mSurfaceParamsApplied = false;
             mController.setRequestedVisibleTypes(0 /* visibleTypes */, statusBars());
             assertFalse(mSurfaceParamsApplied);
@@ -188,7 +204,7 @@
             mConsumer.setControl(
                     new InsetsSourceControl(ID_STATUS_BAR, statusBars(), mLeash,
                             true /* initialVisible */, new Point(), Insets.NONE),
-                    new int[1], hideTypes);
+                    new int[1], hideTypes, new int[1]);
             assertEquals(statusBars(), hideTypes[0]);
             assertFalse(mRemoveSurfaceCalled);
         });
@@ -198,7 +214,7 @@
     public void testRestore_noAnimation() {
         InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
             mController.setRequestedVisibleTypes(0 /* visibleTypes */, statusBars());
-            mConsumer.setControl(null, new int[1], new int[1]);
+            mConsumer.setControl(null, new int[1], new int[1], new int[1]);
             mLeash = new SurfaceControl.Builder(mSession)
                     .setName("testSurface")
                     .build();
@@ -207,7 +223,7 @@
             mConsumer.setControl(
                     new InsetsSourceControl(ID_STATUS_BAR, statusBars(), mLeash,
                             false /* initialVisible */, new Point(), Insets.NONE),
-                    new int[1], hideTypes);
+                    new int[1], hideTypes, new int[1]);
             assertTrue(mRemoveSurfaceCalled);
             assertEquals(0, hideTypes[0]);
         });
@@ -235,7 +251,8 @@
 
             // Initial IME insets source control with its leash.
             imeConsumer.setControl(new InsetsSourceControl(ID_IME, ime(), mLeash,
-                    false /* initialVisible */, new Point(), Insets.NONE), new int[1], new int[1]);
+                    false /* initialVisible */, new Point(), Insets.NONE), new int[1], new int[1],
+                    new int[1]);
             mSurfaceParamsApplied = false;
 
             // Verify when the app requests controlling show IME animation, the IME leash
@@ -244,7 +261,8 @@
                     null /* interpolator */, null /* cancellationSignal */, null /* listener */);
             assertEquals(ANIMATION_TYPE_USER, insetsController.getAnimationType(ime()));
             imeConsumer.setControl(new InsetsSourceControl(ID_IME, ime(), mLeash,
-                    true /* initialVisible */, new Point(), Insets.NONE), new int[1], new int[1]);
+                    true /* initialVisible */, new Point(), Insets.NONE), new int[1], new int[1],
+                    new int[1]);
             assertFalse(mSurfaceParamsApplied);
         });
     }
diff --git a/core/tests/coretests/src/com/android/internal/widget/NotificationProgressModelTest.java b/core/tests/coretests/src/com/android/internal/widget/NotificationProgressModelTest.java
new file mode 100644
index 0000000..962399e
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/widget/NotificationProgressModelTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.widget;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Flags;
+import android.app.Notification;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.platform.test.annotations.EnableFlags;
+import android.platform.test.flag.junit.SetFlagsRule;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.util.List;
+
+@SmallTest
+@EnableFlags(Flags.FLAG_API_RICH_ONGOING)
+public class NotificationProgressModelTest {
+
+    @Rule
+    public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+
+    @Test(expected = IllegalArgumentException.class)
+    public void throw_exception_on_transparent_indeterminate_color() {
+        new NotificationProgressModel(Color.TRANSPARENT);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void throw_exception_on_empty_segments() {
+        new NotificationProgressModel(List.of(),
+                List.of(),
+                10,
+                false);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void throw_exception_on_negative_progress() {
+        new NotificationProgressModel(
+                List.of(new Notification.ProgressStyle.Segment(50).setColor(Color.YELLOW)),
+                List.of(),
+                -1,
+                false);
+    }
+
+    @Test
+    public void save_and_restore_indeterminate_progress_model() {
+        // GIVEN
+        final NotificationProgressModel savedModel = new NotificationProgressModel(Color.RED);
+        final Bundle bundle = savedModel.toBundle();
+
+        // WHEN
+        final NotificationProgressModel restoredModel =
+                NotificationProgressModel.fromBundle(bundle);
+
+        // THEN
+        assertThat(restoredModel.getIndeterminateColor()).isEqualTo(Color.RED);
+        assertThat(restoredModel.isIndeterminate()).isTrue();
+        assertThat(restoredModel.getProgress()).isEqualTo(-1);
+        assertThat(restoredModel.getSegments()).isEmpty();
+        assertThat(restoredModel.getPoints()).isEmpty();
+        assertThat(restoredModel.isStyledByProgress()).isFalse();
+    }
+
+    @Test
+    public void save_and_restore_non_indeterminate_progress_model() {
+        // GIVEN
+        final List<Notification.ProgressStyle.Segment> segments = List.of(
+                new Notification.ProgressStyle.Segment(50).setColor(Color.YELLOW),
+                new Notification.ProgressStyle.Segment(50).setColor(Color.LTGRAY));
+        final List<Notification.ProgressStyle.Point> points = List.of(
+                new Notification.ProgressStyle.Point(0).setColor(Color.RED),
+                new Notification.ProgressStyle.Point(20).setColor(Color.BLUE));
+        final NotificationProgressModel savedModel = new NotificationProgressModel(segments,
+                points,
+                100,
+                true);
+
+        final Bundle bundle = savedModel.toBundle();
+
+        // WHEN
+        final NotificationProgressModel restoredModel =
+                NotificationProgressModel.fromBundle(bundle);
+
+        // THEN
+        assertThat(restoredModel.isIndeterminate()).isFalse();
+        assertThat(restoredModel.getSegments()).isEqualTo(segments);
+        assertThat(restoredModel.getPoints()).isEqualTo(points);
+        assertThat(restoredModel.getProgress()).isEqualTo(100);
+        assertThat(restoredModel.isStyledByProgress()).isTrue();
+        assertThat(restoredModel.getIndeterminateColor()).isEqualTo(-1);
+    }
+}
diff --git a/libs/WindowManager/Shell/res/drawable/app_handle_education_tooltip_icon.xml b/libs/WindowManager/Shell/res/drawable/app_handle_education_tooltip_icon.xml
index b74d922..2d5597e 100644
--- a/libs/WindowManager/Shell/res/drawable/app_handle_education_tooltip_icon.xml
+++ b/libs/WindowManager/Shell/res/drawable/app_handle_education_tooltip_icon.xml
@@ -19,9 +19,15 @@
     android:width="24dp"
     android:height="24dp"
     android:tint="?android:attr/textColorTertiary"
-    android:viewportHeight="960"
-    android:viewportWidth="960">
+    android:viewportHeight="24"
+    android:viewportWidth="24">
     <path
         android:fillColor="@android:color/system_on_tertiary_container_light"
-        android:pathData="M419,880Q391,880 366.5,868Q342,856 325,834L107,557L126,537Q146,516 174,512Q202,508 226,523L300,568L300,240Q300,223 311.5,211.5Q323,200 340,200Q357,200 369,211.5Q381,223 381,240L381,712L284,652L388,785Q394,792 402,796Q410,800 419,800L640,800Q673,800 696.5,776.5Q720,753 720,720L720,560Q720,543 708.5,531.5Q697,520 680,520L461,520L461,440L680,440Q730,440 765,475Q800,510 800,560L800,720Q800,786 753,833Q706,880 640,880L419,880ZM167,340Q154,318 147,292.5Q140,267 140,240Q140,157 198.5,98.5Q257,40 340,40Q423,40 481.5,98.5Q540,157 540,240Q540,267 533,292.5Q526,318 513,340L444,300Q452,286 456,271.5Q460,257 460,240Q460,190 425,155Q390,120 340,120Q290,120 255,155Q220,190 220,240Q220,257 224,271.5Q228,286 236,300L167,340ZM502,620L502,620L502,620L502,620Q502,620 502,620Q502,620 502,620L502,620Q502,620 502,620Q502,620 502,620L502,620Q502,620 502,620Q502,620 502,620L502,620L502,620Z" />
-</vector>
+        android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/>
+    <path
+        android:fillColor="@android:color/system_on_tertiary_container_light"
+        android:pathData="M8,17h8v2h-8z"/>
+    <path
+        android:fillColor="@android:color/system_on_tertiary_container_light"
+        android:pathData="M12,2C7.86,2 4.5,5.36 4.5,9.5c0,3.82 2.66,5.86 3.77,6.5h7.46c1.11,-0.64 3.77,-2.68 3.77,-6.5C19.5,5.36 16.14,2 12,2z"/>
+  </vector>
diff --git a/libs/WindowManager/Shell/res/drawable/desktop_windowing_education_tooltip_background.xml b/libs/WindowManager/Shell/res/drawable/desktop_windowing_education_tooltip_background.xml
index a12a746..473236c 100644
--- a/libs/WindowManager/Shell/res/drawable/desktop_windowing_education_tooltip_background.xml
+++ b/libs/WindowManager/Shell/res/drawable/desktop_windowing_education_tooltip_background.xml
@@ -18,7 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
     <item>
         <shape android:shape="rectangle">
-            <corners android:radius="30dp" />
+            <corners android:radius="28dp" />
             <solid android:color="@android:color/system_tertiary_fixed" />
         </shape>
     </item>
diff --git a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml
index a269b9e..fd75827 100644
--- a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml
+++ b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml
@@ -26,6 +26,7 @@
         android:id="@+id/arrow_icon"
         android:layout_width="10dp"
         android:layout_height="12dp"
+        android:elevation="2dp"
         android:layout_gravity="center_vertical"
         android:src="@drawable/desktop_windowing_education_tooltip_left_arrow" />
 
diff --git a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_tooltip_container.xml b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_tooltip_container.xml
index 09a049c..42f955d 100644
--- a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_tooltip_container.xml
+++ b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_tooltip_container.xml
@@ -16,16 +16,18 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/tooltip_container"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
     android:background="@drawable/desktop_windowing_education_tooltip_background"
     android:orientation="horizontal"
+    android:elevation="2dp"
     android:padding="@dimen/desktop_windowing_education_tooltip_padding">
 
     <ImageView
         android:id="@+id/tooltip_icon"
         android:layout_width="32dp"
         android:layout_height="32dp"
+        android:layout_margin="8dp"
         android:layout_gravity="center_vertical"
         android:src="@drawable/app_handle_education_tooltip_icon" />
 
@@ -34,9 +36,9 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
-        android:layout_marginStart="2dp"
+        android:layout_marginHorizontal="8dp"
         android:lineHeight="20dp"
-        android:maxWidth="150dp"
+        android:maxWidth="220dp"
         android:textColor="@android:color/system_on_tertiary_container_light"
         android:textFontWeight="500"
         android:textSize="14sp" />
diff --git a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_top_arrow_tooltip.xml b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_top_arrow_tooltip.xml
index c73c1da..83d7ef7 100644
--- a/libs/WindowManager/Shell/res/layout/desktop_windowing_education_top_arrow_tooltip.xml
+++ b/libs/WindowManager/Shell/res/layout/desktop_windowing_education_top_arrow_tooltip.xml
@@ -25,6 +25,7 @@
         android:id="@+id/arrow_icon"
         android:layout_width="12dp"
         android:layout_height="9dp"
+        android:elevation="2dp"
         android:layout_gravity="center_horizontal"
         android:src="@drawable/desktop_windowing_education_tooltip_top_arrow" />
 
diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml
index 5ef8432..621e2aa 100644
--- a/libs/WindowManager/Shell/res/values/strings.xml
+++ b/libs/WindowManager/Shell/res/values/strings.xml
@@ -220,13 +220,13 @@
     <string name="camera_compat_dismiss_button_description">No camera issues? Tap to dismiss.</string>
 
     <!-- App handle education tooltip text for tooltip pointing to app handle -->
-    <string name="windowing_app_handle_education_tooltip">Tap to open the app menu</string>
+    <string name="windowing_app_handle_education_tooltip">The app menu can be found here</string>
 
     <!-- App handle education tooltip text for tooltip pointing to windowing image button -->
-    <string name="windowing_desktop_mode_image_button_education_tooltip">Tap to show multiple apps together</string>
+    <string name="windowing_desktop_mode_image_button_education_tooltip">Enter desktop view to open multiple apps together</string>
 
     <!-- App handle education tooltip text for tooltip pointing to app chip -->
-    <string name="windowing_desktop_mode_exit_education_tooltip">Return to fullscreen from the app menu</string>
+    <string name="windowing_desktop_mode_exit_education_tooltip">Return to full screen anytime from the app menu</string>
 
     <!-- The title of the letterbox education dialog. [CHAR LIMIT=NONE] -->
     <string name="letterbox_education_dialog_title">See and do more</string>
diff --git a/libs/hwui/apex/LayoutlibLoader.cpp b/libs/hwui/apex/LayoutlibLoader.cpp
index b4e6b72..56191c0 100644
--- a/libs/hwui/apex/LayoutlibLoader.cpp
+++ b/libs/hwui/apex/LayoutlibLoader.cpp
@@ -205,6 +205,13 @@
     jmethodID getPropertyMethod = GetStaticMethodIDOrDie(env, system, "getProperty",
                                                          "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
 
+    auto formatProperty = (jstring)env->CallStaticObjectMethod(
+            system, getPropertyMethod, env->NewStringUTF("method_binding_format"),
+            env->NewStringUTF(""));
+    const char* methodFormatChars = env->GetStringUTFChars(formatProperty, 0);
+    setJniMethodFormat(string(methodFormatChars));
+    env->ReleaseStringUTFChars(formatProperty, methodFormatChars);
+
     // Get the names of classes that need to register their native methods
     auto nativesClassesJString = (jstring)env->CallStaticObjectMethod(
             system, getPropertyMethod, env->NewStringUTF("graphics_native_classes"),
diff --git a/packages/CrashRecovery/framework/Android.bp b/packages/CrashRecovery/framework/Android.bp
index 9480327..1be776d 100644
--- a/packages/CrashRecovery/framework/Android.bp
+++ b/packages/CrashRecovery/framework/Android.bp
@@ -1,53 +1,12 @@
-soong_config_module_type {
-    name: "platform_filegroup",
-    module_type: "filegroup",
-    config_namespace: "ANDROID",
-    bool_variables: [
-        "crashrecovery_files_in_platform",
-    ],
-    properties: [
-        "srcs",
-    ],
-}
-
-platform_filegroup {
+filegroup {
     name: "framework-crashrecovery-sources",
-    soong_config_variables: {
-        // if this flag is enabled, then files are part of platform
-        crashrecovery_files_in_platform: {
-            srcs: [
-                "java/**/*.java",
-                "java/**/*.aidl",
-            ],
-        },
-    },
-    path: "java",
-    visibility: ["//frameworks/base:__subpackages__"],
-}
-
-soong_config_module_type {
-    name: "module_filegroup",
-    module_type: "filegroup",
-    config_namespace: "ANDROID",
-    bool_variables: [
-        "crashrecovery_files_in_module",
+    srcs: [
+        "java/**/*.java",
+        "java/**/*.aidl",
     ],
-    properties: [
-        "srcs",
-    ],
-}
-
-module_filegroup {
-    name: "framework-crashrecovery-module-sources",
-    soong_config_variables: {
-        // if this flag is enabled, then files are part of module
-        crashrecovery_files_in_module: {
-            srcs: [
-                "java/**/*.java",
-                "java/**/*.aidl",
-            ],
-        },
-    },
     path: "java",
-    visibility: ["//packages/modules/CrashRecovery/framework"],
+    visibility: [
+        "//frameworks/base:__subpackages__",
+        "//packages/modules/CrashRecovery/framework",
+    ],
 }
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsDimension.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsDimension.kt
index 5dca637..3957483 100644
--- a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsDimension.kt
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsDimension.kt
@@ -22,6 +22,7 @@
 object SettingsDimension {
     val paddingTiny = 2.dp
     val paddingExtraSmall = 4.dp
+    val paddingExtraSmall1 = 6.dp
     val paddingSmall = if (isSpaExpressiveEnabled) 8.dp else 4.dp
     val paddingExtraSmall5 = 10.dp
     val paddingExtraSmall6 = 12.dp
@@ -87,4 +88,7 @@
     val illustrationCornerRadius = 28.dp
 
     val preferenceMinHeight = 72.dp
+
+    val spinnerOptionMinHeight = 48.dp
+    val spinnerIconSize = 20.dp
 }
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsShape.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsShape.kt
index c787715..86ba686 100644
--- a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsShape.kt
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/framework/theme/SettingsShape.kt
@@ -24,7 +24,9 @@
 
     val CornerMedium = RoundedCornerShape(12.dp)
 
-    val categoryCorner = RoundedCornerShape(20.dp)
+    val CornerMedium2 = RoundedCornerShape(20.dp)
+
+    val CornerLarge = RoundedCornerShape(24.dp)
 
     val CornerExtraLarge = RoundedCornerShape(28.dp)
 }
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Category.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Category.kt
index 6c5581f..acbdec0 100644
--- a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Category.kt
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Category.kt
@@ -85,7 +85,7 @@
                     }
                     .then(
                         if (isSpaExpressiveEnabled)
-                            Modifier.fillMaxWidth().clip(SettingsShape.categoryCorner)
+                            Modifier.fillMaxWidth().clip(SettingsShape.CornerMedium2)
                         else Modifier
                     ),
             verticalArrangement =
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Spinner.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Spinner.kt
index 6b2db90..a9d2ef6 100644
--- a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Spinner.kt
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/ui/Spinner.kt
@@ -19,9 +19,14 @@
 import androidx.compose.foundation.background
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.heightIn
 import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
 import androidx.compose.foundation.selection.selectableGroup
 import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.Check
 import androidx.compose.material.icons.outlined.ExpandLess
 import androidx.compose.material.icons.outlined.ExpandMore
 import androidx.compose.material3.Button
@@ -38,20 +43,19 @@
 import androidx.compose.runtime.saveable.rememberSaveable
 import androidx.compose.runtime.setValue
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.semantics.Role
 import androidx.compose.ui.semantics.role
 import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
 import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.framework.theme.SettingsShape
 import com.android.settingslib.spa.framework.theme.SettingsTheme
 import com.android.settingslib.spa.framework.theme.isSpaExpressiveEnabled
 
-data class SpinnerOption(
-    val id: Int,
-    val text: String,
-)
+data class SpinnerOption(val id: Int, val text: String)
 
 @Composable
 fun Spinner(options: List<SpinnerOption>, selectedId: Int?, setId: (id: Int) -> Unit) {
@@ -62,51 +66,101 @@
     var expanded by rememberSaveable { mutableStateOf(false) }
 
     Box(
-        modifier = Modifier
-            .padding(
-                start = SettingsDimension.itemPaddingStart,
-                top = SettingsDimension.itemPaddingAround,
-                end = SettingsDimension.itemPaddingEnd,
-                bottom = SettingsDimension.itemPaddingAround,
-            )
-            .selectableGroup(),
-    ) {
-        val contentPadding = if (isSpaExpressiveEnabled) PaddingValues(
-            horizontal = SettingsDimension.spinnerHorizontalPadding,
-            vertical = SettingsDimension.spinnerVerticalPadding
-        ) else PaddingValues(horizontal = SettingsDimension.itemPaddingEnd)
-        Button(
-            modifier = Modifier.semantics { role = Role.DropdownList },
-            onClick = { expanded = true },
-            colors = ButtonDefaults.buttonColors(
-                containerColor = MaterialTheme.colorScheme.primaryContainer,
-                contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
-            ),
-            contentPadding = contentPadding,
-        ) {
-            SpinnerText(options.find { it.id == selectedId })
-            ExpandIcon(expanded)
-        }
-        DropdownMenu(
-            expanded = expanded,
-            onDismissRequest = { expanded = false },
-            modifier = Modifier.background(MaterialTheme.colorScheme.secondaryContainer),
-        ) {
-            for (option in options) {
-                DropdownMenuItem(
-                    text = {
-                        SpinnerText(
-                            option = option,
-                            modifier = Modifier.padding(end = 24.dp),
-                            color = MaterialTheme.colorScheme.onSecondaryContainer,
-                        )
-                    },
-                    onClick = {
-                        expanded = false
-                        setId(option.id)
-                    },
-                    contentPadding = contentPadding,
+        modifier =
+            Modifier.padding(
+                    start = SettingsDimension.itemPaddingStart,
+                    top = SettingsDimension.itemPaddingAround,
+                    end = SettingsDimension.itemPaddingEnd,
+                    bottom = SettingsDimension.itemPaddingAround,
                 )
+                .selectableGroup()
+    ) {
+        if (isSpaExpressiveEnabled) {
+            Button(
+                modifier = Modifier.semantics { role = Role.DropdownList },
+                onClick = { expanded = true },
+                colors =
+                    ButtonDefaults.buttonColors(
+                        containerColor = MaterialTheme.colorScheme.secondaryContainer,
+                        contentColor = MaterialTheme.colorScheme.onSecondaryContainer,
+                    ),
+                contentPadding =
+                    PaddingValues(
+                        horizontal = SettingsDimension.spinnerHorizontalPadding,
+                        vertical = SettingsDimension.spinnerVerticalPadding,
+                    ),
+            ) {
+                SpinnerText(options.find { it.id == selectedId })
+                ExpandIcon(expanded)
+            }
+            DropdownMenu(
+                expanded = expanded,
+                onDismissRequest = { expanded = false },
+                shape = SettingsShape.CornerLarge,
+                modifier =
+                    Modifier.background(MaterialTheme.colorScheme.surfaceContainerLow)
+                        .padding(horizontal = SettingsDimension.paddingSmall),
+            ) {
+                for ((index, option) in options.withIndex()) {
+                    val selected = index + 1 == selectedId
+                    DropdownMenuItem(
+                        text = { SpinnerOptionText(option = option, selected) },
+                        onClick = {
+                            expanded = false
+                            setId(option.id)
+                        },
+                        contentPadding =
+                            PaddingValues(
+                                horizontal = SettingsDimension.paddingSmall,
+                                vertical = SettingsDimension.paddingExtraSmall1,
+                            ),
+                        modifier =
+                            Modifier.heightIn(min = SettingsDimension.spinnerOptionMinHeight)
+                                .then(
+                                    if (selected)
+                                        Modifier.clip(SettingsShape.CornerMedium2)
+                                            .background(MaterialTheme.colorScheme.primaryContainer)
+                                    else Modifier
+                                ),
+                    )
+                }
+            }
+        } else {
+            val contentPadding = PaddingValues(horizontal = SettingsDimension.itemPaddingEnd)
+            Button(
+                modifier = Modifier.semantics { role = Role.DropdownList },
+                onClick = { expanded = true },
+                colors =
+                    ButtonDefaults.buttonColors(
+                        containerColor = MaterialTheme.colorScheme.primaryContainer,
+                        contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
+                    ),
+                contentPadding = contentPadding,
+            ) {
+                SpinnerText(options.find { it.id == selectedId })
+                ExpandIcon(expanded)
+            }
+            DropdownMenu(
+                expanded = expanded,
+                onDismissRequest = { expanded = false },
+                modifier = Modifier.background(MaterialTheme.colorScheme.secondaryContainer),
+            ) {
+                for (option in options) {
+                    DropdownMenuItem(
+                        text = {
+                            SpinnerText(
+                                option = option,
+                                modifier = Modifier.padding(end = 24.dp),
+                                color = MaterialTheme.colorScheme.onSecondaryContainer,
+                            )
+                        },
+                        onClick = {
+                            expanded = false
+                            setId(option.id)
+                        },
+                        contentPadding = contentPadding,
+                    )
+                }
             }
         }
     }
@@ -115,10 +169,11 @@
 @Composable
 internal fun ExpandIcon(expanded: Boolean) {
     Icon(
-        imageVector = when {
-            expanded -> Icons.Outlined.ExpandLess
-            else -> Icons.Outlined.ExpandMore
-        },
+        imageVector =
+            when {
+                expanded -> Icons.Outlined.ExpandLess
+                else -> Icons.Outlined.ExpandMore
+            },
         contentDescription = null,
     )
 }
@@ -131,18 +186,42 @@
 ) {
     Text(
         text = option?.text ?: "",
-        modifier = modifier
-            .padding(end = SettingsDimension.itemPaddingEnd)
-            .then(
-                if (!isSpaExpressiveEnabled)
-                    Modifier.padding(vertical = SettingsDimension.itemPaddingAround)
-                else Modifier
-            ),
+        modifier =
+            modifier
+                .padding(end = SettingsDimension.itemPaddingEnd)
+                .then(
+                    if (!isSpaExpressiveEnabled)
+                        Modifier.padding(vertical = SettingsDimension.itemPaddingAround)
+                    else Modifier
+                ),
         color = color,
         style = MaterialTheme.typography.labelLarge,
     )
 }
 
+@Composable
+private fun SpinnerOptionText(option: SpinnerOption?, selected: Boolean) {
+    Row {
+        if (selected) {
+            Icon(
+                imageVector = Icons.Outlined.Check,
+                modifier = Modifier.size(SettingsDimension.spinnerIconSize),
+                tint = MaterialTheme.colorScheme.onPrimaryContainer,
+                contentDescription = null,
+            )
+            Spacer(Modifier.padding(SettingsDimension.paddingSmall))
+        }
+        Text(
+            text = option?.text ?: "",
+            modifier = Modifier.padding(end = SettingsDimension.itemPaddingEnd),
+            color =
+                if (selected) MaterialTheme.colorScheme.onPrimaryContainer
+                else MaterialTheme.colorScheme.onSurface,
+            style = MaterialTheme.typography.labelLarge,
+        )
+    }
+}
+
 @Preview(showBackground = true)
 @Composable
 private fun SpinnerPreview() {
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index c4a45d0..2863531 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -802,6 +802,7 @@
         "SystemUICustomizationTestUtils",
         "androidx.compose.runtime_runtime",
         "kosmos",
+        "testables",
         "androidx.test.rules",
     ],
     libs: [
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
index d025275..93a99bd 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
@@ -136,6 +136,23 @@
             )
 
         /**
+         * The timings when animating a View into an app using a spring animator.
+         *
+         * Important: since springs don't have fixed durations, these timings represent fractions of
+         * the progress between the spring's initial value and its final value.
+         *
+         * TODO(b/372858592): make this a separate class explicitly using percentages.
+         */
+        val SPRING_TIMINGS =
+            TransitionAnimator.Timings(
+                totalDuration = 1000L,
+                contentBeforeFadeOutDelay = 0L,
+                contentBeforeFadeOutDuration = 800L,
+                contentAfterFadeInDelay = 850L,
+                contentAfterFadeInDuration = 135L,
+            )
+
+        /**
          * The timings when animating a Dialog into an app. We need to wait at least 200ms before
          * showing the app (which is under the dialog window) so that the dialog window dim is fully
          * faded out, to avoid flicker.
@@ -152,6 +169,13 @@
                 contentAfterFadeInInterpolator = PathInterpolator(0f, 0f, 0.6f, 1f),
             )
 
+        /** The interpolators when animating a View into an app using a spring animator. */
+        val SPRING_INTERPOLATORS =
+            INTERPOLATORS.copy(
+                contentBeforeFadeOutInterpolator = Interpolators.DECELERATE_1_5,
+                contentAfterFadeInInterpolator = Interpolators.SLOW_OUT_LINEAR_IN,
+            )
+
         // TODO(b/288507023): Remove this flag.
         @JvmField val DEBUG_TRANSITION_ANIMATION = Build.IS_DEBUGGABLE
 
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
index 3dc0657..1d8ff77 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
@@ -23,6 +23,7 @@
 import android.graphics.PorterDuff
 import android.graphics.PorterDuffXfermode
 import android.graphics.drawable.GradientDrawable
+import android.util.FloatProperty
 import android.util.Log
 import android.util.MathUtils
 import android.view.View
@@ -31,10 +32,15 @@
 import android.view.ViewOverlay
 import android.view.animation.Interpolator
 import android.window.WindowAnimationState
-import androidx.annotation.VisibleForTesting
 import com.android.app.animation.Interpolators.LINEAR
+import com.android.app.animation.MathUtils.max
+import com.android.internal.annotations.VisibleForTesting
+import com.android.internal.dynamicanimation.animation.SpringAnimation
+import com.android.internal.dynamicanimation.animation.SpringForce
 import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
 import java.util.concurrent.Executor
+import kotlin.math.abs
+import kotlin.math.min
 import kotlin.math.roundToInt
 
 private const val TAG = "TransitionAnimator"
@@ -44,11 +50,27 @@
     private val mainExecutor: Executor,
     private val timings: Timings,
     private val interpolators: Interpolators,
+
+    /** [springTimings] and [springInterpolators] must either both be null or both not null. */
+    private val springTimings: Timings? = null,
+    private val springInterpolators: Interpolators? = null,
+    private val springParams: SpringParams = DEFAULT_SPRING_PARAMS,
 ) {
     companion object {
         internal const val DEBUG = false
         private val SRC_MODE = PorterDuffXfermode(PorterDuff.Mode.SRC)
 
+        /** Default parameters for the multi-spring animator. */
+        private val DEFAULT_SPRING_PARAMS =
+            SpringParams(
+                centerXStiffness = 450f,
+                centerXDampingRatio = 0.965f,
+                centerYStiffness = 400f,
+                centerYDampingRatio = 0.95f,
+                scaleStiffness = 500f,
+                scaleDampingRatio = 0.99f,
+            )
+
         /**
          * Given the [linearProgress] of a transition animation, return the linear progress of the
          * sub-animation starting [delay] ms after the transition animation and that lasts
@@ -86,11 +108,32 @@
                 it.bottomCornerRadius = (bottomLeftRadius + bottomRightRadius) / 2
                 it.topCornerRadius = (topLeftRadius + topRightRadius) / 2
             }
+
+        /** Builds a [FloatProperty] for updating the defined [property] using a spring. */
+        private fun buildProperty(
+            property: SpringProperty,
+            updateProgress: (SpringState) -> Unit,
+        ): FloatProperty<SpringState> {
+            return object : FloatProperty<SpringState>(property.name) {
+                override fun get(state: SpringState): Float {
+                    return property.get(state)
+                }
+
+                override fun setValue(state: SpringState, value: Float) {
+                    property.setValue(state, value)
+                    updateProgress(state)
+                }
+            }
+        }
     }
 
     private val transitionContainerLocation = IntArray(2)
     private val cornerRadii = FloatArray(8)
 
+    init {
+        check((springTimings == null) == (springInterpolators == null))
+    }
+
     /**
      * A controller that takes care of applying the animation to an expanding view.
      *
@@ -198,6 +241,65 @@
         var visible: Boolean = true
     }
 
+    /** Encapsulated the state of a multi-spring animation. */
+    internal class SpringState(
+        // Animated values.
+        var centerX: Float,
+        var centerY: Float,
+        var scale: Float = 0f,
+
+        // Cached values.
+        var previousCenterX: Float = -1f,
+        var previousCenterY: Float = -1f,
+        var previousScale: Float = -1f,
+
+        // Completion flags.
+        var isCenterXDone: Boolean = false,
+        var isCenterYDone: Boolean = false,
+        var isScaleDone: Boolean = false,
+    ) {
+        /** Whether all springs composing the animation have settled in the final position. */
+        val isDone
+            get() = isCenterXDone && isCenterYDone && isScaleDone
+    }
+
+    /** Supported [SpringState] properties with getters and setters to update them. */
+    private enum class SpringProperty {
+        CENTER_X {
+            override fun get(state: SpringState): Float {
+                return state.centerX
+            }
+
+            override fun setValue(state: SpringState, value: Float) {
+                state.centerX = value
+            }
+        },
+        CENTER_Y {
+            override fun get(state: SpringState): Float {
+                return state.centerY
+            }
+
+            override fun setValue(state: SpringState, value: Float) {
+                state.centerY = value
+            }
+        },
+        SCALE {
+            override fun get(state: SpringState): Float {
+                return state.scale
+            }
+
+            override fun setValue(state: SpringState, value: Float) {
+                state.scale = value
+            }
+        };
+
+        /** Extracts the current value of the underlying property from [state]. */
+        abstract fun get(state: SpringState): Float
+
+        /** Update's the [value] of the underlying property inside [state]. */
+        abstract fun setValue(state: SpringState, value: Float)
+    }
+
     interface Animation {
         /** Start the animation. */
         fun start()
@@ -217,6 +319,33 @@
         }
     }
 
+    @VisibleForTesting
+    class MultiSpringAnimation
+    internal constructor(
+        @get:VisibleForTesting val springX: SpringAnimation,
+        @get:VisibleForTesting val springY: SpringAnimation,
+        @get:VisibleForTesting val springScale: SpringAnimation,
+        private val springState: SpringState,
+        private val onAnimationStart: Runnable,
+    ) : Animation {
+        @get:VisibleForTesting
+        val isDone
+            get() = springState.isDone
+
+        override fun start() {
+            onAnimationStart.run()
+            springX.start()
+            springY.start()
+            springScale.start()
+        }
+
+        override fun cancel() {
+            springX.cancel()
+            springY.cancel()
+            springScale.cancel()
+        }
+    }
+
     /** The timings (durations and delays) used by this animator. */
     data class Timings(
         /** The total duration of the animation. */
@@ -256,6 +385,21 @@
         val contentAfterFadeInInterpolator: Interpolator,
     )
 
+    /** The parameters (stiffnesses and damping ratios) used by the multi-spring animator. */
+    data class SpringParams(
+        // Parameters for the X position spring.
+        val centerXStiffness: Float,
+        val centerXDampingRatio: Float,
+
+        // Parameters for the Y position spring.
+        val centerYStiffness: Float,
+        val centerYDampingRatio: Float,
+
+        // Parameters for the scale spring.
+        val scaleStiffness: Float,
+        val scaleDampingRatio: Float,
+    )
+
     /**
      * Start a transition animation controlled by [controller] towards [endState]. An intermediary
      * layer with [windowBackgroundColor] will fade in then (optionally) fade out above the
@@ -266,6 +410,9 @@
      * the animation (if ![Controller.isLaunching]), and will have SRC blending mode (ultimately
      * punching a hole in the [transition container][Controller.transitionContainer]) iff [drawHole]
      * is true.
+     *
+     * If [useSpring] is true, a multi-spring animation will be used instead of the default
+     * interpolators.
      */
     fun startAnimation(
         controller: Controller,
@@ -273,8 +420,9 @@
         windowBackgroundColor: Int,
         fadeWindowBackgroundLayer: Boolean = true,
         drawHole: Boolean = false,
+        useSpring: Boolean = false,
     ): Animation {
-        if (!controller.isLaunching) checkReturnAnimationFrameworkFlag()
+        if (!controller.isLaunching || useSpring) checkReturnAnimationFrameworkFlag()
 
         // We add an extra layer with the same color as the dialog/app splash screen background
         // color, which is usually the same color of the app background. We first fade in this layer
@@ -293,6 +441,7 @@
                 windowBackgroundLayer,
                 fadeWindowBackgroundLayer,
                 drawHole,
+                useSpring,
             )
             .apply { start() }
     }
@@ -304,6 +453,7 @@
         endState: State,
         windowBackgroundLayer: GradientDrawable,
         fadeWindowBackgroundLayer: Boolean = true,
+        useSpring: Boolean = false,
         drawHole: Boolean = false,
     ): Animation {
         val transitionContainer = controller.transitionContainer
@@ -321,19 +471,35 @@
             openingWindowSyncView != null &&
                 openingWindowSyncView.viewRootImpl != controller.transitionContainer.viewRootImpl
 
-        return createInterpolatedAnimation(
-            controller,
-            startState,
-            endState,
-            windowBackgroundLayer,
-            transitionContainer,
-            transitionContainerOverlay,
-            openingWindowSyncView,
-            openingWindowSyncViewOverlay,
-            fadeWindowBackgroundLayer,
-            drawHole,
-            moveBackgroundLayerWhenAppVisibilityChanges,
-        )
+        return if (useSpring && springTimings != null && springInterpolators != null) {
+            createSpringAnimation(
+                controller,
+                startState,
+                endState,
+                windowBackgroundLayer,
+                transitionContainer,
+                transitionContainerOverlay,
+                openingWindowSyncView,
+                openingWindowSyncViewOverlay,
+                fadeWindowBackgroundLayer,
+                drawHole,
+                moveBackgroundLayerWhenAppVisibilityChanges,
+            )
+        } else {
+            createInterpolatedAnimation(
+                controller,
+                startState,
+                endState,
+                windowBackgroundLayer,
+                transitionContainer,
+                transitionContainerOverlay,
+                openingWindowSyncView,
+                openingWindowSyncViewOverlay,
+                fadeWindowBackgroundLayer,
+                drawHole,
+                moveBackgroundLayerWhenAppVisibilityChanges,
+            )
+        }
     }
 
     /**
@@ -478,6 +644,7 @@
                 fadeWindowBackgroundLayer,
                 drawHole,
                 controller.isLaunching,
+                useSpring = false,
             )
 
             controller.onTransitionAnimationProgress(state, progress, linearProgress)
@@ -486,6 +653,215 @@
         return InterpolatedAnimation(animator)
     }
 
+    /**
+     * Creates a compound animator made up of three springs: one for the center x position, one for
+     * the center-y position, and one for the overall scale.
+     *
+     * This animator uses [springTimings] and [springInterpolators] for opacity, based on the scale
+     * progress.
+     */
+    private fun createSpringAnimation(
+        controller: Controller,
+        startState: State,
+        endState: State,
+        windowBackgroundLayer: GradientDrawable,
+        transitionContainer: View,
+        transitionContainerOverlay: ViewGroupOverlay,
+        openingWindowSyncView: View?,
+        openingWindowSyncViewOverlay: ViewOverlay?,
+        fadeWindowBackgroundLayer: Boolean = true,
+        drawHole: Boolean = false,
+        moveBackgroundLayerWhenAppVisibilityChanges: Boolean = false,
+    ): Animation {
+        var springX: SpringAnimation? = null
+        var springY: SpringAnimation? = null
+        var targetX = endState.centerX
+        var targetY = endState.centerY
+
+        var movedBackgroundLayer = false
+
+        fun maybeUpdateEndState() {
+            if (endState.centerX != targetX && endState.centerY != targetY) {
+                targetX = endState.centerX
+                targetY = endState.centerY
+
+                springX?.animateToFinalPosition(targetX)
+                springY?.animateToFinalPosition(targetY)
+            }
+        }
+
+        fun updateProgress(state: SpringState) {
+            if (
+                (!state.isCenterXDone && state.centerX == state.previousCenterX) ||
+                    (!state.isCenterYDone && state.centerY == state.previousCenterY) ||
+                    (!state.isScaleDone && state.scale == state.previousScale)
+            ) {
+                // Because all three springs use the same update method, we only actually update
+                // when all values have changed, avoiding two redundant calls per frame.
+                return
+            }
+
+            // Update the latest values for the check above.
+            state.previousCenterX = state.centerX
+            state.previousCenterY = state.centerY
+            state.previousScale = state.scale
+
+            // Current scale-based values, that will be used to find the new animation bounds.
+            val width =
+                MathUtils.lerp(startState.width.toFloat(), endState.width.toFloat(), state.scale)
+            val height =
+                MathUtils.lerp(startState.height.toFloat(), endState.height.toFloat(), state.scale)
+
+            val newState =
+                State(
+                        left = (state.centerX - width / 2).toInt(),
+                        top = (state.centerY - height / 2).toInt(),
+                        right = (state.centerX + width / 2).toInt(),
+                        bottom = (state.centerY + height / 2).toInt(),
+                        topCornerRadius =
+                            MathUtils.lerp(
+                                startState.topCornerRadius,
+                                endState.topCornerRadius,
+                                state.scale,
+                            ),
+                        bottomCornerRadius =
+                            MathUtils.lerp(
+                                startState.bottomCornerRadius,
+                                endState.bottomCornerRadius,
+                                state.scale,
+                            ),
+                    )
+                    .apply {
+                        visible = checkVisibility(timings, state.scale, controller.isLaunching)
+                    }
+
+            if (!movedBackgroundLayer) {
+                movedBackgroundLayer =
+                    maybeMoveBackgroundLayer(
+                        controller,
+                        newState,
+                        windowBackgroundLayer,
+                        transitionContainer,
+                        transitionContainerOverlay,
+                        openingWindowSyncView,
+                        openingWindowSyncViewOverlay,
+                        moveBackgroundLayerWhenAppVisibilityChanges,
+                    )
+            }
+
+            val container =
+                if (movedBackgroundLayer) {
+                    openingWindowSyncView!!
+                } else {
+                    controller.transitionContainer
+                }
+            applyStateToWindowBackgroundLayer(
+                windowBackgroundLayer,
+                newState,
+                state.scale,
+                container,
+                fadeWindowBackgroundLayer,
+                drawHole,
+                isLaunching = false,
+                useSpring = true,
+            )
+
+            controller.onTransitionAnimationProgress(newState, state.scale, state.scale)
+
+            maybeUpdateEndState()
+        }
+
+        val springState = SpringState(centerX = startState.centerX, centerY = startState.centerY)
+        val isExpandingFullyAbove = isExpandingFullyAbove(transitionContainer, endState)
+
+        /** End listener for each spring, which only does the end work if all springs are done. */
+        fun onAnimationEnd() {
+            if (!springState.isDone) return
+            onAnimationEnd(
+                controller,
+                isExpandingFullyAbove,
+                windowBackgroundLayer,
+                transitionContainerOverlay,
+                openingWindowSyncViewOverlay,
+                moveBackgroundLayerWhenAppVisibilityChanges,
+            )
+        }
+
+        springX =
+            SpringAnimation(
+                    springState,
+                    buildProperty(SpringProperty.CENTER_X) { state -> updateProgress(state) },
+                )
+                .apply {
+                    spring =
+                        SpringForce(endState.centerX).apply {
+                            stiffness = springParams.centerXStiffness
+                            dampingRatio = springParams.centerXDampingRatio
+                        }
+
+                    setStartValue(startState.centerX)
+                    setMinValue(min(startState.centerX, endState.centerX))
+                    setMaxValue(max(startState.centerX, endState.centerX))
+
+                    addEndListener { _, _, _, _ ->
+                        springState.isCenterXDone = true
+                        onAnimationEnd()
+                    }
+                }
+        springY =
+            SpringAnimation(
+                    springState,
+                    buildProperty(SpringProperty.CENTER_Y) { state -> updateProgress(state) },
+                )
+                .apply {
+                    spring =
+                        SpringForce(endState.centerY).apply {
+                            stiffness = springParams.centerYStiffness
+                            dampingRatio = springParams.centerYDampingRatio
+                        }
+
+                    setStartValue(startState.centerY)
+                    setMinValue(min(startState.centerY, endState.centerY))
+                    setMaxValue(max(startState.centerY, endState.centerY))
+
+                    addEndListener { _, _, _, _ ->
+                        springState.isCenterYDone = true
+                        onAnimationEnd()
+                    }
+                }
+        val springScale =
+            SpringAnimation(
+                    springState,
+                    buildProperty(SpringProperty.SCALE) { state -> updateProgress(state) },
+                )
+                .apply {
+                    spring =
+                        SpringForce(1f).apply {
+                            stiffness = springParams.scaleStiffness
+                            dampingRatio = springParams.scaleDampingRatio
+                        }
+
+                    setStartValue(0f)
+                    setMaxValue(1f)
+                    setMinimumVisibleChange(abs(1f / startState.height))
+
+                    addEndListener { _, _, _, _ ->
+                        springState.isScaleDone = true
+                        onAnimationEnd()
+                    }
+                }
+
+        return MultiSpringAnimation(springX, springY, springScale, springState) {
+            onAnimationStart(
+                controller,
+                isExpandingFullyAbove,
+                windowBackgroundLayer,
+                transitionContainerOverlay,
+                openingWindowSyncViewOverlay,
+            )
+        }
+    }
+
     private fun onAnimationStart(
         controller: Controller,
         isExpandingFullyAbove: Boolean,
@@ -623,6 +999,7 @@
         fadeWindowBackgroundLayer: Boolean,
         drawHole: Boolean,
         isLaunching: Boolean,
+        useSpring: Boolean,
     ) {
         // Update position.
         transitionContainer.getLocationOnScreen(transitionContainerLocation)
@@ -644,8 +1021,19 @@
         cornerRadii[7] = state.bottomCornerRadius
         drawable.cornerRadii = cornerRadii
 
-        // We first fade in the background layer to hide the expanding view, then fade it out
-        // with SRC mode to draw a hole punch in the status bar and reveal the opening window.
+        val timings: Timings
+        val interpolators: Interpolators
+        if (useSpring) {
+            timings = springTimings!!
+            interpolators = springInterpolators!!
+        } else {
+            timings = this.timings
+            interpolators = this.interpolators
+        }
+
+        // We first fade in the background layer to hide the expanding view, then fade it out with
+        // SRC mode to draw a hole punch in the status bar and reveal the opening window (if
+        // needed). If !isLaunching, the reverse happens.
         val fadeInProgress =
             getProgress(
                 timings,
@@ -653,6 +1041,13 @@
                 timings.contentBeforeFadeOutDelay,
                 timings.contentBeforeFadeOutDuration,
             )
+        val fadeOutProgress =
+            getProgress(
+                timings,
+                linearProgress,
+                timings.contentAfterFadeInDelay,
+                timings.contentAfterFadeInDuration,
+            )
 
         if (isLaunching) {
             if (fadeInProgress < 1) {
@@ -660,13 +1055,6 @@
                     interpolators.contentBeforeFadeOutInterpolator.getInterpolation(fadeInProgress)
                 drawable.alpha = (alpha * 0xFF).roundToInt()
             } else if (fadeWindowBackgroundLayer) {
-                val fadeOutProgress =
-                    getProgress(
-                        timings,
-                        linearProgress,
-                        timings.contentAfterFadeInDelay,
-                        timings.contentAfterFadeInDuration,
-                    )
                 val alpha =
                     1 -
                         interpolators.contentAfterFadeInInterpolator.getInterpolation(
@@ -690,13 +1078,6 @@
                     drawable.setXfermode(SRC_MODE)
                 }
             } else {
-                val fadeOutProgress =
-                    getProgress(
-                        timings,
-                        linearProgress,
-                        timings.contentAfterFadeInDelay,
-                        timings.contentAfterFadeInDuration,
-                    )
                 val alpha =
                     1 -
                         interpolators.contentAfterFadeInInterpolator.getInterpolation(
diff --git a/packages/SystemUI/compose/core/src/com/android/compose/animation/Easings.kt b/packages/SystemUI/compose/core/src/com/android/compose/animation/Easings.kt
index 4fe9f89..dc6e0ce 100644
--- a/packages/SystemUI/compose/core/src/com/android/compose/animation/Easings.kt
+++ b/packages/SystemUI/compose/core/src/com/android/compose/animation/Easings.kt
@@ -16,6 +16,7 @@
 
 package com.android.compose.animation
 
+import androidx.compose.animation.core.CubicBezierEasing
 import androidx.compose.animation.core.Easing
 import androidx.core.animation.Interpolator
 import com.android.app.animation.InterpolatorsAndroidX
@@ -59,6 +60,17 @@
     /** The linear interpolator. */
     val Linear = fromInterpolator(InterpolatorsAndroidX.LINEAR)
 
+    /**
+     * Use this easing for animating progress values coming from the back callback to get the
+     * predictive-back-typical decelerate motion.
+     *
+     * This easing is similar to [StandardDecelerate] but has a slight acceleration phase at the
+     * start.
+     *
+     * See also [InterpolatorsAndroidX.BACK_GESTURE].
+     */
+    val PredictiveBack = CubicBezierEasing(0.1f, 0.1f, 0f, 1f)
+
     /** The default legacy interpolator as defined in Material 1. Also known as FAST_OUT_SLOW_IN. */
     val Legacy = fromInterpolator(InterpolatorsAndroidX.LEGACY)
 
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/FromLockscreenToBouncerTransition.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/FromLockscreenToBouncerTransition.kt
index dd37b53..cdf8d00 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/FromLockscreenToBouncerTransition.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/FromLockscreenToBouncerTransition.kt
@@ -1,6 +1,6 @@
 package com.android.systemui.scene.ui.composable.transitions
 
-import androidx.compose.animation.core.CubicBezierEasing
+import com.android.compose.animation.Easings
 import com.android.compose.animation.scene.TransitionBuilder
 import com.android.systemui.bouncer.ui.composable.Bouncer
 
@@ -9,7 +9,7 @@
 }
 
 fun TransitionBuilder.bouncerToLockscreenPreview() {
-    fractionRange(easing = CubicBezierEasing(0.1f, 0.1f, 0f, 1f)) {
+    fractionRange(easing = Easings.PredictiveBack) {
         scaleDraw(Bouncer.Elements.Content, scaleY = 0.8f, scaleX = 0.8f)
     }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryTest.kt
new file mode 100644
index 0000000..fd1f52b
--- /dev/null
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryTest.kt
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.qs.panels.data.repository
+
+import android.platform.test.annotations.EnableFlags
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
+import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.kosmos.testCase
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.res.R
+import com.android.systemui.shade.shared.flag.DualShade
+import com.android.systemui.testKosmos
+import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.test.runTest
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class QSColumnsRepositoryTest : SysuiTestCase() {
+    private val kosmos = testKosmos()
+    private lateinit var underTest: QSColumnsRepository
+
+    @Before
+    fun setUp() {
+        underTest = with(kosmos) { qsColumnsRepository }
+    }
+
+    @Test
+    fun configChanges_triggerColumnsUpdate() =
+        with(kosmos) {
+            testScope.runTest {
+                val latest by collectLastValue(underTest.columns)
+
+                setColumnsInConfig(4)
+                assertThat(latest).isEqualTo(4)
+
+                setColumnsInConfig(8)
+                assertThat(latest).isEqualTo(8)
+            }
+        }
+
+    @Test
+    @EnableFlags(DualShade.FLAG_NAME)
+    fun withDualShade_returnsCorrectValue() =
+        with(kosmos) {
+            testScope.runTest {
+                val latest by collectLastValue(underTest.columns)
+                assertThat(latest).isEqualTo(4)
+
+                setColumnsInConfig(8, id = R.integer.quick_settings_dual_shade_num_columns)
+                // Asserts config changes are ignored
+                assertThat(latest).isEqualTo(4)
+            }
+        }
+
+    private fun setColumnsInConfig(
+        columns: Int,
+        id: Int = R.integer.quick_settings_infinite_grid_num_columns,
+    ) =
+        with(kosmos) {
+            testCase.context.orCreateTestableResources.addOverride(id, columns)
+            fakeConfigurationRepository.onConfigurationChange()
+        }
+}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt
index ef85302..a1c0ef2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelTest.kt
@@ -58,6 +58,11 @@
             qsPreferencesInteractor.setLargeTilesSpecs(
                 tiles.filter { it.spec.startsWith(PREFIX_LARGE) }.toSet()
             )
+            testCase.context.orCreateTestableResources.addOverride(
+                R.integer.quick_settings_infinite_grid_num_columns,
+                4,
+            )
+            fakeConfigurationRepository.onConfigurationChange()
         }
 
     private val underTest = kosmos.quickQuickSettingsViewModel
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizerTest.kt
similarity index 90%
rename from packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitorTest.kt
rename to packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizerTest.kt
index cd18925..40c3f22 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizerTest.kt
@@ -31,15 +31,15 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4::class)
-class BackGestureMonitorTest : SysuiTestCase() {
+class BackGestureRecognizerTest : SysuiTestCase() {
 
     private var gestureState: GestureState = NotStarted
-    private val gestureMonitor =
-        BackGestureMonitor(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
+    private val gestureRecognizer =
+        BackGestureRecognizer(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
 
     @Before
     fun before() {
-        gestureMonitor.addGestureStateCallback { gestureState = it }
+        gestureRecognizer.addGestureStateCallback { gestureState = it }
     }
 
     @Test
@@ -85,7 +85,7 @@
     }
 
     private fun assertStateAfterEvents(events: List<MotionEvent>, expectedState: GestureState) {
-        events.forEach { gestureMonitor.accept(it) }
+        events.forEach { gestureRecognizer.accept(it) }
         assertThat(gestureState).isEqualTo(expectedState)
     }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/EasterEggGestureTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/EasterEggGestureTest.kt
index 3f1633a..8406d3b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/EasterEggGestureTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/EasterEggGestureTest.kt
@@ -36,7 +36,7 @@
     private var triggered = false
     private val handler =
         TouchpadGestureHandler(
-            BackGestureMonitor(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt()),
+            BackGestureRecognizer(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt()),
             EasterEggGestureMonitor(callback = { triggered = true }),
         )
 
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizerTest.kt
similarity index 90%
rename from packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitorTest.kt
rename to packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizerTest.kt
index edf0e56..043b775 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizerTest.kt
@@ -31,15 +31,15 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4::class)
-class HomeGestureMonitorTest : SysuiTestCase() {
+class HomeGestureRecognizerTest : SysuiTestCase() {
 
     private var gestureState: GestureState = GestureState.NotStarted
-    private val gestureMonitor =
-        HomeGestureMonitor(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
+    private val gestureRecognizer =
+        HomeGestureRecognizer(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
 
     @Before
     fun before() {
-        gestureMonitor.addGestureStateCallback { gestureState = it }
+        gestureRecognizer.addGestureStateCallback { gestureState = it }
     }
 
     @Test
@@ -81,7 +81,7 @@
     }
 
     private fun assertStateAfterEvents(events: List<MotionEvent>, expectedState: GestureState) {
-        events.forEach { gestureMonitor.accept(it) }
+        events.forEach { gestureRecognizer.accept(it) }
         assertThat(gestureState).isEqualTo(expectedState)
     }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizerTest.kt
similarity index 93%
rename from packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitorTest.kt
rename to packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizerTest.kt
index f68e773..7095a91 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizerTest.kt
@@ -35,7 +35,7 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4::class)
-class RecentAppsGestureMonitorTest : SysuiTestCase() {
+class RecentAppsGestureRecognizerTest : SysuiTestCase() {
 
     companion object {
         const val THRESHOLD_VELOCITY_PX_PER_MS = 0.1f
@@ -50,8 +50,8 @@
             // by default return correct speed for the gesture - as if pointer is slowing down
             on { calculateVelocity() } doReturn SLOW
         }
-    private val gestureMonitor =
-        RecentAppsGestureMonitor(
+    private val gestureRecognizer =
+        RecentAppsGestureRecognizer(
             gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt(),
             velocityThresholdPxPerMs = THRESHOLD_VELOCITY_PX_PER_MS,
             velocityTracker = VerticalVelocityTracker(velocityTracker1D),
@@ -59,7 +59,7 @@
 
     @Before
     fun before() {
-        gestureMonitor.addGestureStateCallback { gestureState = it }
+        gestureRecognizer.addGestureStateCallback { gestureState = it }
     }
 
     @Test
@@ -107,7 +107,7 @@
     }
 
     private fun assertStateAfterEvents(events: List<MotionEvent>, expectedState: GestureState) {
-        events.forEach { gestureMonitor.accept(it) }
+        events.forEach { gestureRecognizer.accept(it) }
         assertThat(gestureState).isEqualTo(expectedState)
     }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandlerTest.kt
index 9f7ea679..a867eb3 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandlerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandlerTest.kt
@@ -36,13 +36,13 @@
 class TouchpadGestureHandlerTest : SysuiTestCase() {
 
     private var gestureState: GestureState = GestureState.NotStarted
-    private val gestureMonitor =
-        BackGestureMonitor(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
-    private val handler = TouchpadGestureHandler(gestureMonitor, EasterEggGestureMonitor {})
+    private val gestureRecognizer =
+        BackGestureRecognizer(gestureDistanceThresholdPx = SWIPE_DISTANCE.toInt())
+    private val handler = TouchpadGestureHandler(gestureRecognizer, EasterEggGestureMonitor {})
 
     @Before
     fun before() {
-        gestureMonitor.addGestureStateCallback { gestureState = it }
+        gestureRecognizer.addGestureStateCallback { gestureState = it }
     }
 
     @Test
diff --git a/packages/SystemUI/res/values-land/config.xml b/packages/SystemUI/res/values-land/config.xml
index db526b1..b5efeb5 100644
--- a/packages/SystemUI/res/values-land/config.xml
+++ b/packages/SystemUI/res/values-land/config.xml
@@ -25,6 +25,9 @@
 
     <integer name="quick_settings_num_columns">4</integer>
 
+    <!-- The number of columns in the infinite grid QuickSettings -->
+    <integer name="quick_settings_infinite_grid_num_columns">8</integer>
+
     <!-- The number of columns that the top level tiles span in the QuickSettings -->
     <integer name="quick_settings_user_time_settings_tile_span">2</integer>
 
diff --git a/packages/SystemUI/res/values-sw600dp-port/config.xml b/packages/SystemUI/res/values-sw600dp-port/config.xml
index 857e162..7daad1a 100644
--- a/packages/SystemUI/res/values-sw600dp-port/config.xml
+++ b/packages/SystemUI/res/values-sw600dp-port/config.xml
@@ -24,6 +24,9 @@
     <!-- The number of columns in the QuickSettings -->
     <integer name="quick_settings_num_columns">3</integer>
 
+    <!-- The number of columns in the infinite grid QuickSettings -->
+    <integer name="quick_settings_infinite_grid_num_columns">6</integer>
+
     <integer name="power_menu_lite_max_columns">2</integer>
     <integer name="power_menu_lite_max_rows">3</integer>
 
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 38ef0e9..6f94f9e 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -73,6 +73,9 @@
     <!-- The number of columns in the infinite grid QuickSettings -->
     <integer name="quick_settings_infinite_grid_num_columns">4</integer>
 
+    <!-- The number of columns in the Dual Shade QuickSettings -->
+    <integer name="quick_settings_dual_shade_num_columns">4</integer>
+
     <!-- Override column number for quick settings.
     For now, this value has effect only when flag lockscreen.enable_landscape is enabled.
     TODO (b/293252410) - change this comment/resource when flag is enabled -->
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemInteractor.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemInteractor.kt
index 0118e56..01b84da 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemInteractor.kt
@@ -39,6 +39,7 @@
 import kotlinx.coroutines.flow.SharingStarted
 import kotlinx.coroutines.flow.asSharedFlow
 import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.flowOn
 import kotlinx.coroutines.flow.shareIn
 import kotlinx.coroutines.isActive
 import kotlinx.coroutines.withContext
@@ -114,6 +115,7 @@
                 localBluetoothManager?.eventManager?.registerCallback(listener)
                 awaitClose { localBluetoothManager?.eventManager?.unregisterCallback(listener) }
             }
+            .flowOn(backgroundDispatcher)
             .shareIn(coroutineScope, SharingStarted.WhileSubscribed(replayExpirationMillis = 0))
 
     internal suspend fun updateDeviceItems(context: Context, trigger: DeviceFetchTrigger) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
index b2acc2a..3c8bb09 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
@@ -48,6 +48,7 @@
 import androidx.compose.foundation.layout.width
 import androidx.compose.foundation.lazy.LazyColumn
 import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.rememberScrollState
 import androidx.compose.foundation.shape.CircleShape
 import androidx.compose.foundation.shape.RoundedCornerShape
@@ -434,11 +435,13 @@
 
 @Composable
 private fun EndSidePanel(searchQuery: String, modifier: Modifier, category: ShortcutCategory?) {
+    val listState = rememberLazyListState()
+    LaunchedEffect(key1 = category) { if (category != null) listState.animateScrollToItem(0) }
     if (category == null) {
         NoSearchResultsText(horizontalPadding = 24.dp, fillHeight = false)
         return
     }
-    LazyColumn(modifier = modifier) {
+    LazyColumn(modifier = modifier, state = listState) {
         items(category.subCategories) { subcategory ->
             SubCategoryContainerDualPane(searchQuery = searchQuery, subCategory = subcategory)
             Spacer(modifier = Modifier.height(8.dp))
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/dagger/PanelsModule.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/dagger/PanelsModule.kt
index 1fe54e4..31e867e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/dagger/PanelsModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/dagger/PanelsModule.kt
@@ -31,12 +31,12 @@
 import com.android.systemui.qs.panels.ui.compose.PaginatableGridLayout
 import com.android.systemui.qs.panels.ui.compose.PaginatedGridLayout
 import com.android.systemui.qs.panels.ui.compose.infinitegrid.InfiniteGridLayout
-import com.android.systemui.qs.panels.ui.viewmodel.FixedColumnsSizeViewModel
-import com.android.systemui.qs.panels.ui.viewmodel.FixedColumnsSizeViewModelImpl
 import com.android.systemui.qs.panels.ui.viewmodel.IconLabelVisibilityViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.IconLabelVisibilityViewModelImpl
 import com.android.systemui.qs.panels.ui.viewmodel.IconTilesViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.IconTilesViewModelImpl
+import com.android.systemui.qs.panels.ui.viewmodel.QSColumnsSizeViewModelImpl
+import com.android.systemui.qs.panels.ui.viewmodel.QSColumnsViewModel
 import dagger.Binds
 import dagger.Module
 import dagger.Provides
@@ -55,7 +55,7 @@
 
     @Binds fun bindIconTilesViewModel(impl: IconTilesViewModelImpl): IconTilesViewModel
 
-    @Binds fun bindGridSizeViewModel(impl: FixedColumnsSizeViewModelImpl): FixedColumnsSizeViewModel
+    @Binds fun bindQSColumnsViewModel(impl: QSColumnsSizeViewModelImpl): QSColumnsViewModel
 
     @Binds
     fun bindIconLabelVisibilityViewModel(
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepository.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepository.kt
deleted file mode 100644
index 32ce973..0000000
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepository.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.panels.data.repository
-
-import com.android.systemui.dagger.SysUISingleton
-import javax.inject.Inject
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.asStateFlow
-
-@SysUISingleton
-class FixedColumnsRepository @Inject constructor() {
-    // Number of columns in the narrowest state for consistency
-    private val _columns = MutableStateFlow(4)
-    val columns: StateFlow<Int> = _columns.asStateFlow()
-}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepository.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepository.kt
new file mode 100644
index 0000000..082f622
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepository.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.qs.panels.data.repository
+
+import android.content.res.Resources
+import com.android.systemui.common.ui.data.repository.ConfigurationRepository
+import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.dagger.qualifiers.Application
+import com.android.systemui.dagger.qualifiers.Main
+import com.android.systemui.res.R
+import com.android.systemui.shade.shared.flag.DualShade
+import com.android.systemui.util.kotlin.emitOnStart
+import javax.inject.Inject
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.flowOf
+import kotlinx.coroutines.flow.mapLatest
+import kotlinx.coroutines.flow.stateIn
+
+@OptIn(ExperimentalCoroutinesApi::class)
+@SysUISingleton
+class QSColumnsRepository
+@Inject
+constructor(
+    @Application scope: CoroutineScope,
+    @Main private val resources: Resources,
+    configurationRepository: ConfigurationRepository,
+) {
+    val columns: StateFlow<Int> =
+        if (DualShade.isEnabled) {
+                flowOf(resources.getInteger(R.integer.quick_settings_dual_shade_num_columns))
+            } else {
+                configurationRepository.onConfigurationChange.emitOnStart().mapLatest {
+                    resources.getInteger(R.integer.quick_settings_infinite_grid_num_columns)
+                }
+            }
+            .stateIn(
+                scope,
+                SharingStarted.WhileSubscribed(),
+                resources.getInteger(R.integer.quick_settings_infinite_grid_num_columns),
+            )
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt
similarity index 84%
rename from packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractor.kt
rename to packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt
index 9591002..9b45c56 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractor.kt
@@ -17,11 +17,11 @@
 package com.android.systemui.qs.panels.domain.interactor
 
 import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.qs.panels.data.repository.FixedColumnsRepository
+import com.android.systemui.qs.panels.data.repository.QSColumnsRepository
 import javax.inject.Inject
 import kotlinx.coroutines.flow.StateFlow
 
 @SysUISingleton
-class FixedColumnsSizeInteractor @Inject constructor(repo: FixedColumnsRepository) {
+class QSColumnsInteractor @Inject constructor(repo: QSColumnsRepository) {
     val columns: StateFlow<Int> = repo.columns
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt
index 3ba49ad..6920e49 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt
@@ -31,8 +31,8 @@
 import com.android.systemui.qs.panels.ui.compose.PaginatableGridLayout
 import com.android.systemui.qs.panels.ui.compose.rememberEditListState
 import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel
-import com.android.systemui.qs.panels.ui.viewmodel.FixedColumnsSizeViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.IconTilesViewModel
+import com.android.systemui.qs.panels.ui.viewmodel.QSColumnsViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.TileSquishinessViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel
 import com.android.systemui.qs.pipeline.shared.TileSpec
@@ -45,7 +45,7 @@
 @Inject
 constructor(
     private val iconTilesViewModel: IconTilesViewModel,
-    private val gridSizeViewModel: FixedColumnsSizeViewModel,
+    private val gridSizeViewModel: QSColumnsViewModel,
     private val squishinessViewModel: TileSquishinessViewModel,
 ) : PaginatableGridLayout {
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModel.kt
index d4f8298..78212b2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModel.kt
@@ -29,13 +29,13 @@
 @Inject
 constructor(
     iconTilesViewModel: IconTilesViewModel,
-    gridSizeViewModel: FixedColumnsSizeViewModel,
+    gridSizeViewModel: QSColumnsViewModel,
     iconLabelVisibilityViewModel: IconLabelVisibilityViewModel,
     paginatedGridInteractor: PaginatedGridInteractor,
     @Application applicationScope: CoroutineScope,
 ) :
     IconTilesViewModel by iconTilesViewModel,
-    FixedColumnsSizeViewModel by gridSizeViewModel,
+    QSColumnsViewModel by gridSizeViewModel,
     IconLabelVisibilityViewModel by iconLabelVisibilityViewModel {
     val rows =
         paginatedGridInteractor.rows.stateIn(
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModel.kt
deleted file mode 100644
index 2049edb..0000000
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModel.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.panels.ui.viewmodel
-
-import com.android.systemui.dagger.SysUISingleton
-import javax.inject.Inject
-
-@SysUISingleton
-class PartitionedGridViewModel
-@Inject
-constructor(
-    iconTilesViewModel: IconTilesViewModel,
-    gridSizeViewModel: FixedColumnsSizeViewModel,
-    iconLabelVisibilityViewModel: IconLabelVisibilityViewModel,
-) :
-    IconTilesViewModel by iconTilesViewModel,
-    FixedColumnsSizeViewModel by gridSizeViewModel,
-    IconLabelVisibilityViewModel by iconLabelVisibilityViewModel
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModel.kt
similarity index 78%
rename from packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModel.kt
rename to packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModel.kt
index 865c86b..0f1c77e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModel.kt
@@ -17,16 +17,16 @@
 package com.android.systemui.qs.panels.ui.viewmodel
 
 import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.qs.panels.domain.interactor.FixedColumnsSizeInteractor
+import com.android.systemui.qs.panels.domain.interactor.QSColumnsInteractor
 import javax.inject.Inject
 import kotlinx.coroutines.flow.StateFlow
 
-interface FixedColumnsSizeViewModel {
+interface QSColumnsViewModel {
     val columns: StateFlow<Int>
 }
 
 @SysUISingleton
-class FixedColumnsSizeViewModelImpl @Inject constructor(interactor: FixedColumnsSizeInteractor) :
-    FixedColumnsSizeViewModel {
+class QSColumnsSizeViewModelImpl @Inject constructor(interactor: QSColumnsInteractor) :
+    QSColumnsViewModel {
     override val columns: StateFlow<Int> = interactor.columns
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModel.kt
index 88e3019..72b586a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModel.kt
@@ -40,14 +40,14 @@
 @Inject
 constructor(
     tilesInteractor: CurrentTilesInteractor,
-    fixedColumnsSizeViewModel: FixedColumnsSizeViewModel,
+    qsColumnsViewModel: QSColumnsViewModel,
     quickQuickSettingsRowInteractor: QuickQuickSettingsRowInteractor,
     val squishinessViewModel: TileSquishinessViewModel,
     private val iconTilesViewModel: IconTilesViewModel,
     @Application private val applicationScope: CoroutineScope,
 ) {
 
-    val columns = fixedColumnsSizeViewModel.columns
+    val columns = qsColumnsViewModel.columns
 
     private val rows =
         quickQuickSettingsRowInteractor.rows.stateIn(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationProgressTemplateViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationProgressTemplateViewWrapper.kt
new file mode 100644
index 0000000..a693fd3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationProgressTemplateViewWrapper.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.statusbar.notification.row.wrapper
+
+import android.content.Context
+import android.view.View
+import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
+
+/** Wraps a notification containing a progress template */
+class NotificationProgressTemplateViewWrapper(
+    ctx: Context,
+    view: View,
+    row: ExpandableNotificationRow,
+) : NotificationTemplateViewWrapper(ctx, view, row)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
index 22b95ef..182fba3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
@@ -76,6 +76,8 @@
                 return new NotificationCompactHeadsUpTemplateViewWrapper(ctx, v, row);
             } else if ("compactMessagingHUN".equals((v.getTag()))) {
                 return new NotificationCompactMessagingTemplateViewWrapper(ctx, v, row);
+            } else if ("progress".equals(v.getTag())) {
+                return new NotificationProgressTemplateViewWrapper(ctx, v, row);
             }
 
             if (row.getEntry().getSbn().getNotification().isStyle(
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt
index 6879a34..d85cfcd 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt
@@ -24,7 +24,7 @@
 import com.android.systemui.inputdevice.tutorial.ui.composable.TutorialScreenConfig
 import com.android.systemui.inputdevice.tutorial.ui.composable.rememberColorFilterProperty
 import com.android.systemui.res.R
-import com.android.systemui.touchpad.tutorial.ui.gesture.BackGestureMonitor
+import com.android.systemui.touchpad.tutorial.ui.gesture.BackGestureRecognizer
 
 @Composable
 fun BackGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Unit) {
@@ -44,15 +44,15 @@
                     successResId = R.raw.trackpad_back_success,
                 ),
         )
-    val gestureMonitorProvider =
-        DistanceBasedGestureMonitorProvider(
-            monitorFactory = { distanceThresholdPx, gestureStateCallback ->
-                BackGestureMonitor(distanceThresholdPx).also {
+    val gestureRecognizerProvider =
+        DistanceBasedGestureRecognizerProvider(
+            recognizerFactory = { distanceThresholdPx, gestureStateCallback ->
+                BackGestureRecognizer(distanceThresholdPx).also {
                     it.addGestureStateCallback(gestureStateCallback)
                 }
             }
         )
-    GestureTutorialScreen(screenConfig, gestureMonitorProvider, onDoneButtonClicked, onBack)
+    GestureTutorialScreen(screenConfig, gestureRecognizerProvider, onDoneButtonClicked, onBack)
 }
 
 @Composable
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
index 72389cd..75c66f2 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
@@ -37,39 +37,39 @@
 import com.android.systemui.inputdevice.tutorial.ui.composable.TutorialActionState
 import com.android.systemui.inputdevice.tutorial.ui.composable.TutorialScreenConfig
 import com.android.systemui.touchpad.tutorial.ui.gesture.EasterEggGestureMonitor
+import com.android.systemui.touchpad.tutorial.ui.gesture.GestureRecognizer
 import com.android.systemui.touchpad.tutorial.ui.gesture.GestureState
 import com.android.systemui.touchpad.tutorial.ui.gesture.GestureState.Finished
 import com.android.systemui.touchpad.tutorial.ui.gesture.GestureState.InProgress
 import com.android.systemui.touchpad.tutorial.ui.gesture.GestureState.NotStarted
 import com.android.systemui.touchpad.tutorial.ui.gesture.TouchpadGestureHandler
-import com.android.systemui.touchpad.tutorial.ui.gesture.TouchpadGestureMonitor
 
-interface GestureMonitorProvider {
+interface GestureRecognizerProvider {
 
     @Composable
-    fun rememberGestureMonitor(
+    fun rememberGestureRecognizer(
         resources: Resources,
         gestureStateChangedCallback: (GestureState) -> Unit,
-    ): TouchpadGestureMonitor
+    ): GestureRecognizer
 }
 
 typealias gestureStateCallback = (GestureState) -> Unit
 
-class DistanceBasedGestureMonitorProvider(
-    val monitorFactory: (Int, gestureStateCallback) -> TouchpadGestureMonitor
-) : GestureMonitorProvider {
+class DistanceBasedGestureRecognizerProvider(
+    val recognizerFactory: (Int, gestureStateCallback) -> GestureRecognizer
+) : GestureRecognizerProvider {
 
     @Composable
-    override fun rememberGestureMonitor(
+    override fun rememberGestureRecognizer(
         resources: Resources,
         gestureStateChangedCallback: (GestureState) -> Unit,
-    ): TouchpadGestureMonitor {
+    ): GestureRecognizer {
         val distanceThresholdPx =
             resources.getDimensionPixelSize(
                 com.android.internal.R.dimen.system_gestures_distance_threshold
             )
         return remember(distanceThresholdPx) {
-            monitorFactory(distanceThresholdPx, gestureStateChangedCallback)
+            recognizerFactory(distanceThresholdPx, gestureStateChangedCallback)
         }
     }
 }
@@ -77,7 +77,7 @@
 fun GestureState.toTutorialActionState(): TutorialActionState {
     return when (this) {
         NotStarted -> TutorialActionState.NotStarted
-        is InProgress -> TutorialActionState.InProgress()
+        is InProgress -> TutorialActionState.InProgress(progress)
         Finished -> TutorialActionState.Finished
     }
 }
@@ -85,21 +85,21 @@
 @Composable
 fun GestureTutorialScreen(
     screenConfig: TutorialScreenConfig,
-    gestureMonitorProvider: GestureMonitorProvider,
+    gestureRecognizerProvider: GestureRecognizerProvider,
     onDoneButtonClicked: () -> Unit,
     onBack: () -> Unit,
 ) {
     BackHandler(onBack = onBack)
     var gestureState: GestureState by remember { mutableStateOf(NotStarted) }
     var easterEggTriggered by remember { mutableStateOf(false) }
-    val gestureMonitor =
-        gestureMonitorProvider.rememberGestureMonitor(
+    val gestureRecognizer =
+        gestureRecognizerProvider.rememberGestureRecognizer(
             resources = LocalContext.current.resources,
             gestureStateChangedCallback = { gestureState = it },
         )
     val easterEggMonitor = EasterEggGestureMonitor { easterEggTriggered = true }
     val gestureHandler =
-        remember(gestureMonitor) { TouchpadGestureHandler(gestureMonitor, easterEggMonitor) }
+        remember(gestureRecognizer) { TouchpadGestureHandler(gestureRecognizer, easterEggMonitor) }
     TouchpadGesturesHandlingBox(
         gestureHandler,
         gestureState,
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt
index a55fa44..69ec598 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt
@@ -23,7 +23,7 @@
 import com.android.systemui.inputdevice.tutorial.ui.composable.TutorialScreenConfig
 import com.android.systemui.inputdevice.tutorial.ui.composable.rememberColorFilterProperty
 import com.android.systemui.res.R
-import com.android.systemui.touchpad.tutorial.ui.gesture.HomeGestureMonitor
+import com.android.systemui.touchpad.tutorial.ui.gesture.HomeGestureRecognizer
 
 @Composable
 fun HomeGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Unit) {
@@ -43,15 +43,15 @@
                     successResId = R.raw.trackpad_home_success,
                 ),
         )
-    val gestureMonitorProvider =
-        DistanceBasedGestureMonitorProvider(
-            monitorFactory = { distanceThresholdPx, gestureStateCallback ->
-                HomeGestureMonitor(distanceThresholdPx).also {
+    val gestureRecognizerProvider =
+        DistanceBasedGestureRecognizerProvider(
+            recognizerFactory = { distanceThresholdPx, gestureStateCallback ->
+                HomeGestureRecognizer(distanceThresholdPx).also {
                     it.addGestureStateCallback(gestureStateCallback)
                 }
             }
         )
-    GestureTutorialScreen(screenConfig, gestureMonitorProvider, onDoneButtonClicked, onBack)
+    GestureTutorialScreen(screenConfig, gestureRecognizerProvider, onDoneButtonClicked, onBack)
 }
 
 @Composable
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt
index 6ee15aa..3097a18 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt
@@ -24,9 +24,9 @@
 import com.android.systemui.inputdevice.tutorial.ui.composable.TutorialScreenConfig
 import com.android.systemui.inputdevice.tutorial.ui.composable.rememberColorFilterProperty
 import com.android.systemui.res.R
+import com.android.systemui.touchpad.tutorial.ui.gesture.GestureRecognizer
 import com.android.systemui.touchpad.tutorial.ui.gesture.GestureState
-import com.android.systemui.touchpad.tutorial.ui.gesture.RecentAppsGestureMonitor
-import com.android.systemui.touchpad.tutorial.ui.gesture.TouchpadGestureMonitor
+import com.android.systemui.touchpad.tutorial.ui.gesture.RecentAppsGestureRecognizer
 
 @Composable
 fun RecentAppsGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Unit) {
@@ -46,13 +46,13 @@
                     successResId = R.raw.trackpad_recent_apps_success,
                 ),
         )
-    val gestureMonitorProvider =
-        object : GestureMonitorProvider {
+    val gestureRecognizerProvider =
+        object : GestureRecognizerProvider {
             @Composable
-            override fun rememberGestureMonitor(
+            override fun rememberGestureRecognizer(
                 resources: Resources,
                 gestureStateChangedCallback: (GestureState) -> Unit,
-            ): TouchpadGestureMonitor {
+            ): GestureRecognizer {
                 val distanceThresholdPx =
                     resources.getDimensionPixelSize(
                         com.android.internal.R.dimen.system_gestures_distance_threshold
@@ -60,13 +60,12 @@
                 val velocityThresholdPxPerMs =
                     resources.getDimension(R.dimen.touchpad_recent_apps_gesture_velocity_threshold)
                 return remember(distanceThresholdPx, velocityThresholdPxPerMs) {
-                    RecentAppsGestureMonitor(distanceThresholdPx, velocityThresholdPxPerMs).also {
-                        it.addGestureStateCallback(gestureStateChangedCallback)
-                    }
+                    RecentAppsGestureRecognizer(distanceThresholdPx, velocityThresholdPxPerMs)
+                        .also { it.addGestureStateCallback(gestureStateChangedCallback) }
                 }
             }
         }
-    GestureTutorialScreen(screenConfig, gestureMonitorProvider, onDoneButtonClicked, onBack)
+    GestureTutorialScreen(screenConfig, gestureRecognizerProvider, onDoneButtonClicked, onBack)
 }
 
 @Composable
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitor.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizer.kt
similarity index 87%
rename from packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitor.kt
rename to packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizer.kt
index 490f04d..56e97a3 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureMonitor.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/BackGestureRecognizer.kt
@@ -19,8 +19,8 @@
 import android.view.MotionEvent
 import kotlin.math.abs
 
-/** Monitors for touchpad back gesture, that is three fingers swiping left or right */
-class BackGestureMonitor(private val gestureDistanceThresholdPx: Int) : TouchpadGestureMonitor {
+/** Recognizes touchpad back gesture, that is three fingers swiping left or right */
+class BackGestureRecognizer(private val gestureDistanceThresholdPx: Int) : GestureRecognizer {
 
     private val distanceTracker = DistanceTracker()
     private var gestureStateChangedCallback: (GestureState) -> Unit = {}
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureMonitor.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/GestureRecognizer.kt
similarity index 89%
rename from packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureMonitor.kt
rename to packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/GestureRecognizer.kt
index 9216821..d146268 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureMonitor.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/GestureRecognizer.kt
@@ -19,8 +19,8 @@
 import android.view.MotionEvent
 import java.util.function.Consumer
 
-/** Monitor for touchpad gestures that can notify callback when [GestureState] changes. */
-interface TouchpadGestureMonitor : Consumer<MotionEvent> {
+/** Based on passed [MotionEvent]s recognizes different states of gesture and notifies callback. */
+interface GestureRecognizer : Consumer<MotionEvent> {
     fun addGestureStateCallback(callback: (GestureState) -> Unit)
 }
 
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitor.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizer.kt
similarity index 88%
rename from packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitor.kt
rename to packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizer.kt
index 83d4f56..3db9d7c 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureMonitor.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/HomeGestureRecognizer.kt
@@ -18,8 +18,8 @@
 
 import android.view.MotionEvent
 
-/** Monitors for touchpad home gesture, that is three fingers swiping up */
-class HomeGestureMonitor(private val gestureDistanceThresholdPx: Int) : TouchpadGestureMonitor {
+/** Recognizes touchpad home gesture, that is three fingers swiping up */
+class HomeGestureRecognizer(private val gestureDistanceThresholdPx: Int) : GestureRecognizer {
 
     private val distanceTracker = DistanceTracker()
     private var gestureStateChangedCallback: (GestureState) -> Unit = {}
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitor.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizer.kt
similarity index 83%
rename from packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitor.kt
rename to packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizer.kt
index 1731bb8..a194ad6 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureMonitor.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/RecentAppsGestureRecognizer.kt
@@ -20,16 +20,16 @@
 import kotlin.math.abs
 
 /**
- * Monitors recent apps gesture completion. That is - using three fingers on touchpad - swipe up
- * over some distance threshold and then slow down gesture before fingers are lifted. Implementation
- * is based on [com.android.quickstep.util.TriggerSwipeUpTouchTracker]
+ * Recognizes apps gesture completion. That is - using three fingers on touchpad - swipe up over
+ * some distance threshold and then slow down gesture before fingers are lifted. Implementation is
+ * based on [com.android.quickstep.util.TriggerSwipeUpTouchTracker]
  */
-class RecentAppsGestureMonitor(
+class RecentAppsGestureRecognizer(
     private val gestureDistanceThresholdPx: Int,
     private val velocityThresholdPxPerMs: Float,
     private val distanceTracker: DistanceTracker = DistanceTracker(),
     private val velocityTracker: VerticalVelocityTracker = VerticalVelocityTracker(),
-) : TouchpadGestureMonitor {
+) : GestureRecognizer {
 
     private var gestureStateChangedCallback: (GestureState) -> Unit = {}
 
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandler.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandler.kt
index 4b82ba1..21e2917 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandler.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/gesture/TouchpadGestureHandler.kt
@@ -25,7 +25,7 @@
  * motion events passed to [onMotionEvent] and will filter touchpad events accordingly
  */
 class TouchpadGestureHandler(
-    private val gestureMonitor: Consumer<MotionEvent>,
+    private val gestureRecognizer: Consumer<MotionEvent>,
     private val easterEggGestureMonitor: EasterEggGestureMonitor,
 ) {
 
@@ -41,7 +41,7 @@
             if (isTwoFingerSwipe(event)) {
                 easterEggGestureMonitor.processTouchpadEvent(event)
             } else {
-                gestureMonitor.accept(event)
+                gestureRecognizer.accept(event)
             }
             true
         } else {
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching.json b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching.json
index 60bff17..7f62357 100644
--- a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching.json
+++ b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching.json
@@ -1,25 +1,30 @@
 {
   "frame_ids": [
-    "before",
     0,
-    26,
-    52,
-    78,
-    105,
-    131,
-    157,
-    184,
-    210,
-    236,
-    263,
-    289,
-    315,
-    342,
-    368,
-    394,
-    421,
-    447,
-    473,
+    20,
+    40,
+    60,
+    80,
+    100,
+    120,
+    140,
+    160,
+    180,
+    200,
+    220,
+    240,
+    260,
+    280,
+    300,
+    320,
+    340,
+    360,
+    380,
+    400,
+    420,
+    440,
+    460,
+    480,
     500
   ],
   "features": [
@@ -28,70 +33,82 @@
       "type": "rect",
       "data_points": [
         {
-          "left": 0,
-          "top": 0,
-          "right": 0,
-          "bottom": 0
-        },
-        {
           "left": 100,
           "top": 300,
           "right": 200,
           "bottom": 400
         },
         {
-          "left": 98,
-          "top": 293,
-          "right": 203,
-          "bottom": 407
+          "left": 99,
+          "top": 296,
+          "right": 202,
+          "bottom": 404
         },
         {
-          "left": 91,
-          "top": 269,
-          "right": 213,
-          "bottom": 430
+          "left": 95,
+          "top": 283,
+          "right": 207,
+          "bottom": 417
         },
         {
-          "left": 71,
-          "top": 206,
-          "right": 240,
-          "bottom": 491
+          "left": 86,
+          "top": 256,
+          "right": 219,
+          "bottom": 443
         },
         {
-          "left": 34,
-          "top": 98,
-          "right": 283,
-          "bottom": 595
+          "left": 68,
+          "top": 198,
+          "right": 243,
+          "bottom": 499
         },
         {
-          "left": 22,
-          "top": 63,
-          "right": 296,
-          "bottom": 629
+          "left": 39,
+          "top": 110,
+          "right": 278,
+          "bottom": 584
+        },
+        {
+          "left": 26,
+          "top": 74,
+          "right": 292,
+          "bottom": 618
+        },
+        {
+          "left": 19,
+          "top": 55,
+          "right": 299,
+          "bottom": 637
         },
         {
           "left": 15,
-          "top": 44,
-          "right": 303,
-          "bottom": 648
+          "top": 42,
+          "right": 304,
+          "bottom": 649
         },
         {
-          "left": 11,
-          "top": 32,
-          "right": 308,
-          "bottom": 659
+          "left": 12,
+          "top": 33,
+          "right": 307,
+          "bottom": 658
         },
         {
-          "left": 8,
-          "top": 23,
-          "right": 311,
-          "bottom": 667
+          "left": 9,
+          "top": 27,
+          "right": 310,
+          "bottom": 664
+        },
+        {
+          "left": 7,
+          "top": 21,
+          "right": 312,
+          "bottom": 669
         },
         {
           "left": 6,
-          "top": 18,
-          "right": 313,
-          "bottom": 673
+          "top": 17,
+          "right": 314,
+          "bottom": 674
         },
         {
           "left": 5,
@@ -100,16 +117,22 @@
           "bottom": 677
         },
         {
-          "left": 3,
-          "top": 9,
+          "left": 4,
+          "top": 10,
           "right": 316,
-          "bottom": 681
+          "bottom": 680
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 317,
+          "bottom": 682
         },
         {
           "left": 2,
-          "top": 7,
-          "right": 317,
-          "bottom": 683
+          "top": 6,
+          "right": 318,
+          "bottom": 684
         },
         {
           "left": 2,
@@ -119,7 +142,7 @@
         },
         {
           "left": 1,
-          "top": 3,
+          "top": 4,
           "right": 319,
           "bottom": 687
         },
@@ -130,6 +153,18 @@
           "bottom": 688
         },
         {
+          "left": 1,
+          "top": 2,
+          "right": 319,
+          "bottom": 688
+        },
+        {
+          "left": 0,
+          "top": 1,
+          "right": 320,
+          "bottom": 689
+        },
+        {
           "left": 0,
           "top": 1,
           "right": 320,
@@ -159,7 +194,6 @@
       "name": "corner_radii",
       "type": "cornerRadii",
       "data_points": [
-        null,
         {
           "top_left_x": 10,
           "top_left_y": 10,
@@ -171,184 +205,244 @@
           "bottom_left_y": 20
         },
         {
-          "top_left_x": 9.762664,
-          "top_left_y": 9.762664,
-          "top_right_x": 9.762664,
-          "top_right_y": 9.762664,
-          "bottom_right_x": 19.525328,
-          "bottom_right_y": 19.525328,
-          "bottom_left_x": 19.525328,
-          "bottom_left_y": 19.525328
+          "top_left_x": 9.865689,
+          "top_left_y": 9.865689,
+          "top_right_x": 9.865689,
+          "top_right_y": 9.865689,
+          "bottom_right_x": 19.731379,
+          "bottom_right_y": 19.731379,
+          "bottom_left_x": 19.731379,
+          "bottom_left_y": 19.731379
         },
         {
-          "top_left_x": 8.969244,
-          "top_left_y": 8.969244,
-          "top_right_x": 8.969244,
-          "top_right_y": 8.969244,
-          "bottom_right_x": 17.938488,
-          "bottom_right_y": 17.938488,
-          "bottom_left_x": 17.938488,
-          "bottom_left_y": 17.938488
+          "top_left_x": 9.419104,
+          "top_left_y": 9.419104,
+          "top_right_x": 9.419104,
+          "top_right_y": 9.419104,
+          "bottom_right_x": 18.838207,
+          "bottom_right_y": 18.838207,
+          "bottom_left_x": 18.838207,
+          "bottom_left_y": 18.838207
         },
         {
-          "top_left_x": 6.8709626,
-          "top_left_y": 6.8709626,
-          "top_right_x": 6.8709626,
-          "top_right_y": 6.8709626,
-          "bottom_right_x": 13.741925,
-          "bottom_right_y": 13.741925,
-          "bottom_left_x": 13.741925,
-          "bottom_left_y": 13.741925
+          "top_left_x": 8.533693,
+          "top_left_y": 8.533693,
+          "top_right_x": 8.533693,
+          "top_right_y": 8.533693,
+          "bottom_right_x": 17.067387,
+          "bottom_right_y": 17.067387,
+          "bottom_left_x": 17.067387,
+          "bottom_left_y": 17.067387
         },
         {
-          "top_left_x": 3.260561,
-          "top_left_y": 3.260561,
-          "top_right_x": 3.260561,
-          "top_right_y": 3.260561,
-          "bottom_right_x": 6.521122,
-          "bottom_right_y": 6.521122,
-          "bottom_left_x": 6.521122,
-          "bottom_left_y": 6.521122
+          "top_left_x": 6.5919456,
+          "top_left_y": 6.5919456,
+          "top_right_x": 6.5919456,
+          "top_right_y": 6.5919456,
+          "bottom_right_x": 13.183891,
+          "bottom_right_y": 13.183891,
+          "bottom_left_x": 13.183891,
+          "bottom_left_y": 13.183891
         },
         {
-          "top_left_x": 2.0915751,
-          "top_left_y": 2.0915751,
-          "top_right_x": 2.0915751,
-          "top_right_y": 2.0915751,
-          "bottom_right_x": 4.1831503,
-          "bottom_right_y": 4.1831503,
-          "bottom_left_x": 4.1831503,
-          "bottom_left_y": 4.1831503
+          "top_left_x": 3.6674318,
+          "top_left_y": 3.6674318,
+          "top_right_x": 3.6674318,
+          "top_right_y": 3.6674318,
+          "bottom_right_x": 7.3348637,
+          "bottom_right_y": 7.3348637,
+          "bottom_left_x": 7.3348637,
+          "bottom_left_y": 7.3348637
         },
         {
-          "top_left_x": 1.4640827,
-          "top_left_y": 1.4640827,
-          "top_right_x": 1.4640827,
-          "top_right_y": 1.4640827,
-          "bottom_right_x": 2.9281654,
-          "bottom_right_y": 2.9281654,
-          "bottom_left_x": 2.9281654,
-          "bottom_left_y": 2.9281654
+          "top_left_x": 2.4832253,
+          "top_left_y": 2.4832253,
+          "top_right_x": 2.4832253,
+          "top_right_y": 2.4832253,
+          "bottom_right_x": 4.9664507,
+          "bottom_right_y": 4.9664507,
+          "bottom_left_x": 4.9664507,
+          "bottom_left_y": 4.9664507
         },
         {
-          "top_left_x": 1.057313,
-          "top_left_y": 1.057313,
-          "top_right_x": 1.057313,
-          "top_right_y": 1.057313,
-          "bottom_right_x": 2.114626,
-          "bottom_right_y": 2.114626,
-          "bottom_left_x": 2.114626,
-          "bottom_left_y": 2.114626
+          "top_left_x": 1.8252907,
+          "top_left_y": 1.8252907,
+          "top_right_x": 1.8252907,
+          "top_right_y": 1.8252907,
+          "bottom_right_x": 3.6505814,
+          "bottom_right_y": 3.6505814,
+          "bottom_left_x": 3.6505814,
+          "bottom_left_y": 3.6505814
         },
         {
-          "top_left_x": 0.7824335,
-          "top_left_y": 0.7824335,
-          "top_right_x": 0.7824335,
-          "top_right_y": 0.7824335,
-          "bottom_right_x": 1.564867,
-          "bottom_right_y": 1.564867,
-          "bottom_left_x": 1.564867,
-          "bottom_left_y": 1.564867
+          "top_left_x": 1.4077549,
+          "top_left_y": 1.4077549,
+          "top_right_x": 1.4077549,
+          "top_right_y": 1.4077549,
+          "bottom_right_x": 2.8155098,
+          "bottom_right_y": 2.8155098,
+          "bottom_left_x": 2.8155098,
+          "bottom_left_y": 2.8155098
         },
         {
-          "top_left_x": 0.5863056,
-          "top_left_y": 0.5863056,
-          "top_right_x": 0.5863056,
-          "top_right_y": 0.5863056,
-          "bottom_right_x": 1.1726112,
-          "bottom_right_y": 1.1726112,
-          "bottom_left_x": 1.1726112,
-          "bottom_left_y": 1.1726112
+          "top_left_x": 1.1067667,
+          "top_left_y": 1.1067667,
+          "top_right_x": 1.1067667,
+          "top_right_y": 1.1067667,
+          "bottom_right_x": 2.2135334,
+          "bottom_right_y": 2.2135334,
+          "bottom_left_x": 2.2135334,
+          "bottom_left_y": 2.2135334
         },
         {
-          "top_left_x": 0.4332962,
-          "top_left_y": 0.4332962,
-          "top_right_x": 0.4332962,
-          "top_right_y": 0.4332962,
-          "bottom_right_x": 0.8665924,
-          "bottom_right_y": 0.8665924,
-          "bottom_left_x": 0.8665924,
-          "bottom_left_y": 0.8665924
+          "top_left_x": 0.88593864,
+          "top_left_y": 0.88593864,
+          "top_right_x": 0.88593864,
+          "top_right_y": 0.88593864,
+          "bottom_right_x": 1.7718773,
+          "bottom_right_y": 1.7718773,
+          "bottom_left_x": 1.7718773,
+          "bottom_left_y": 1.7718773
         },
         {
-          "top_left_x": 0.3145876,
-          "top_left_y": 0.3145876,
-          "top_right_x": 0.3145876,
-          "top_right_y": 0.3145876,
-          "bottom_right_x": 0.6291752,
-          "bottom_right_y": 0.6291752,
-          "bottom_left_x": 0.6291752,
-          "bottom_left_y": 0.6291752
+          "top_left_x": 0.7069988,
+          "top_left_y": 0.7069988,
+          "top_right_x": 0.7069988,
+          "top_right_y": 0.7069988,
+          "bottom_right_x": 1.4139977,
+          "bottom_right_y": 1.4139977,
+          "bottom_left_x": 1.4139977,
+          "bottom_left_y": 1.4139977
         },
         {
-          "top_left_x": 0.22506618,
-          "top_left_y": 0.22506618,
-          "top_right_x": 0.22506618,
-          "top_right_y": 0.22506618,
-          "bottom_right_x": 0.45013237,
-          "bottom_right_y": 0.45013237,
-          "bottom_left_x": 0.45013237,
-          "bottom_left_y": 0.45013237
+          "top_left_x": 0.55613136,
+          "top_left_y": 0.55613136,
+          "top_right_x": 0.55613136,
+          "top_right_y": 0.55613136,
+          "bottom_right_x": 1.1122627,
+          "bottom_right_y": 1.1122627,
+          "bottom_left_x": 1.1122627,
+          "bottom_left_y": 1.1122627
         },
         {
-          "top_left_x": 0.15591621,
-          "top_left_y": 0.15591621,
-          "top_right_x": 0.15591621,
-          "top_right_y": 0.15591621,
-          "bottom_right_x": 0.31183243,
-          "bottom_right_y": 0.31183243,
-          "bottom_left_x": 0.31183243,
-          "bottom_left_y": 0.31183243
+          "top_left_x": 0.44889355,
+          "top_left_y": 0.44889355,
+          "top_right_x": 0.44889355,
+          "top_right_y": 0.44889355,
+          "bottom_right_x": 0.8977871,
+          "bottom_right_y": 0.8977871,
+          "bottom_left_x": 0.8977871,
+          "bottom_left_y": 0.8977871
         },
         {
-          "top_left_x": 0.100948334,
-          "top_left_y": 0.100948334,
-          "top_right_x": 0.100948334,
-          "top_right_y": 0.100948334,
-          "bottom_right_x": 0.20189667,
-          "bottom_right_y": 0.20189667,
-          "bottom_left_x": 0.20189667,
-          "bottom_left_y": 0.20189667
+          "top_left_x": 0.34557533,
+          "top_left_y": 0.34557533,
+          "top_right_x": 0.34557533,
+          "top_right_y": 0.34557533,
+          "bottom_right_x": 0.69115067,
+          "bottom_right_y": 0.69115067,
+          "bottom_left_x": 0.69115067,
+          "bottom_left_y": 0.69115067
         },
         {
-          "top_left_x": 0.06496239,
-          "top_left_y": 0.06496239,
-          "top_right_x": 0.06496239,
-          "top_right_y": 0.06496239,
-          "bottom_right_x": 0.12992477,
-          "bottom_right_y": 0.12992477,
-          "bottom_left_x": 0.12992477,
-          "bottom_left_y": 0.12992477
+          "top_left_x": 0.27671337,
+          "top_left_y": 0.27671337,
+          "top_right_x": 0.27671337,
+          "top_right_y": 0.27671337,
+          "bottom_right_x": 0.55342674,
+          "bottom_right_y": 0.55342674,
+          "bottom_left_x": 0.55342674,
+          "bottom_left_y": 0.55342674
         },
         {
-          "top_left_x": 0.03526497,
-          "top_left_y": 0.03526497,
-          "top_right_x": 0.03526497,
-          "top_right_y": 0.03526497,
-          "bottom_right_x": 0.07052994,
-          "bottom_right_y": 0.07052994,
-          "bottom_left_x": 0.07052994,
-          "bottom_left_y": 0.07052994
+          "top_left_x": 0.20785141,
+          "top_left_y": 0.20785141,
+          "top_right_x": 0.20785141,
+          "top_right_y": 0.20785141,
+          "bottom_right_x": 0.41570282,
+          "bottom_right_y": 0.41570282,
+          "bottom_left_x": 0.41570282,
+          "bottom_left_y": 0.41570282
         },
         {
-          "top_left_x": 0.014661789,
-          "top_left_y": 0.014661789,
-          "top_right_x": 0.014661789,
-          "top_right_y": 0.014661789,
-          "bottom_right_x": 0.029323578,
-          "bottom_right_y": 0.029323578,
-          "bottom_left_x": 0.029323578,
-          "bottom_left_y": 0.029323578
+          "top_left_x": 0.1601448,
+          "top_left_y": 0.1601448,
+          "top_right_x": 0.1601448,
+          "top_right_y": 0.1601448,
+          "bottom_right_x": 0.3202896,
+          "bottom_right_y": 0.3202896,
+          "bottom_left_x": 0.3202896,
+          "bottom_left_y": 0.3202896
         },
         {
-          "top_left_x": 0.0041856766,
-          "top_left_y": 0.0041856766,
-          "top_right_x": 0.0041856766,
-          "top_right_y": 0.0041856766,
-          "bottom_right_x": 0.008371353,
-          "bottom_right_y": 0.008371353,
-          "bottom_left_x": 0.008371353,
-          "bottom_left_y": 0.008371353
+          "top_left_x": 0.117860794,
+          "top_left_y": 0.117860794,
+          "top_right_x": 0.117860794,
+          "top_right_y": 0.117860794,
+          "bottom_right_x": 0.23572159,
+          "bottom_right_y": 0.23572159,
+          "bottom_left_x": 0.23572159,
+          "bottom_left_y": 0.23572159
+        },
+        {
+          "top_left_x": 0.08036041,
+          "top_left_y": 0.08036041,
+          "top_right_x": 0.08036041,
+          "top_right_y": 0.08036041,
+          "bottom_right_x": 0.16072083,
+          "bottom_right_y": 0.16072083,
+          "bottom_left_x": 0.16072083,
+          "bottom_left_y": 0.16072083
+        },
+        {
+          "top_left_x": 0.05836296,
+          "top_left_y": 0.05836296,
+          "top_right_x": 0.05836296,
+          "top_right_y": 0.05836296,
+          "bottom_right_x": 0.11672592,
+          "bottom_right_y": 0.11672592,
+          "bottom_left_x": 0.11672592,
+          "bottom_left_y": 0.11672592
+        },
+        {
+          "top_left_x": 0.03636551,
+          "top_left_y": 0.03636551,
+          "top_right_x": 0.03636551,
+          "top_right_y": 0.03636551,
+          "bottom_right_x": 0.07273102,
+          "bottom_right_y": 0.07273102,
+          "bottom_left_x": 0.07273102,
+          "bottom_left_y": 0.07273102
+        },
+        {
+          "top_left_x": 0.018137932,
+          "top_left_y": 0.018137932,
+          "top_right_x": 0.018137932,
+          "top_right_y": 0.018137932,
+          "bottom_right_x": 0.036275864,
+          "bottom_right_y": 0.036275864,
+          "bottom_left_x": 0.036275864,
+          "bottom_left_y": 0.036275864
+        },
+        {
+          "top_left_x": 0.0082063675,
+          "top_left_y": 0.0082063675,
+          "top_right_x": 0.0082063675,
+          "top_right_y": 0.0082063675,
+          "bottom_right_x": 0.016412735,
+          "bottom_right_y": 0.016412735,
+          "bottom_left_x": 0.016412735,
+          "bottom_left_y": 0.016412735
+        },
+        {
+          "top_left_x": 0.0031013489,
+          "top_left_y": 0.0031013489,
+          "top_right_x": 0.0031013489,
+          "top_right_y": 0.0031013489,
+          "bottom_right_x": 0.0062026978,
+          "bottom_right_y": 0.0062026978,
+          "bottom_left_x": 0.0062026978,
+          "bottom_left_y": 0.0062026978
         },
         {
           "top_left_x": 0,
@@ -367,12 +461,17 @@
       "type": "int",
       "data_points": [
         0,
-        0,
-        115,
-        178,
-        217,
-        241,
-        253,
+        96,
+        153,
+        192,
+        220,
+        238,
+        249,
+        254,
+        255,
+        255,
+        255,
+        255,
         255,
         255,
         255,
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching_withSpring.json b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching_withSpring.json
new file mode 100644
index 0000000..18eedd4
--- /dev/null
+++ b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenLaunching_withSpring.json
@@ -0,0 +1,375 @@
+{
+  "frame_ids": [
+    0,
+    16,
+    32,
+    48,
+    64,
+    80,
+    96,
+    112,
+    128,
+    144,
+    160,
+    176,
+    192,
+    208,
+    224,
+    240,
+    256,
+    272,
+    288,
+    304
+  ],
+  "features": [
+    {
+      "name": "bounds",
+      "type": "rect",
+      "data_points": [
+        {
+          "left": 0,
+          "top": 0,
+          "right": 0,
+          "bottom": 0
+        },
+        {
+          "left": 94,
+          "top": 284,
+          "right": 206,
+          "bottom": 414
+        },
+        {
+          "left": 83,
+          "top": 251,
+          "right": 219,
+          "bottom": 447
+        },
+        {
+          "left": 70,
+          "top": 212,
+          "right": 234,
+          "bottom": 485
+        },
+        {
+          "left": 57,
+          "top": 173,
+          "right": 250,
+          "bottom": 522
+        },
+        {
+          "left": 46,
+          "top": 139,
+          "right": 264,
+          "bottom": 555
+        },
+        {
+          "left": 36,
+          "top": 109,
+          "right": 276,
+          "bottom": 584
+        },
+        {
+          "left": 28,
+          "top": 84,
+          "right": 285,
+          "bottom": 608
+        },
+        {
+          "left": 21,
+          "top": 65,
+          "right": 293,
+          "bottom": 627
+        },
+        {
+          "left": 16,
+          "top": 49,
+          "right": 300,
+          "bottom": 642
+        },
+        {
+          "left": 12,
+          "top": 36,
+          "right": 305,
+          "bottom": 653
+        },
+        {
+          "left": 9,
+          "top": 27,
+          "right": 308,
+          "bottom": 662
+        },
+        {
+          "left": 7,
+          "top": 20,
+          "right": 312,
+          "bottom": 669
+        },
+        {
+          "left": 5,
+          "top": 14,
+          "right": 314,
+          "bottom": 675
+        },
+        {
+          "left": 4,
+          "top": 11,
+          "right": 315,
+          "bottom": 678
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 316,
+          "bottom": 681
+        },
+        {
+          "left": 2,
+          "top": 5,
+          "right": 317,
+          "bottom": 684
+        },
+        {
+          "left": 1,
+          "top": 4,
+          "right": 318,
+          "bottom": 685
+        },
+        {
+          "left": 1,
+          "top": 3,
+          "right": 318,
+          "bottom": 686
+        },
+        {
+          "left": 0,
+          "top": 2,
+          "right": 319,
+          "bottom": 687
+        }
+      ]
+    },
+    {
+      "name": "corner_radii",
+      "type": "cornerRadii",
+      "data_points": [
+        null,
+        {
+          "top_left_x": 9.492916,
+          "top_left_y": 9.492916,
+          "top_right_x": 9.492916,
+          "top_right_y": 9.492916,
+          "bottom_right_x": 18.985832,
+          "bottom_right_y": 18.985832,
+          "bottom_left_x": 18.985832,
+          "bottom_left_y": 18.985832
+        },
+        {
+          "top_left_x": 8.381761,
+          "top_left_y": 8.381761,
+          "top_right_x": 8.381761,
+          "top_right_y": 8.381761,
+          "bottom_right_x": 16.763521,
+          "bottom_right_y": 16.763521,
+          "bottom_left_x": 16.763521,
+          "bottom_left_y": 16.763521
+        },
+        {
+          "top_left_x": 7.07397,
+          "top_left_y": 7.07397,
+          "top_right_x": 7.07397,
+          "top_right_y": 7.07397,
+          "bottom_right_x": 14.14794,
+          "bottom_right_y": 14.14794,
+          "bottom_left_x": 14.14794,
+          "bottom_left_y": 14.14794
+        },
+        {
+          "top_left_x": 5.7880254,
+          "top_left_y": 5.7880254,
+          "top_right_x": 5.7880254,
+          "top_right_y": 5.7880254,
+          "bottom_right_x": 11.576051,
+          "bottom_right_y": 11.576051,
+          "bottom_left_x": 11.576051,
+          "bottom_left_y": 11.576051
+        },
+        {
+          "top_left_x": 4.6295347,
+          "top_left_y": 4.6295347,
+          "top_right_x": 4.6295347,
+          "top_right_y": 4.6295347,
+          "bottom_right_x": 9.259069,
+          "bottom_right_y": 9.259069,
+          "bottom_left_x": 9.259069,
+          "bottom_left_y": 9.259069
+        },
+        {
+          "top_left_x": 3.638935,
+          "top_left_y": 3.638935,
+          "top_right_x": 3.638935,
+          "top_right_y": 3.638935,
+          "bottom_right_x": 7.27787,
+          "bottom_right_y": 7.27787,
+          "bottom_left_x": 7.27787,
+          "bottom_left_y": 7.27787
+        },
+        {
+          "top_left_x": 2.8209057,
+          "top_left_y": 2.8209057,
+          "top_right_x": 2.8209057,
+          "top_right_y": 2.8209057,
+          "bottom_right_x": 5.6418114,
+          "bottom_right_y": 5.6418114,
+          "bottom_left_x": 5.6418114,
+          "bottom_left_y": 5.6418114
+        },
+        {
+          "top_left_x": 2.1620893,
+          "top_left_y": 2.1620893,
+          "top_right_x": 2.1620893,
+          "top_right_y": 2.1620893,
+          "bottom_right_x": 4.3241787,
+          "bottom_right_y": 4.3241787,
+          "bottom_left_x": 4.3241787,
+          "bottom_left_y": 4.3241787
+        },
+        {
+          "top_left_x": 1.6414614,
+          "top_left_y": 1.6414614,
+          "top_right_x": 1.6414614,
+          "top_right_y": 1.6414614,
+          "bottom_right_x": 3.2829227,
+          "bottom_right_y": 3.2829227,
+          "bottom_left_x": 3.2829227,
+          "bottom_left_y": 3.2829227
+        },
+        {
+          "top_left_x": 1.2361269,
+          "top_left_y": 1.2361269,
+          "top_right_x": 1.2361269,
+          "top_right_y": 1.2361269,
+          "bottom_right_x": 2.4722538,
+          "bottom_right_y": 2.4722538,
+          "bottom_left_x": 2.4722538,
+          "bottom_left_y": 2.4722538
+        },
+        {
+          "top_left_x": 0.92435074,
+          "top_left_y": 0.92435074,
+          "top_right_x": 0.92435074,
+          "top_right_y": 0.92435074,
+          "bottom_right_x": 1.8487015,
+          "bottom_right_y": 1.8487015,
+          "bottom_left_x": 1.8487015,
+          "bottom_left_y": 1.8487015
+        },
+        {
+          "top_left_x": 0.68693924,
+          "top_left_y": 0.68693924,
+          "top_right_x": 0.68693924,
+          "top_right_y": 0.68693924,
+          "bottom_right_x": 1.3738785,
+          "bottom_right_y": 1.3738785,
+          "bottom_left_x": 1.3738785,
+          "bottom_left_y": 1.3738785
+        },
+        {
+          "top_left_x": 0.5076904,
+          "top_left_y": 0.5076904,
+          "top_right_x": 0.5076904,
+          "top_right_y": 0.5076904,
+          "bottom_right_x": 1.0153809,
+          "bottom_right_y": 1.0153809,
+          "bottom_left_x": 1.0153809,
+          "bottom_left_y": 1.0153809
+        },
+        {
+          "top_left_x": 0.3733511,
+          "top_left_y": 0.3733511,
+          "top_right_x": 0.3733511,
+          "top_right_y": 0.3733511,
+          "bottom_right_x": 0.7467022,
+          "bottom_right_y": 0.7467022,
+          "bottom_left_x": 0.7467022,
+          "bottom_left_y": 0.7467022
+        },
+        {
+          "top_left_x": 0.27331638,
+          "top_left_y": 0.27331638,
+          "top_right_x": 0.27331638,
+          "top_right_y": 0.27331638,
+          "bottom_right_x": 0.54663277,
+          "bottom_right_y": 0.54663277,
+          "bottom_left_x": 0.54663277,
+          "bottom_left_y": 0.54663277
+        },
+        {
+          "top_left_x": 0.19925308,
+          "top_left_y": 0.19925308,
+          "top_right_x": 0.19925308,
+          "top_right_y": 0.19925308,
+          "bottom_right_x": 0.39850616,
+          "bottom_right_y": 0.39850616,
+          "bottom_left_x": 0.39850616,
+          "bottom_left_y": 0.39850616
+        },
+        {
+          "top_left_x": 0.14470005,
+          "top_left_y": 0.14470005,
+          "top_right_x": 0.14470005,
+          "top_right_y": 0.14470005,
+          "bottom_right_x": 0.2894001,
+          "bottom_right_y": 0.2894001,
+          "bottom_left_x": 0.2894001,
+          "bottom_left_y": 0.2894001
+        },
+        {
+          "top_left_x": 0.10470486,
+          "top_left_y": 0.10470486,
+          "top_right_x": 0.10470486,
+          "top_right_y": 0.10470486,
+          "bottom_right_x": 0.20940971,
+          "bottom_right_y": 0.20940971,
+          "bottom_left_x": 0.20940971,
+          "bottom_left_y": 0.20940971
+        },
+        {
+          "top_left_x": 0.07550812,
+          "top_left_y": 0.07550812,
+          "top_right_x": 0.07550812,
+          "top_right_y": 0.07550812,
+          "bottom_right_x": 0.15101624,
+          "bottom_right_y": 0.15101624,
+          "bottom_left_x": 0.15101624,
+          "bottom_left_y": 0.15101624
+        }
+      ]
+    },
+    {
+      "name": "alpha",
+      "type": "int",
+      "data_points": [
+        0,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        249,
+        226,
+        192,
+        153,
+        112,
+        72,
+        34,
+        0,
+        0,
+        0
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning.json b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning.json
index ea768c0..98005c5 100644
--- a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning.json
+++ b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning.json
@@ -1,25 +1,30 @@
 {
   "frame_ids": [
-    "before",
     0,
-    26,
-    52,
-    78,
-    105,
-    131,
-    157,
-    184,
-    210,
-    236,
-    263,
-    289,
-    315,
-    342,
-    368,
-    394,
-    421,
-    447,
-    473,
+    20,
+    40,
+    60,
+    80,
+    100,
+    120,
+    140,
+    160,
+    180,
+    200,
+    220,
+    240,
+    260,
+    280,
+    300,
+    320,
+    340,
+    360,
+    380,
+    400,
+    420,
+    440,
+    460,
+    480,
     500
   ],
   "features": [
@@ -28,70 +33,82 @@
       "type": "rect",
       "data_points": [
         {
-          "left": 0,
-          "top": 0,
-          "right": 0,
-          "bottom": 0
-        },
-        {
           "left": 100,
           "top": 300,
           "right": 200,
           "bottom": 400
         },
         {
-          "left": 98,
-          "top": 293,
-          "right": 203,
-          "bottom": 407
+          "left": 99,
+          "top": 296,
+          "right": 202,
+          "bottom": 404
         },
         {
-          "left": 91,
-          "top": 269,
-          "right": 213,
-          "bottom": 430
+          "left": 95,
+          "top": 283,
+          "right": 207,
+          "bottom": 417
         },
         {
-          "left": 71,
-          "top": 206,
-          "right": 240,
-          "bottom": 491
+          "left": 86,
+          "top": 256,
+          "right": 219,
+          "bottom": 443
         },
         {
-          "left": 34,
-          "top": 98,
-          "right": 283,
-          "bottom": 595
+          "left": 68,
+          "top": 198,
+          "right": 243,
+          "bottom": 499
         },
         {
-          "left": 22,
-          "top": 63,
-          "right": 296,
-          "bottom": 629
+          "left": 39,
+          "top": 110,
+          "right": 278,
+          "bottom": 584
+        },
+        {
+          "left": 26,
+          "top": 74,
+          "right": 292,
+          "bottom": 618
+        },
+        {
+          "left": 19,
+          "top": 55,
+          "right": 299,
+          "bottom": 637
         },
         {
           "left": 15,
-          "top": 44,
-          "right": 303,
-          "bottom": 648
+          "top": 42,
+          "right": 304,
+          "bottom": 649
         },
         {
-          "left": 11,
-          "top": 32,
-          "right": 308,
-          "bottom": 659
+          "left": 12,
+          "top": 33,
+          "right": 307,
+          "bottom": 658
         },
         {
-          "left": 8,
-          "top": 23,
-          "right": 311,
-          "bottom": 667
+          "left": 9,
+          "top": 27,
+          "right": 310,
+          "bottom": 664
+        },
+        {
+          "left": 7,
+          "top": 21,
+          "right": 312,
+          "bottom": 669
         },
         {
           "left": 6,
-          "top": 18,
-          "right": 313,
-          "bottom": 673
+          "top": 17,
+          "right": 314,
+          "bottom": 674
         },
         {
           "left": 5,
@@ -100,16 +117,22 @@
           "bottom": 677
         },
         {
-          "left": 3,
-          "top": 9,
+          "left": 4,
+          "top": 10,
           "right": 316,
-          "bottom": 681
+          "bottom": 680
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 317,
+          "bottom": 682
         },
         {
           "left": 2,
-          "top": 7,
-          "right": 317,
-          "bottom": 683
+          "top": 6,
+          "right": 318,
+          "bottom": 684
         },
         {
           "left": 2,
@@ -119,7 +142,7 @@
         },
         {
           "left": 1,
-          "top": 3,
+          "top": 4,
           "right": 319,
           "bottom": 687
         },
@@ -130,6 +153,18 @@
           "bottom": 688
         },
         {
+          "left": 1,
+          "top": 2,
+          "right": 319,
+          "bottom": 688
+        },
+        {
+          "left": 0,
+          "top": 1,
+          "right": 320,
+          "bottom": 689
+        },
+        {
           "left": 0,
           "top": 1,
           "right": 320,
@@ -159,7 +194,6 @@
       "name": "corner_radii",
       "type": "cornerRadii",
       "data_points": [
-        null,
         {
           "top_left_x": 10,
           "top_left_y": 10,
@@ -171,184 +205,244 @@
           "bottom_left_y": 20
         },
         {
-          "top_left_x": 9.762664,
-          "top_left_y": 9.762664,
-          "top_right_x": 9.762664,
-          "top_right_y": 9.762664,
-          "bottom_right_x": 19.525328,
-          "bottom_right_y": 19.525328,
-          "bottom_left_x": 19.525328,
-          "bottom_left_y": 19.525328
+          "top_left_x": 9.865689,
+          "top_left_y": 9.865689,
+          "top_right_x": 9.865689,
+          "top_right_y": 9.865689,
+          "bottom_right_x": 19.731379,
+          "bottom_right_y": 19.731379,
+          "bottom_left_x": 19.731379,
+          "bottom_left_y": 19.731379
         },
         {
-          "top_left_x": 8.969244,
-          "top_left_y": 8.969244,
-          "top_right_x": 8.969244,
-          "top_right_y": 8.969244,
-          "bottom_right_x": 17.938488,
-          "bottom_right_y": 17.938488,
-          "bottom_left_x": 17.938488,
-          "bottom_left_y": 17.938488
+          "top_left_x": 9.419104,
+          "top_left_y": 9.419104,
+          "top_right_x": 9.419104,
+          "top_right_y": 9.419104,
+          "bottom_right_x": 18.838207,
+          "bottom_right_y": 18.838207,
+          "bottom_left_x": 18.838207,
+          "bottom_left_y": 18.838207
         },
         {
-          "top_left_x": 6.8709626,
-          "top_left_y": 6.8709626,
-          "top_right_x": 6.8709626,
-          "top_right_y": 6.8709626,
-          "bottom_right_x": 13.741925,
-          "bottom_right_y": 13.741925,
-          "bottom_left_x": 13.741925,
-          "bottom_left_y": 13.741925
+          "top_left_x": 8.533693,
+          "top_left_y": 8.533693,
+          "top_right_x": 8.533693,
+          "top_right_y": 8.533693,
+          "bottom_right_x": 17.067387,
+          "bottom_right_y": 17.067387,
+          "bottom_left_x": 17.067387,
+          "bottom_left_y": 17.067387
         },
         {
-          "top_left_x": 3.260561,
-          "top_left_y": 3.260561,
-          "top_right_x": 3.260561,
-          "top_right_y": 3.260561,
-          "bottom_right_x": 6.521122,
-          "bottom_right_y": 6.521122,
-          "bottom_left_x": 6.521122,
-          "bottom_left_y": 6.521122
+          "top_left_x": 6.5919456,
+          "top_left_y": 6.5919456,
+          "top_right_x": 6.5919456,
+          "top_right_y": 6.5919456,
+          "bottom_right_x": 13.183891,
+          "bottom_right_y": 13.183891,
+          "bottom_left_x": 13.183891,
+          "bottom_left_y": 13.183891
         },
         {
-          "top_left_x": 2.0915751,
-          "top_left_y": 2.0915751,
-          "top_right_x": 2.0915751,
-          "top_right_y": 2.0915751,
-          "bottom_right_x": 4.1831503,
-          "bottom_right_y": 4.1831503,
-          "bottom_left_x": 4.1831503,
-          "bottom_left_y": 4.1831503
+          "top_left_x": 3.6674318,
+          "top_left_y": 3.6674318,
+          "top_right_x": 3.6674318,
+          "top_right_y": 3.6674318,
+          "bottom_right_x": 7.3348637,
+          "bottom_right_y": 7.3348637,
+          "bottom_left_x": 7.3348637,
+          "bottom_left_y": 7.3348637
         },
         {
-          "top_left_x": 1.4640827,
-          "top_left_y": 1.4640827,
-          "top_right_x": 1.4640827,
-          "top_right_y": 1.4640827,
-          "bottom_right_x": 2.9281654,
-          "bottom_right_y": 2.9281654,
-          "bottom_left_x": 2.9281654,
-          "bottom_left_y": 2.9281654
+          "top_left_x": 2.4832253,
+          "top_left_y": 2.4832253,
+          "top_right_x": 2.4832253,
+          "top_right_y": 2.4832253,
+          "bottom_right_x": 4.9664507,
+          "bottom_right_y": 4.9664507,
+          "bottom_left_x": 4.9664507,
+          "bottom_left_y": 4.9664507
         },
         {
-          "top_left_x": 1.057313,
-          "top_left_y": 1.057313,
-          "top_right_x": 1.057313,
-          "top_right_y": 1.057313,
-          "bottom_right_x": 2.114626,
-          "bottom_right_y": 2.114626,
-          "bottom_left_x": 2.114626,
-          "bottom_left_y": 2.114626
+          "top_left_x": 1.8252907,
+          "top_left_y": 1.8252907,
+          "top_right_x": 1.8252907,
+          "top_right_y": 1.8252907,
+          "bottom_right_x": 3.6505814,
+          "bottom_right_y": 3.6505814,
+          "bottom_left_x": 3.6505814,
+          "bottom_left_y": 3.6505814
         },
         {
-          "top_left_x": 0.7824335,
-          "top_left_y": 0.7824335,
-          "top_right_x": 0.7824335,
-          "top_right_y": 0.7824335,
-          "bottom_right_x": 1.564867,
-          "bottom_right_y": 1.564867,
-          "bottom_left_x": 1.564867,
-          "bottom_left_y": 1.564867
+          "top_left_x": 1.4077549,
+          "top_left_y": 1.4077549,
+          "top_right_x": 1.4077549,
+          "top_right_y": 1.4077549,
+          "bottom_right_x": 2.8155098,
+          "bottom_right_y": 2.8155098,
+          "bottom_left_x": 2.8155098,
+          "bottom_left_y": 2.8155098
         },
         {
-          "top_left_x": 0.5863056,
-          "top_left_y": 0.5863056,
-          "top_right_x": 0.5863056,
-          "top_right_y": 0.5863056,
-          "bottom_right_x": 1.1726112,
-          "bottom_right_y": 1.1726112,
-          "bottom_left_x": 1.1726112,
-          "bottom_left_y": 1.1726112
+          "top_left_x": 1.1067667,
+          "top_left_y": 1.1067667,
+          "top_right_x": 1.1067667,
+          "top_right_y": 1.1067667,
+          "bottom_right_x": 2.2135334,
+          "bottom_right_y": 2.2135334,
+          "bottom_left_x": 2.2135334,
+          "bottom_left_y": 2.2135334
         },
         {
-          "top_left_x": 0.4332962,
-          "top_left_y": 0.4332962,
-          "top_right_x": 0.4332962,
-          "top_right_y": 0.4332962,
-          "bottom_right_x": 0.8665924,
-          "bottom_right_y": 0.8665924,
-          "bottom_left_x": 0.8665924,
-          "bottom_left_y": 0.8665924
+          "top_left_x": 0.88593864,
+          "top_left_y": 0.88593864,
+          "top_right_x": 0.88593864,
+          "top_right_y": 0.88593864,
+          "bottom_right_x": 1.7718773,
+          "bottom_right_y": 1.7718773,
+          "bottom_left_x": 1.7718773,
+          "bottom_left_y": 1.7718773
         },
         {
-          "top_left_x": 0.3145876,
-          "top_left_y": 0.3145876,
-          "top_right_x": 0.3145876,
-          "top_right_y": 0.3145876,
-          "bottom_right_x": 0.6291752,
-          "bottom_right_y": 0.6291752,
-          "bottom_left_x": 0.6291752,
-          "bottom_left_y": 0.6291752
+          "top_left_x": 0.7069988,
+          "top_left_y": 0.7069988,
+          "top_right_x": 0.7069988,
+          "top_right_y": 0.7069988,
+          "bottom_right_x": 1.4139977,
+          "bottom_right_y": 1.4139977,
+          "bottom_left_x": 1.4139977,
+          "bottom_left_y": 1.4139977
         },
         {
-          "top_left_x": 0.22506618,
-          "top_left_y": 0.22506618,
-          "top_right_x": 0.22506618,
-          "top_right_y": 0.22506618,
-          "bottom_right_x": 0.45013237,
-          "bottom_right_y": 0.45013237,
-          "bottom_left_x": 0.45013237,
-          "bottom_left_y": 0.45013237
+          "top_left_x": 0.55613136,
+          "top_left_y": 0.55613136,
+          "top_right_x": 0.55613136,
+          "top_right_y": 0.55613136,
+          "bottom_right_x": 1.1122627,
+          "bottom_right_y": 1.1122627,
+          "bottom_left_x": 1.1122627,
+          "bottom_left_y": 1.1122627
         },
         {
-          "top_left_x": 0.15591621,
-          "top_left_y": 0.15591621,
-          "top_right_x": 0.15591621,
-          "top_right_y": 0.15591621,
-          "bottom_right_x": 0.31183243,
-          "bottom_right_y": 0.31183243,
-          "bottom_left_x": 0.31183243,
-          "bottom_left_y": 0.31183243
+          "top_left_x": 0.44889355,
+          "top_left_y": 0.44889355,
+          "top_right_x": 0.44889355,
+          "top_right_y": 0.44889355,
+          "bottom_right_x": 0.8977871,
+          "bottom_right_y": 0.8977871,
+          "bottom_left_x": 0.8977871,
+          "bottom_left_y": 0.8977871
         },
         {
-          "top_left_x": 0.100948334,
-          "top_left_y": 0.100948334,
-          "top_right_x": 0.100948334,
-          "top_right_y": 0.100948334,
-          "bottom_right_x": 0.20189667,
-          "bottom_right_y": 0.20189667,
-          "bottom_left_x": 0.20189667,
-          "bottom_left_y": 0.20189667
+          "top_left_x": 0.34557533,
+          "top_left_y": 0.34557533,
+          "top_right_x": 0.34557533,
+          "top_right_y": 0.34557533,
+          "bottom_right_x": 0.69115067,
+          "bottom_right_y": 0.69115067,
+          "bottom_left_x": 0.69115067,
+          "bottom_left_y": 0.69115067
         },
         {
-          "top_left_x": 0.06496239,
-          "top_left_y": 0.06496239,
-          "top_right_x": 0.06496239,
-          "top_right_y": 0.06496239,
-          "bottom_right_x": 0.12992477,
-          "bottom_right_y": 0.12992477,
-          "bottom_left_x": 0.12992477,
-          "bottom_left_y": 0.12992477
+          "top_left_x": 0.27671337,
+          "top_left_y": 0.27671337,
+          "top_right_x": 0.27671337,
+          "top_right_y": 0.27671337,
+          "bottom_right_x": 0.55342674,
+          "bottom_right_y": 0.55342674,
+          "bottom_left_x": 0.55342674,
+          "bottom_left_y": 0.55342674
         },
         {
-          "top_left_x": 0.03526497,
-          "top_left_y": 0.03526497,
-          "top_right_x": 0.03526497,
-          "top_right_y": 0.03526497,
-          "bottom_right_x": 0.07052994,
-          "bottom_right_y": 0.07052994,
-          "bottom_left_x": 0.07052994,
-          "bottom_left_y": 0.07052994
+          "top_left_x": 0.20785141,
+          "top_left_y": 0.20785141,
+          "top_right_x": 0.20785141,
+          "top_right_y": 0.20785141,
+          "bottom_right_x": 0.41570282,
+          "bottom_right_y": 0.41570282,
+          "bottom_left_x": 0.41570282,
+          "bottom_left_y": 0.41570282
         },
         {
-          "top_left_x": 0.014661789,
-          "top_left_y": 0.014661789,
-          "top_right_x": 0.014661789,
-          "top_right_y": 0.014661789,
-          "bottom_right_x": 0.029323578,
-          "bottom_right_y": 0.029323578,
-          "bottom_left_x": 0.029323578,
-          "bottom_left_y": 0.029323578
+          "top_left_x": 0.1601448,
+          "top_left_y": 0.1601448,
+          "top_right_x": 0.1601448,
+          "top_right_y": 0.1601448,
+          "bottom_right_x": 0.3202896,
+          "bottom_right_y": 0.3202896,
+          "bottom_left_x": 0.3202896,
+          "bottom_left_y": 0.3202896
         },
         {
-          "top_left_x": 0.0041856766,
-          "top_left_y": 0.0041856766,
-          "top_right_x": 0.0041856766,
-          "top_right_y": 0.0041856766,
-          "bottom_right_x": 0.008371353,
-          "bottom_right_y": 0.008371353,
-          "bottom_left_x": 0.008371353,
-          "bottom_left_y": 0.008371353
+          "top_left_x": 0.117860794,
+          "top_left_y": 0.117860794,
+          "top_right_x": 0.117860794,
+          "top_right_y": 0.117860794,
+          "bottom_right_x": 0.23572159,
+          "bottom_right_y": 0.23572159,
+          "bottom_left_x": 0.23572159,
+          "bottom_left_y": 0.23572159
+        },
+        {
+          "top_left_x": 0.08036041,
+          "top_left_y": 0.08036041,
+          "top_right_x": 0.08036041,
+          "top_right_y": 0.08036041,
+          "bottom_right_x": 0.16072083,
+          "bottom_right_y": 0.16072083,
+          "bottom_left_x": 0.16072083,
+          "bottom_left_y": 0.16072083
+        },
+        {
+          "top_left_x": 0.05836296,
+          "top_left_y": 0.05836296,
+          "top_right_x": 0.05836296,
+          "top_right_y": 0.05836296,
+          "bottom_right_x": 0.11672592,
+          "bottom_right_y": 0.11672592,
+          "bottom_left_x": 0.11672592,
+          "bottom_left_y": 0.11672592
+        },
+        {
+          "top_left_x": 0.03636551,
+          "top_left_y": 0.03636551,
+          "top_right_x": 0.03636551,
+          "top_right_y": 0.03636551,
+          "bottom_right_x": 0.07273102,
+          "bottom_right_y": 0.07273102,
+          "bottom_left_x": 0.07273102,
+          "bottom_left_y": 0.07273102
+        },
+        {
+          "top_left_x": 0.018137932,
+          "top_left_y": 0.018137932,
+          "top_right_x": 0.018137932,
+          "top_right_y": 0.018137932,
+          "bottom_right_x": 0.036275864,
+          "bottom_right_y": 0.036275864,
+          "bottom_left_x": 0.036275864,
+          "bottom_left_y": 0.036275864
+        },
+        {
+          "top_left_x": 0.0082063675,
+          "top_left_y": 0.0082063675,
+          "top_right_x": 0.0082063675,
+          "top_right_y": 0.0082063675,
+          "bottom_right_x": 0.016412735,
+          "bottom_right_y": 0.016412735,
+          "bottom_left_x": 0.016412735,
+          "bottom_left_y": 0.016412735
+        },
+        {
+          "top_left_x": 0.0031013489,
+          "top_left_y": 0.0031013489,
+          "top_right_x": 0.0031013489,
+          "top_right_y": 0.0031013489,
+          "bottom_right_x": 0.0062026978,
+          "bottom_right_y": 0.0062026978,
+          "bottom_left_x": 0.0062026978,
+          "bottom_left_y": 0.0062026978
         },
         {
           "top_left_x": 0,
@@ -366,20 +460,25 @@
       "name": "alpha",
       "type": "int",
       "data_points": [
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        233,
+        191,
+        153,
+        117,
+        85,
+        57,
+        33,
+        14,
+        3,
         0,
-        255,
-        255,
-        255,
-        255,
-        255,
-        255,
-        239,
-        183,
-        135,
-        91,
-        53,
-        23,
-        5,
+        0,
         0,
         0,
         0,
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning_withSpring.json b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning_withSpring.json
new file mode 100644
index 0000000..18eedd4
--- /dev/null
+++ b/packages/SystemUI/tests/goldens/backgroundAnimationWithoutFade_whenReturning_withSpring.json
@@ -0,0 +1,375 @@
+{
+  "frame_ids": [
+    0,
+    16,
+    32,
+    48,
+    64,
+    80,
+    96,
+    112,
+    128,
+    144,
+    160,
+    176,
+    192,
+    208,
+    224,
+    240,
+    256,
+    272,
+    288,
+    304
+  ],
+  "features": [
+    {
+      "name": "bounds",
+      "type": "rect",
+      "data_points": [
+        {
+          "left": 0,
+          "top": 0,
+          "right": 0,
+          "bottom": 0
+        },
+        {
+          "left": 94,
+          "top": 284,
+          "right": 206,
+          "bottom": 414
+        },
+        {
+          "left": 83,
+          "top": 251,
+          "right": 219,
+          "bottom": 447
+        },
+        {
+          "left": 70,
+          "top": 212,
+          "right": 234,
+          "bottom": 485
+        },
+        {
+          "left": 57,
+          "top": 173,
+          "right": 250,
+          "bottom": 522
+        },
+        {
+          "left": 46,
+          "top": 139,
+          "right": 264,
+          "bottom": 555
+        },
+        {
+          "left": 36,
+          "top": 109,
+          "right": 276,
+          "bottom": 584
+        },
+        {
+          "left": 28,
+          "top": 84,
+          "right": 285,
+          "bottom": 608
+        },
+        {
+          "left": 21,
+          "top": 65,
+          "right": 293,
+          "bottom": 627
+        },
+        {
+          "left": 16,
+          "top": 49,
+          "right": 300,
+          "bottom": 642
+        },
+        {
+          "left": 12,
+          "top": 36,
+          "right": 305,
+          "bottom": 653
+        },
+        {
+          "left": 9,
+          "top": 27,
+          "right": 308,
+          "bottom": 662
+        },
+        {
+          "left": 7,
+          "top": 20,
+          "right": 312,
+          "bottom": 669
+        },
+        {
+          "left": 5,
+          "top": 14,
+          "right": 314,
+          "bottom": 675
+        },
+        {
+          "left": 4,
+          "top": 11,
+          "right": 315,
+          "bottom": 678
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 316,
+          "bottom": 681
+        },
+        {
+          "left": 2,
+          "top": 5,
+          "right": 317,
+          "bottom": 684
+        },
+        {
+          "left": 1,
+          "top": 4,
+          "right": 318,
+          "bottom": 685
+        },
+        {
+          "left": 1,
+          "top": 3,
+          "right": 318,
+          "bottom": 686
+        },
+        {
+          "left": 0,
+          "top": 2,
+          "right": 319,
+          "bottom": 687
+        }
+      ]
+    },
+    {
+      "name": "corner_radii",
+      "type": "cornerRadii",
+      "data_points": [
+        null,
+        {
+          "top_left_x": 9.492916,
+          "top_left_y": 9.492916,
+          "top_right_x": 9.492916,
+          "top_right_y": 9.492916,
+          "bottom_right_x": 18.985832,
+          "bottom_right_y": 18.985832,
+          "bottom_left_x": 18.985832,
+          "bottom_left_y": 18.985832
+        },
+        {
+          "top_left_x": 8.381761,
+          "top_left_y": 8.381761,
+          "top_right_x": 8.381761,
+          "top_right_y": 8.381761,
+          "bottom_right_x": 16.763521,
+          "bottom_right_y": 16.763521,
+          "bottom_left_x": 16.763521,
+          "bottom_left_y": 16.763521
+        },
+        {
+          "top_left_x": 7.07397,
+          "top_left_y": 7.07397,
+          "top_right_x": 7.07397,
+          "top_right_y": 7.07397,
+          "bottom_right_x": 14.14794,
+          "bottom_right_y": 14.14794,
+          "bottom_left_x": 14.14794,
+          "bottom_left_y": 14.14794
+        },
+        {
+          "top_left_x": 5.7880254,
+          "top_left_y": 5.7880254,
+          "top_right_x": 5.7880254,
+          "top_right_y": 5.7880254,
+          "bottom_right_x": 11.576051,
+          "bottom_right_y": 11.576051,
+          "bottom_left_x": 11.576051,
+          "bottom_left_y": 11.576051
+        },
+        {
+          "top_left_x": 4.6295347,
+          "top_left_y": 4.6295347,
+          "top_right_x": 4.6295347,
+          "top_right_y": 4.6295347,
+          "bottom_right_x": 9.259069,
+          "bottom_right_y": 9.259069,
+          "bottom_left_x": 9.259069,
+          "bottom_left_y": 9.259069
+        },
+        {
+          "top_left_x": 3.638935,
+          "top_left_y": 3.638935,
+          "top_right_x": 3.638935,
+          "top_right_y": 3.638935,
+          "bottom_right_x": 7.27787,
+          "bottom_right_y": 7.27787,
+          "bottom_left_x": 7.27787,
+          "bottom_left_y": 7.27787
+        },
+        {
+          "top_left_x": 2.8209057,
+          "top_left_y": 2.8209057,
+          "top_right_x": 2.8209057,
+          "top_right_y": 2.8209057,
+          "bottom_right_x": 5.6418114,
+          "bottom_right_y": 5.6418114,
+          "bottom_left_x": 5.6418114,
+          "bottom_left_y": 5.6418114
+        },
+        {
+          "top_left_x": 2.1620893,
+          "top_left_y": 2.1620893,
+          "top_right_x": 2.1620893,
+          "top_right_y": 2.1620893,
+          "bottom_right_x": 4.3241787,
+          "bottom_right_y": 4.3241787,
+          "bottom_left_x": 4.3241787,
+          "bottom_left_y": 4.3241787
+        },
+        {
+          "top_left_x": 1.6414614,
+          "top_left_y": 1.6414614,
+          "top_right_x": 1.6414614,
+          "top_right_y": 1.6414614,
+          "bottom_right_x": 3.2829227,
+          "bottom_right_y": 3.2829227,
+          "bottom_left_x": 3.2829227,
+          "bottom_left_y": 3.2829227
+        },
+        {
+          "top_left_x": 1.2361269,
+          "top_left_y": 1.2361269,
+          "top_right_x": 1.2361269,
+          "top_right_y": 1.2361269,
+          "bottom_right_x": 2.4722538,
+          "bottom_right_y": 2.4722538,
+          "bottom_left_x": 2.4722538,
+          "bottom_left_y": 2.4722538
+        },
+        {
+          "top_left_x": 0.92435074,
+          "top_left_y": 0.92435074,
+          "top_right_x": 0.92435074,
+          "top_right_y": 0.92435074,
+          "bottom_right_x": 1.8487015,
+          "bottom_right_y": 1.8487015,
+          "bottom_left_x": 1.8487015,
+          "bottom_left_y": 1.8487015
+        },
+        {
+          "top_left_x": 0.68693924,
+          "top_left_y": 0.68693924,
+          "top_right_x": 0.68693924,
+          "top_right_y": 0.68693924,
+          "bottom_right_x": 1.3738785,
+          "bottom_right_y": 1.3738785,
+          "bottom_left_x": 1.3738785,
+          "bottom_left_y": 1.3738785
+        },
+        {
+          "top_left_x": 0.5076904,
+          "top_left_y": 0.5076904,
+          "top_right_x": 0.5076904,
+          "top_right_y": 0.5076904,
+          "bottom_right_x": 1.0153809,
+          "bottom_right_y": 1.0153809,
+          "bottom_left_x": 1.0153809,
+          "bottom_left_y": 1.0153809
+        },
+        {
+          "top_left_x": 0.3733511,
+          "top_left_y": 0.3733511,
+          "top_right_x": 0.3733511,
+          "top_right_y": 0.3733511,
+          "bottom_right_x": 0.7467022,
+          "bottom_right_y": 0.7467022,
+          "bottom_left_x": 0.7467022,
+          "bottom_left_y": 0.7467022
+        },
+        {
+          "top_left_x": 0.27331638,
+          "top_left_y": 0.27331638,
+          "top_right_x": 0.27331638,
+          "top_right_y": 0.27331638,
+          "bottom_right_x": 0.54663277,
+          "bottom_right_y": 0.54663277,
+          "bottom_left_x": 0.54663277,
+          "bottom_left_y": 0.54663277
+        },
+        {
+          "top_left_x": 0.19925308,
+          "top_left_y": 0.19925308,
+          "top_right_x": 0.19925308,
+          "top_right_y": 0.19925308,
+          "bottom_right_x": 0.39850616,
+          "bottom_right_y": 0.39850616,
+          "bottom_left_x": 0.39850616,
+          "bottom_left_y": 0.39850616
+        },
+        {
+          "top_left_x": 0.14470005,
+          "top_left_y": 0.14470005,
+          "top_right_x": 0.14470005,
+          "top_right_y": 0.14470005,
+          "bottom_right_x": 0.2894001,
+          "bottom_right_y": 0.2894001,
+          "bottom_left_x": 0.2894001,
+          "bottom_left_y": 0.2894001
+        },
+        {
+          "top_left_x": 0.10470486,
+          "top_left_y": 0.10470486,
+          "top_right_x": 0.10470486,
+          "top_right_y": 0.10470486,
+          "bottom_right_x": 0.20940971,
+          "bottom_right_y": 0.20940971,
+          "bottom_left_x": 0.20940971,
+          "bottom_left_y": 0.20940971
+        },
+        {
+          "top_left_x": 0.07550812,
+          "top_left_y": 0.07550812,
+          "top_right_x": 0.07550812,
+          "top_right_y": 0.07550812,
+          "bottom_right_x": 0.15101624,
+          "bottom_right_y": 0.15101624,
+          "bottom_left_x": 0.15101624,
+          "bottom_left_y": 0.15101624
+        }
+      ]
+    },
+    {
+      "name": "alpha",
+      "type": "int",
+      "data_points": [
+        0,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        255,
+        249,
+        226,
+        192,
+        153,
+        112,
+        72,
+        34,
+        0,
+        0,
+        0
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching.json b/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching.json
index 608e633..aa80445 100644
--- a/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching.json
+++ b/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching.json
@@ -1,25 +1,30 @@
 {
   "frame_ids": [
-    "before",
     0,
-    26,
-    52,
-    78,
-    105,
-    131,
-    157,
-    184,
-    210,
-    236,
-    263,
-    289,
-    315,
-    342,
-    368,
-    394,
-    421,
-    447,
-    473,
+    20,
+    40,
+    60,
+    80,
+    100,
+    120,
+    140,
+    160,
+    180,
+    200,
+    220,
+    240,
+    260,
+    280,
+    300,
+    320,
+    340,
+    360,
+    380,
+    400,
+    420,
+    440,
+    460,
+    480,
     500
   ],
   "features": [
@@ -28,70 +33,82 @@
       "type": "rect",
       "data_points": [
         {
-          "left": 0,
-          "top": 0,
-          "right": 0,
-          "bottom": 0
-        },
-        {
           "left": 100,
           "top": 300,
           "right": 200,
           "bottom": 400
         },
         {
-          "left": 98,
-          "top": 293,
-          "right": 203,
-          "bottom": 407
+          "left": 99,
+          "top": 296,
+          "right": 202,
+          "bottom": 404
         },
         {
-          "left": 91,
-          "top": 269,
-          "right": 213,
-          "bottom": 430
+          "left": 95,
+          "top": 283,
+          "right": 207,
+          "bottom": 417
         },
         {
-          "left": 71,
-          "top": 206,
-          "right": 240,
-          "bottom": 491
+          "left": 86,
+          "top": 256,
+          "right": 219,
+          "bottom": 443
         },
         {
-          "left": 34,
-          "top": 98,
-          "right": 283,
-          "bottom": 595
+          "left": 68,
+          "top": 198,
+          "right": 243,
+          "bottom": 499
         },
         {
-          "left": 22,
-          "top": 63,
-          "right": 296,
-          "bottom": 629
+          "left": 39,
+          "top": 110,
+          "right": 278,
+          "bottom": 584
+        },
+        {
+          "left": 26,
+          "top": 74,
+          "right": 292,
+          "bottom": 618
+        },
+        {
+          "left": 19,
+          "top": 55,
+          "right": 299,
+          "bottom": 637
         },
         {
           "left": 15,
-          "top": 44,
-          "right": 303,
-          "bottom": 648
+          "top": 42,
+          "right": 304,
+          "bottom": 649
         },
         {
-          "left": 11,
-          "top": 32,
-          "right": 308,
-          "bottom": 659
+          "left": 12,
+          "top": 33,
+          "right": 307,
+          "bottom": 658
         },
         {
-          "left": 8,
-          "top": 23,
-          "right": 311,
-          "bottom": 667
+          "left": 9,
+          "top": 27,
+          "right": 310,
+          "bottom": 664
+        },
+        {
+          "left": 7,
+          "top": 21,
+          "right": 312,
+          "bottom": 669
         },
         {
           "left": 6,
-          "top": 18,
-          "right": 313,
-          "bottom": 673
+          "top": 17,
+          "right": 314,
+          "bottom": 674
         },
         {
           "left": 5,
@@ -100,16 +117,22 @@
           "bottom": 677
         },
         {
-          "left": 3,
-          "top": 9,
+          "left": 4,
+          "top": 10,
           "right": 316,
-          "bottom": 681
+          "bottom": 680
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 317,
+          "bottom": 682
         },
         {
           "left": 2,
-          "top": 7,
-          "right": 317,
-          "bottom": 683
+          "top": 6,
+          "right": 318,
+          "bottom": 684
         },
         {
           "left": 2,
@@ -119,7 +142,7 @@
         },
         {
           "left": 1,
-          "top": 3,
+          "top": 4,
           "right": 319,
           "bottom": 687
         },
@@ -130,6 +153,18 @@
           "bottom": 688
         },
         {
+          "left": 1,
+          "top": 2,
+          "right": 319,
+          "bottom": 688
+        },
+        {
+          "left": 0,
+          "top": 1,
+          "right": 320,
+          "bottom": 689
+        },
+        {
           "left": 0,
           "top": 1,
           "right": 320,
@@ -159,7 +194,6 @@
       "name": "corner_radii",
       "type": "cornerRadii",
       "data_points": [
-        null,
         {
           "top_left_x": 10,
           "top_left_y": 10,
@@ -171,184 +205,244 @@
           "bottom_left_y": 20
         },
         {
-          "top_left_x": 9.762664,
-          "top_left_y": 9.762664,
-          "top_right_x": 9.762664,
-          "top_right_y": 9.762664,
-          "bottom_right_x": 19.525328,
-          "bottom_right_y": 19.525328,
-          "bottom_left_x": 19.525328,
-          "bottom_left_y": 19.525328
+          "top_left_x": 9.865689,
+          "top_left_y": 9.865689,
+          "top_right_x": 9.865689,
+          "top_right_y": 9.865689,
+          "bottom_right_x": 19.731379,
+          "bottom_right_y": 19.731379,
+          "bottom_left_x": 19.731379,
+          "bottom_left_y": 19.731379
         },
         {
-          "top_left_x": 8.969244,
-          "top_left_y": 8.969244,
-          "top_right_x": 8.969244,
-          "top_right_y": 8.969244,
-          "bottom_right_x": 17.938488,
-          "bottom_right_y": 17.938488,
-          "bottom_left_x": 17.938488,
-          "bottom_left_y": 17.938488
+          "top_left_x": 9.419104,
+          "top_left_y": 9.419104,
+          "top_right_x": 9.419104,
+          "top_right_y": 9.419104,
+          "bottom_right_x": 18.838207,
+          "bottom_right_y": 18.838207,
+          "bottom_left_x": 18.838207,
+          "bottom_left_y": 18.838207
         },
         {
-          "top_left_x": 6.8709626,
-          "top_left_y": 6.8709626,
-          "top_right_x": 6.8709626,
-          "top_right_y": 6.8709626,
-          "bottom_right_x": 13.741925,
-          "bottom_right_y": 13.741925,
-          "bottom_left_x": 13.741925,
-          "bottom_left_y": 13.741925
+          "top_left_x": 8.533693,
+          "top_left_y": 8.533693,
+          "top_right_x": 8.533693,
+          "top_right_y": 8.533693,
+          "bottom_right_x": 17.067387,
+          "bottom_right_y": 17.067387,
+          "bottom_left_x": 17.067387,
+          "bottom_left_y": 17.067387
         },
         {
-          "top_left_x": 3.260561,
-          "top_left_y": 3.260561,
-          "top_right_x": 3.260561,
-          "top_right_y": 3.260561,
-          "bottom_right_x": 6.521122,
-          "bottom_right_y": 6.521122,
-          "bottom_left_x": 6.521122,
-          "bottom_left_y": 6.521122
+          "top_left_x": 6.5919456,
+          "top_left_y": 6.5919456,
+          "top_right_x": 6.5919456,
+          "top_right_y": 6.5919456,
+          "bottom_right_x": 13.183891,
+          "bottom_right_y": 13.183891,
+          "bottom_left_x": 13.183891,
+          "bottom_left_y": 13.183891
         },
         {
-          "top_left_x": 2.0915751,
-          "top_left_y": 2.0915751,
-          "top_right_x": 2.0915751,
-          "top_right_y": 2.0915751,
-          "bottom_right_x": 4.1831503,
-          "bottom_right_y": 4.1831503,
-          "bottom_left_x": 4.1831503,
-          "bottom_left_y": 4.1831503
+          "top_left_x": 3.6674318,
+          "top_left_y": 3.6674318,
+          "top_right_x": 3.6674318,
+          "top_right_y": 3.6674318,
+          "bottom_right_x": 7.3348637,
+          "bottom_right_y": 7.3348637,
+          "bottom_left_x": 7.3348637,
+          "bottom_left_y": 7.3348637
         },
         {
-          "top_left_x": 1.4640827,
-          "top_left_y": 1.4640827,
-          "top_right_x": 1.4640827,
-          "top_right_y": 1.4640827,
-          "bottom_right_x": 2.9281654,
-          "bottom_right_y": 2.9281654,
-          "bottom_left_x": 2.9281654,
-          "bottom_left_y": 2.9281654
+          "top_left_x": 2.4832253,
+          "top_left_y": 2.4832253,
+          "top_right_x": 2.4832253,
+          "top_right_y": 2.4832253,
+          "bottom_right_x": 4.9664507,
+          "bottom_right_y": 4.9664507,
+          "bottom_left_x": 4.9664507,
+          "bottom_left_y": 4.9664507
         },
         {
-          "top_left_x": 1.057313,
-          "top_left_y": 1.057313,
-          "top_right_x": 1.057313,
-          "top_right_y": 1.057313,
-          "bottom_right_x": 2.114626,
-          "bottom_right_y": 2.114626,
-          "bottom_left_x": 2.114626,
-          "bottom_left_y": 2.114626
+          "top_left_x": 1.8252907,
+          "top_left_y": 1.8252907,
+          "top_right_x": 1.8252907,
+          "top_right_y": 1.8252907,
+          "bottom_right_x": 3.6505814,
+          "bottom_right_y": 3.6505814,
+          "bottom_left_x": 3.6505814,
+          "bottom_left_y": 3.6505814
         },
         {
-          "top_left_x": 0.7824335,
-          "top_left_y": 0.7824335,
-          "top_right_x": 0.7824335,
-          "top_right_y": 0.7824335,
-          "bottom_right_x": 1.564867,
-          "bottom_right_y": 1.564867,
-          "bottom_left_x": 1.564867,
-          "bottom_left_y": 1.564867
+          "top_left_x": 1.4077549,
+          "top_left_y": 1.4077549,
+          "top_right_x": 1.4077549,
+          "top_right_y": 1.4077549,
+          "bottom_right_x": 2.8155098,
+          "bottom_right_y": 2.8155098,
+          "bottom_left_x": 2.8155098,
+          "bottom_left_y": 2.8155098
         },
         {
-          "top_left_x": 0.5863056,
-          "top_left_y": 0.5863056,
-          "top_right_x": 0.5863056,
-          "top_right_y": 0.5863056,
-          "bottom_right_x": 1.1726112,
-          "bottom_right_y": 1.1726112,
-          "bottom_left_x": 1.1726112,
-          "bottom_left_y": 1.1726112
+          "top_left_x": 1.1067667,
+          "top_left_y": 1.1067667,
+          "top_right_x": 1.1067667,
+          "top_right_y": 1.1067667,
+          "bottom_right_x": 2.2135334,
+          "bottom_right_y": 2.2135334,
+          "bottom_left_x": 2.2135334,
+          "bottom_left_y": 2.2135334
         },
         {
-          "top_left_x": 0.4332962,
-          "top_left_y": 0.4332962,
-          "top_right_x": 0.4332962,
-          "top_right_y": 0.4332962,
-          "bottom_right_x": 0.8665924,
-          "bottom_right_y": 0.8665924,
-          "bottom_left_x": 0.8665924,
-          "bottom_left_y": 0.8665924
+          "top_left_x": 0.88593864,
+          "top_left_y": 0.88593864,
+          "top_right_x": 0.88593864,
+          "top_right_y": 0.88593864,
+          "bottom_right_x": 1.7718773,
+          "bottom_right_y": 1.7718773,
+          "bottom_left_x": 1.7718773,
+          "bottom_left_y": 1.7718773
         },
         {
-          "top_left_x": 0.3145876,
-          "top_left_y": 0.3145876,
-          "top_right_x": 0.3145876,
-          "top_right_y": 0.3145876,
-          "bottom_right_x": 0.6291752,
-          "bottom_right_y": 0.6291752,
-          "bottom_left_x": 0.6291752,
-          "bottom_left_y": 0.6291752
+          "top_left_x": 0.7069988,
+          "top_left_y": 0.7069988,
+          "top_right_x": 0.7069988,
+          "top_right_y": 0.7069988,
+          "bottom_right_x": 1.4139977,
+          "bottom_right_y": 1.4139977,
+          "bottom_left_x": 1.4139977,
+          "bottom_left_y": 1.4139977
         },
         {
-          "top_left_x": 0.22506618,
-          "top_left_y": 0.22506618,
-          "top_right_x": 0.22506618,
-          "top_right_y": 0.22506618,
-          "bottom_right_x": 0.45013237,
-          "bottom_right_y": 0.45013237,
-          "bottom_left_x": 0.45013237,
-          "bottom_left_y": 0.45013237
+          "top_left_x": 0.55613136,
+          "top_left_y": 0.55613136,
+          "top_right_x": 0.55613136,
+          "top_right_y": 0.55613136,
+          "bottom_right_x": 1.1122627,
+          "bottom_right_y": 1.1122627,
+          "bottom_left_x": 1.1122627,
+          "bottom_left_y": 1.1122627
         },
         {
-          "top_left_x": 0.15591621,
-          "top_left_y": 0.15591621,
-          "top_right_x": 0.15591621,
-          "top_right_y": 0.15591621,
-          "bottom_right_x": 0.31183243,
-          "bottom_right_y": 0.31183243,
-          "bottom_left_x": 0.31183243,
-          "bottom_left_y": 0.31183243
+          "top_left_x": 0.44889355,
+          "top_left_y": 0.44889355,
+          "top_right_x": 0.44889355,
+          "top_right_y": 0.44889355,
+          "bottom_right_x": 0.8977871,
+          "bottom_right_y": 0.8977871,
+          "bottom_left_x": 0.8977871,
+          "bottom_left_y": 0.8977871
         },
         {
-          "top_left_x": 0.100948334,
-          "top_left_y": 0.100948334,
-          "top_right_x": 0.100948334,
-          "top_right_y": 0.100948334,
-          "bottom_right_x": 0.20189667,
-          "bottom_right_y": 0.20189667,
-          "bottom_left_x": 0.20189667,
-          "bottom_left_y": 0.20189667
+          "top_left_x": 0.34557533,
+          "top_left_y": 0.34557533,
+          "top_right_x": 0.34557533,
+          "top_right_y": 0.34557533,
+          "bottom_right_x": 0.69115067,
+          "bottom_right_y": 0.69115067,
+          "bottom_left_x": 0.69115067,
+          "bottom_left_y": 0.69115067
         },
         {
-          "top_left_x": 0.06496239,
-          "top_left_y": 0.06496239,
-          "top_right_x": 0.06496239,
-          "top_right_y": 0.06496239,
-          "bottom_right_x": 0.12992477,
-          "bottom_right_y": 0.12992477,
-          "bottom_left_x": 0.12992477,
-          "bottom_left_y": 0.12992477
+          "top_left_x": 0.27671337,
+          "top_left_y": 0.27671337,
+          "top_right_x": 0.27671337,
+          "top_right_y": 0.27671337,
+          "bottom_right_x": 0.55342674,
+          "bottom_right_y": 0.55342674,
+          "bottom_left_x": 0.55342674,
+          "bottom_left_y": 0.55342674
         },
         {
-          "top_left_x": 0.03526497,
-          "top_left_y": 0.03526497,
-          "top_right_x": 0.03526497,
-          "top_right_y": 0.03526497,
-          "bottom_right_x": 0.07052994,
-          "bottom_right_y": 0.07052994,
-          "bottom_left_x": 0.07052994,
-          "bottom_left_y": 0.07052994
+          "top_left_x": 0.20785141,
+          "top_left_y": 0.20785141,
+          "top_right_x": 0.20785141,
+          "top_right_y": 0.20785141,
+          "bottom_right_x": 0.41570282,
+          "bottom_right_y": 0.41570282,
+          "bottom_left_x": 0.41570282,
+          "bottom_left_y": 0.41570282
         },
         {
-          "top_left_x": 0.014661789,
-          "top_left_y": 0.014661789,
-          "top_right_x": 0.014661789,
-          "top_right_y": 0.014661789,
-          "bottom_right_x": 0.029323578,
-          "bottom_right_y": 0.029323578,
-          "bottom_left_x": 0.029323578,
-          "bottom_left_y": 0.029323578
+          "top_left_x": 0.1601448,
+          "top_left_y": 0.1601448,
+          "top_right_x": 0.1601448,
+          "top_right_y": 0.1601448,
+          "bottom_right_x": 0.3202896,
+          "bottom_right_y": 0.3202896,
+          "bottom_left_x": 0.3202896,
+          "bottom_left_y": 0.3202896
         },
         {
-          "top_left_x": 0.0041856766,
-          "top_left_y": 0.0041856766,
-          "top_right_x": 0.0041856766,
-          "top_right_y": 0.0041856766,
-          "bottom_right_x": 0.008371353,
-          "bottom_right_y": 0.008371353,
-          "bottom_left_x": 0.008371353,
-          "bottom_left_y": 0.008371353
+          "top_left_x": 0.117860794,
+          "top_left_y": 0.117860794,
+          "top_right_x": 0.117860794,
+          "top_right_y": 0.117860794,
+          "bottom_right_x": 0.23572159,
+          "bottom_right_y": 0.23572159,
+          "bottom_left_x": 0.23572159,
+          "bottom_left_y": 0.23572159
+        },
+        {
+          "top_left_x": 0.08036041,
+          "top_left_y": 0.08036041,
+          "top_right_x": 0.08036041,
+          "top_right_y": 0.08036041,
+          "bottom_right_x": 0.16072083,
+          "bottom_right_y": 0.16072083,
+          "bottom_left_x": 0.16072083,
+          "bottom_left_y": 0.16072083
+        },
+        {
+          "top_left_x": 0.05836296,
+          "top_left_y": 0.05836296,
+          "top_right_x": 0.05836296,
+          "top_right_y": 0.05836296,
+          "bottom_right_x": 0.11672592,
+          "bottom_right_y": 0.11672592,
+          "bottom_left_x": 0.11672592,
+          "bottom_left_y": 0.11672592
+        },
+        {
+          "top_left_x": 0.03636551,
+          "top_left_y": 0.03636551,
+          "top_right_x": 0.03636551,
+          "top_right_y": 0.03636551,
+          "bottom_right_x": 0.07273102,
+          "bottom_right_y": 0.07273102,
+          "bottom_left_x": 0.07273102,
+          "bottom_left_y": 0.07273102
+        },
+        {
+          "top_left_x": 0.018137932,
+          "top_left_y": 0.018137932,
+          "top_right_x": 0.018137932,
+          "top_right_y": 0.018137932,
+          "bottom_right_x": 0.036275864,
+          "bottom_right_y": 0.036275864,
+          "bottom_left_x": 0.036275864,
+          "bottom_left_y": 0.036275864
+        },
+        {
+          "top_left_x": 0.0082063675,
+          "top_left_y": 0.0082063675,
+          "top_right_x": 0.0082063675,
+          "top_right_y": 0.0082063675,
+          "bottom_right_x": 0.016412735,
+          "bottom_right_y": 0.016412735,
+          "bottom_left_x": 0.016412735,
+          "bottom_left_y": 0.016412735
+        },
+        {
+          "top_left_x": 0.0031013489,
+          "top_left_y": 0.0031013489,
+          "top_right_x": 0.0031013489,
+          "top_right_y": 0.0031013489,
+          "bottom_right_x": 0.0062026978,
+          "bottom_right_y": 0.0062026978,
+          "bottom_left_x": 0.0062026978,
+          "bottom_left_y": 0.0062026978
         },
         {
           "top_left_x": 0,
@@ -367,19 +461,24 @@
       "type": "int",
       "data_points": [
         0,
+        96,
+        153,
+        192,
+        220,
+        238,
+        249,
+        254,
+        233,
+        191,
+        153,
+        117,
+        85,
+        57,
+        33,
+        14,
+        3,
         0,
-        115,
-        178,
-        217,
-        241,
-        253,
-        239,
-        183,
-        135,
-        91,
-        53,
-        23,
-        5,
+        0,
         0,
         0,
         0,
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching_withSpring.json b/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching_withSpring.json
new file mode 100644
index 0000000..a840d3c
--- /dev/null
+++ b/packages/SystemUI/tests/goldens/backgroundAnimation_whenLaunching_withSpring.json
@@ -0,0 +1,375 @@
+{
+  "frame_ids": [
+    0,
+    16,
+    32,
+    48,
+    64,
+    80,
+    96,
+    112,
+    128,
+    144,
+    160,
+    176,
+    192,
+    208,
+    224,
+    240,
+    256,
+    272,
+    288,
+    304
+  ],
+  "features": [
+    {
+      "name": "bounds",
+      "type": "rect",
+      "data_points": [
+        {
+          "left": 0,
+          "top": 0,
+          "right": 0,
+          "bottom": 0
+        },
+        {
+          "left": 94,
+          "top": 284,
+          "right": 206,
+          "bottom": 414
+        },
+        {
+          "left": 83,
+          "top": 251,
+          "right": 219,
+          "bottom": 447
+        },
+        {
+          "left": 70,
+          "top": 212,
+          "right": 234,
+          "bottom": 485
+        },
+        {
+          "left": 57,
+          "top": 173,
+          "right": 250,
+          "bottom": 522
+        },
+        {
+          "left": 46,
+          "top": 139,
+          "right": 264,
+          "bottom": 555
+        },
+        {
+          "left": 36,
+          "top": 109,
+          "right": 276,
+          "bottom": 584
+        },
+        {
+          "left": 28,
+          "top": 84,
+          "right": 285,
+          "bottom": 608
+        },
+        {
+          "left": 21,
+          "top": 65,
+          "right": 293,
+          "bottom": 627
+        },
+        {
+          "left": 16,
+          "top": 49,
+          "right": 300,
+          "bottom": 642
+        },
+        {
+          "left": 12,
+          "top": 36,
+          "right": 305,
+          "bottom": 653
+        },
+        {
+          "left": 9,
+          "top": 27,
+          "right": 308,
+          "bottom": 662
+        },
+        {
+          "left": 7,
+          "top": 20,
+          "right": 312,
+          "bottom": 669
+        },
+        {
+          "left": 5,
+          "top": 14,
+          "right": 314,
+          "bottom": 675
+        },
+        {
+          "left": 4,
+          "top": 11,
+          "right": 315,
+          "bottom": 678
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 316,
+          "bottom": 681
+        },
+        {
+          "left": 2,
+          "top": 5,
+          "right": 317,
+          "bottom": 684
+        },
+        {
+          "left": 1,
+          "top": 4,
+          "right": 318,
+          "bottom": 685
+        },
+        {
+          "left": 1,
+          "top": 3,
+          "right": 318,
+          "bottom": 686
+        },
+        {
+          "left": 0,
+          "top": 2,
+          "right": 319,
+          "bottom": 687
+        }
+      ]
+    },
+    {
+      "name": "corner_radii",
+      "type": "cornerRadii",
+      "data_points": [
+        null,
+        {
+          "top_left_x": 9.492916,
+          "top_left_y": 9.492916,
+          "top_right_x": 9.492916,
+          "top_right_y": 9.492916,
+          "bottom_right_x": 18.985832,
+          "bottom_right_y": 18.985832,
+          "bottom_left_x": 18.985832,
+          "bottom_left_y": 18.985832
+        },
+        {
+          "top_left_x": 8.381761,
+          "top_left_y": 8.381761,
+          "top_right_x": 8.381761,
+          "top_right_y": 8.381761,
+          "bottom_right_x": 16.763521,
+          "bottom_right_y": 16.763521,
+          "bottom_left_x": 16.763521,
+          "bottom_left_y": 16.763521
+        },
+        {
+          "top_left_x": 7.07397,
+          "top_left_y": 7.07397,
+          "top_right_x": 7.07397,
+          "top_right_y": 7.07397,
+          "bottom_right_x": 14.14794,
+          "bottom_right_y": 14.14794,
+          "bottom_left_x": 14.14794,
+          "bottom_left_y": 14.14794
+        },
+        {
+          "top_left_x": 5.7880254,
+          "top_left_y": 5.7880254,
+          "top_right_x": 5.7880254,
+          "top_right_y": 5.7880254,
+          "bottom_right_x": 11.576051,
+          "bottom_right_y": 11.576051,
+          "bottom_left_x": 11.576051,
+          "bottom_left_y": 11.576051
+        },
+        {
+          "top_left_x": 4.6295347,
+          "top_left_y": 4.6295347,
+          "top_right_x": 4.6295347,
+          "top_right_y": 4.6295347,
+          "bottom_right_x": 9.259069,
+          "bottom_right_y": 9.259069,
+          "bottom_left_x": 9.259069,
+          "bottom_left_y": 9.259069
+        },
+        {
+          "top_left_x": 3.638935,
+          "top_left_y": 3.638935,
+          "top_right_x": 3.638935,
+          "top_right_y": 3.638935,
+          "bottom_right_x": 7.27787,
+          "bottom_right_y": 7.27787,
+          "bottom_left_x": 7.27787,
+          "bottom_left_y": 7.27787
+        },
+        {
+          "top_left_x": 2.8209057,
+          "top_left_y": 2.8209057,
+          "top_right_x": 2.8209057,
+          "top_right_y": 2.8209057,
+          "bottom_right_x": 5.6418114,
+          "bottom_right_y": 5.6418114,
+          "bottom_left_x": 5.6418114,
+          "bottom_left_y": 5.6418114
+        },
+        {
+          "top_left_x": 2.1620893,
+          "top_left_y": 2.1620893,
+          "top_right_x": 2.1620893,
+          "top_right_y": 2.1620893,
+          "bottom_right_x": 4.3241787,
+          "bottom_right_y": 4.3241787,
+          "bottom_left_x": 4.3241787,
+          "bottom_left_y": 4.3241787
+        },
+        {
+          "top_left_x": 1.6414614,
+          "top_left_y": 1.6414614,
+          "top_right_x": 1.6414614,
+          "top_right_y": 1.6414614,
+          "bottom_right_x": 3.2829227,
+          "bottom_right_y": 3.2829227,
+          "bottom_left_x": 3.2829227,
+          "bottom_left_y": 3.2829227
+        },
+        {
+          "top_left_x": 1.2361269,
+          "top_left_y": 1.2361269,
+          "top_right_x": 1.2361269,
+          "top_right_y": 1.2361269,
+          "bottom_right_x": 2.4722538,
+          "bottom_right_y": 2.4722538,
+          "bottom_left_x": 2.4722538,
+          "bottom_left_y": 2.4722538
+        },
+        {
+          "top_left_x": 0.92435074,
+          "top_left_y": 0.92435074,
+          "top_right_x": 0.92435074,
+          "top_right_y": 0.92435074,
+          "bottom_right_x": 1.8487015,
+          "bottom_right_y": 1.8487015,
+          "bottom_left_x": 1.8487015,
+          "bottom_left_y": 1.8487015
+        },
+        {
+          "top_left_x": 0.68693924,
+          "top_left_y": 0.68693924,
+          "top_right_x": 0.68693924,
+          "top_right_y": 0.68693924,
+          "bottom_right_x": 1.3738785,
+          "bottom_right_y": 1.3738785,
+          "bottom_left_x": 1.3738785,
+          "bottom_left_y": 1.3738785
+        },
+        {
+          "top_left_x": 0.5076904,
+          "top_left_y": 0.5076904,
+          "top_right_x": 0.5076904,
+          "top_right_y": 0.5076904,
+          "bottom_right_x": 1.0153809,
+          "bottom_right_y": 1.0153809,
+          "bottom_left_x": 1.0153809,
+          "bottom_left_y": 1.0153809
+        },
+        {
+          "top_left_x": 0.3733511,
+          "top_left_y": 0.3733511,
+          "top_right_x": 0.3733511,
+          "top_right_y": 0.3733511,
+          "bottom_right_x": 0.7467022,
+          "bottom_right_y": 0.7467022,
+          "bottom_left_x": 0.7467022,
+          "bottom_left_y": 0.7467022
+        },
+        {
+          "top_left_x": 0.27331638,
+          "top_left_y": 0.27331638,
+          "top_right_x": 0.27331638,
+          "top_right_y": 0.27331638,
+          "bottom_right_x": 0.54663277,
+          "bottom_right_y": 0.54663277,
+          "bottom_left_x": 0.54663277,
+          "bottom_left_y": 0.54663277
+        },
+        {
+          "top_left_x": 0.19925308,
+          "top_left_y": 0.19925308,
+          "top_right_x": 0.19925308,
+          "top_right_y": 0.19925308,
+          "bottom_right_x": 0.39850616,
+          "bottom_right_y": 0.39850616,
+          "bottom_left_x": 0.39850616,
+          "bottom_left_y": 0.39850616
+        },
+        {
+          "top_left_x": 0.14470005,
+          "top_left_y": 0.14470005,
+          "top_right_x": 0.14470005,
+          "top_right_y": 0.14470005,
+          "bottom_right_x": 0.2894001,
+          "bottom_right_y": 0.2894001,
+          "bottom_left_x": 0.2894001,
+          "bottom_left_y": 0.2894001
+        },
+        {
+          "top_left_x": 0.10470486,
+          "top_left_y": 0.10470486,
+          "top_right_x": 0.10470486,
+          "top_right_y": 0.10470486,
+          "bottom_right_x": 0.20940971,
+          "bottom_right_y": 0.20940971,
+          "bottom_left_x": 0.20940971,
+          "bottom_left_y": 0.20940971
+        },
+        {
+          "top_left_x": 0.07550812,
+          "top_left_y": 0.07550812,
+          "top_right_x": 0.07550812,
+          "top_right_y": 0.07550812,
+          "bottom_right_x": 0.15101624,
+          "bottom_right_y": 0.15101624,
+          "bottom_left_x": 0.15101624,
+          "bottom_left_y": 0.15101624
+        }
+      ]
+    },
+    {
+      "name": "alpha",
+      "type": "int",
+      "data_points": [
+        0,
+        45,
+        126,
+        190,
+        228,
+        246,
+        253,
+        255,
+        255,
+        255,
+        249,
+        226,
+        192,
+        153,
+        112,
+        72,
+        34,
+        0,
+        0,
+        0
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning.json b/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning.json
index 608e633..aa80445 100644
--- a/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning.json
+++ b/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning.json
@@ -1,25 +1,30 @@
 {
   "frame_ids": [
-    "before",
     0,
-    26,
-    52,
-    78,
-    105,
-    131,
-    157,
-    184,
-    210,
-    236,
-    263,
-    289,
-    315,
-    342,
-    368,
-    394,
-    421,
-    447,
-    473,
+    20,
+    40,
+    60,
+    80,
+    100,
+    120,
+    140,
+    160,
+    180,
+    200,
+    220,
+    240,
+    260,
+    280,
+    300,
+    320,
+    340,
+    360,
+    380,
+    400,
+    420,
+    440,
+    460,
+    480,
     500
   ],
   "features": [
@@ -28,70 +33,82 @@
       "type": "rect",
       "data_points": [
         {
-          "left": 0,
-          "top": 0,
-          "right": 0,
-          "bottom": 0
-        },
-        {
           "left": 100,
           "top": 300,
           "right": 200,
           "bottom": 400
         },
         {
-          "left": 98,
-          "top": 293,
-          "right": 203,
-          "bottom": 407
+          "left": 99,
+          "top": 296,
+          "right": 202,
+          "bottom": 404
         },
         {
-          "left": 91,
-          "top": 269,
-          "right": 213,
-          "bottom": 430
+          "left": 95,
+          "top": 283,
+          "right": 207,
+          "bottom": 417
         },
         {
-          "left": 71,
-          "top": 206,
-          "right": 240,
-          "bottom": 491
+          "left": 86,
+          "top": 256,
+          "right": 219,
+          "bottom": 443
         },
         {
-          "left": 34,
-          "top": 98,
-          "right": 283,
-          "bottom": 595
+          "left": 68,
+          "top": 198,
+          "right": 243,
+          "bottom": 499
         },
         {
-          "left": 22,
-          "top": 63,
-          "right": 296,
-          "bottom": 629
+          "left": 39,
+          "top": 110,
+          "right": 278,
+          "bottom": 584
+        },
+        {
+          "left": 26,
+          "top": 74,
+          "right": 292,
+          "bottom": 618
+        },
+        {
+          "left": 19,
+          "top": 55,
+          "right": 299,
+          "bottom": 637
         },
         {
           "left": 15,
-          "top": 44,
-          "right": 303,
-          "bottom": 648
+          "top": 42,
+          "right": 304,
+          "bottom": 649
         },
         {
-          "left": 11,
-          "top": 32,
-          "right": 308,
-          "bottom": 659
+          "left": 12,
+          "top": 33,
+          "right": 307,
+          "bottom": 658
         },
         {
-          "left": 8,
-          "top": 23,
-          "right": 311,
-          "bottom": 667
+          "left": 9,
+          "top": 27,
+          "right": 310,
+          "bottom": 664
+        },
+        {
+          "left": 7,
+          "top": 21,
+          "right": 312,
+          "bottom": 669
         },
         {
           "left": 6,
-          "top": 18,
-          "right": 313,
-          "bottom": 673
+          "top": 17,
+          "right": 314,
+          "bottom": 674
         },
         {
           "left": 5,
@@ -100,16 +117,22 @@
           "bottom": 677
         },
         {
-          "left": 3,
-          "top": 9,
+          "left": 4,
+          "top": 10,
           "right": 316,
-          "bottom": 681
+          "bottom": 680
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 317,
+          "bottom": 682
         },
         {
           "left": 2,
-          "top": 7,
-          "right": 317,
-          "bottom": 683
+          "top": 6,
+          "right": 318,
+          "bottom": 684
         },
         {
           "left": 2,
@@ -119,7 +142,7 @@
         },
         {
           "left": 1,
-          "top": 3,
+          "top": 4,
           "right": 319,
           "bottom": 687
         },
@@ -130,6 +153,18 @@
           "bottom": 688
         },
         {
+          "left": 1,
+          "top": 2,
+          "right": 319,
+          "bottom": 688
+        },
+        {
+          "left": 0,
+          "top": 1,
+          "right": 320,
+          "bottom": 689
+        },
+        {
           "left": 0,
           "top": 1,
           "right": 320,
@@ -159,7 +194,6 @@
       "name": "corner_radii",
       "type": "cornerRadii",
       "data_points": [
-        null,
         {
           "top_left_x": 10,
           "top_left_y": 10,
@@ -171,184 +205,244 @@
           "bottom_left_y": 20
         },
         {
-          "top_left_x": 9.762664,
-          "top_left_y": 9.762664,
-          "top_right_x": 9.762664,
-          "top_right_y": 9.762664,
-          "bottom_right_x": 19.525328,
-          "bottom_right_y": 19.525328,
-          "bottom_left_x": 19.525328,
-          "bottom_left_y": 19.525328
+          "top_left_x": 9.865689,
+          "top_left_y": 9.865689,
+          "top_right_x": 9.865689,
+          "top_right_y": 9.865689,
+          "bottom_right_x": 19.731379,
+          "bottom_right_y": 19.731379,
+          "bottom_left_x": 19.731379,
+          "bottom_left_y": 19.731379
         },
         {
-          "top_left_x": 8.969244,
-          "top_left_y": 8.969244,
-          "top_right_x": 8.969244,
-          "top_right_y": 8.969244,
-          "bottom_right_x": 17.938488,
-          "bottom_right_y": 17.938488,
-          "bottom_left_x": 17.938488,
-          "bottom_left_y": 17.938488
+          "top_left_x": 9.419104,
+          "top_left_y": 9.419104,
+          "top_right_x": 9.419104,
+          "top_right_y": 9.419104,
+          "bottom_right_x": 18.838207,
+          "bottom_right_y": 18.838207,
+          "bottom_left_x": 18.838207,
+          "bottom_left_y": 18.838207
         },
         {
-          "top_left_x": 6.8709626,
-          "top_left_y": 6.8709626,
-          "top_right_x": 6.8709626,
-          "top_right_y": 6.8709626,
-          "bottom_right_x": 13.741925,
-          "bottom_right_y": 13.741925,
-          "bottom_left_x": 13.741925,
-          "bottom_left_y": 13.741925
+          "top_left_x": 8.533693,
+          "top_left_y": 8.533693,
+          "top_right_x": 8.533693,
+          "top_right_y": 8.533693,
+          "bottom_right_x": 17.067387,
+          "bottom_right_y": 17.067387,
+          "bottom_left_x": 17.067387,
+          "bottom_left_y": 17.067387
         },
         {
-          "top_left_x": 3.260561,
-          "top_left_y": 3.260561,
-          "top_right_x": 3.260561,
-          "top_right_y": 3.260561,
-          "bottom_right_x": 6.521122,
-          "bottom_right_y": 6.521122,
-          "bottom_left_x": 6.521122,
-          "bottom_left_y": 6.521122
+          "top_left_x": 6.5919456,
+          "top_left_y": 6.5919456,
+          "top_right_x": 6.5919456,
+          "top_right_y": 6.5919456,
+          "bottom_right_x": 13.183891,
+          "bottom_right_y": 13.183891,
+          "bottom_left_x": 13.183891,
+          "bottom_left_y": 13.183891
         },
         {
-          "top_left_x": 2.0915751,
-          "top_left_y": 2.0915751,
-          "top_right_x": 2.0915751,
-          "top_right_y": 2.0915751,
-          "bottom_right_x": 4.1831503,
-          "bottom_right_y": 4.1831503,
-          "bottom_left_x": 4.1831503,
-          "bottom_left_y": 4.1831503
+          "top_left_x": 3.6674318,
+          "top_left_y": 3.6674318,
+          "top_right_x": 3.6674318,
+          "top_right_y": 3.6674318,
+          "bottom_right_x": 7.3348637,
+          "bottom_right_y": 7.3348637,
+          "bottom_left_x": 7.3348637,
+          "bottom_left_y": 7.3348637
         },
         {
-          "top_left_x": 1.4640827,
-          "top_left_y": 1.4640827,
-          "top_right_x": 1.4640827,
-          "top_right_y": 1.4640827,
-          "bottom_right_x": 2.9281654,
-          "bottom_right_y": 2.9281654,
-          "bottom_left_x": 2.9281654,
-          "bottom_left_y": 2.9281654
+          "top_left_x": 2.4832253,
+          "top_left_y": 2.4832253,
+          "top_right_x": 2.4832253,
+          "top_right_y": 2.4832253,
+          "bottom_right_x": 4.9664507,
+          "bottom_right_y": 4.9664507,
+          "bottom_left_x": 4.9664507,
+          "bottom_left_y": 4.9664507
         },
         {
-          "top_left_x": 1.057313,
-          "top_left_y": 1.057313,
-          "top_right_x": 1.057313,
-          "top_right_y": 1.057313,
-          "bottom_right_x": 2.114626,
-          "bottom_right_y": 2.114626,
-          "bottom_left_x": 2.114626,
-          "bottom_left_y": 2.114626
+          "top_left_x": 1.8252907,
+          "top_left_y": 1.8252907,
+          "top_right_x": 1.8252907,
+          "top_right_y": 1.8252907,
+          "bottom_right_x": 3.6505814,
+          "bottom_right_y": 3.6505814,
+          "bottom_left_x": 3.6505814,
+          "bottom_left_y": 3.6505814
         },
         {
-          "top_left_x": 0.7824335,
-          "top_left_y": 0.7824335,
-          "top_right_x": 0.7824335,
-          "top_right_y": 0.7824335,
-          "bottom_right_x": 1.564867,
-          "bottom_right_y": 1.564867,
-          "bottom_left_x": 1.564867,
-          "bottom_left_y": 1.564867
+          "top_left_x": 1.4077549,
+          "top_left_y": 1.4077549,
+          "top_right_x": 1.4077549,
+          "top_right_y": 1.4077549,
+          "bottom_right_x": 2.8155098,
+          "bottom_right_y": 2.8155098,
+          "bottom_left_x": 2.8155098,
+          "bottom_left_y": 2.8155098
         },
         {
-          "top_left_x": 0.5863056,
-          "top_left_y": 0.5863056,
-          "top_right_x": 0.5863056,
-          "top_right_y": 0.5863056,
-          "bottom_right_x": 1.1726112,
-          "bottom_right_y": 1.1726112,
-          "bottom_left_x": 1.1726112,
-          "bottom_left_y": 1.1726112
+          "top_left_x": 1.1067667,
+          "top_left_y": 1.1067667,
+          "top_right_x": 1.1067667,
+          "top_right_y": 1.1067667,
+          "bottom_right_x": 2.2135334,
+          "bottom_right_y": 2.2135334,
+          "bottom_left_x": 2.2135334,
+          "bottom_left_y": 2.2135334
         },
         {
-          "top_left_x": 0.4332962,
-          "top_left_y": 0.4332962,
-          "top_right_x": 0.4332962,
-          "top_right_y": 0.4332962,
-          "bottom_right_x": 0.8665924,
-          "bottom_right_y": 0.8665924,
-          "bottom_left_x": 0.8665924,
-          "bottom_left_y": 0.8665924
+          "top_left_x": 0.88593864,
+          "top_left_y": 0.88593864,
+          "top_right_x": 0.88593864,
+          "top_right_y": 0.88593864,
+          "bottom_right_x": 1.7718773,
+          "bottom_right_y": 1.7718773,
+          "bottom_left_x": 1.7718773,
+          "bottom_left_y": 1.7718773
         },
         {
-          "top_left_x": 0.3145876,
-          "top_left_y": 0.3145876,
-          "top_right_x": 0.3145876,
-          "top_right_y": 0.3145876,
-          "bottom_right_x": 0.6291752,
-          "bottom_right_y": 0.6291752,
-          "bottom_left_x": 0.6291752,
-          "bottom_left_y": 0.6291752
+          "top_left_x": 0.7069988,
+          "top_left_y": 0.7069988,
+          "top_right_x": 0.7069988,
+          "top_right_y": 0.7069988,
+          "bottom_right_x": 1.4139977,
+          "bottom_right_y": 1.4139977,
+          "bottom_left_x": 1.4139977,
+          "bottom_left_y": 1.4139977
         },
         {
-          "top_left_x": 0.22506618,
-          "top_left_y": 0.22506618,
-          "top_right_x": 0.22506618,
-          "top_right_y": 0.22506618,
-          "bottom_right_x": 0.45013237,
-          "bottom_right_y": 0.45013237,
-          "bottom_left_x": 0.45013237,
-          "bottom_left_y": 0.45013237
+          "top_left_x": 0.55613136,
+          "top_left_y": 0.55613136,
+          "top_right_x": 0.55613136,
+          "top_right_y": 0.55613136,
+          "bottom_right_x": 1.1122627,
+          "bottom_right_y": 1.1122627,
+          "bottom_left_x": 1.1122627,
+          "bottom_left_y": 1.1122627
         },
         {
-          "top_left_x": 0.15591621,
-          "top_left_y": 0.15591621,
-          "top_right_x": 0.15591621,
-          "top_right_y": 0.15591621,
-          "bottom_right_x": 0.31183243,
-          "bottom_right_y": 0.31183243,
-          "bottom_left_x": 0.31183243,
-          "bottom_left_y": 0.31183243
+          "top_left_x": 0.44889355,
+          "top_left_y": 0.44889355,
+          "top_right_x": 0.44889355,
+          "top_right_y": 0.44889355,
+          "bottom_right_x": 0.8977871,
+          "bottom_right_y": 0.8977871,
+          "bottom_left_x": 0.8977871,
+          "bottom_left_y": 0.8977871
         },
         {
-          "top_left_x": 0.100948334,
-          "top_left_y": 0.100948334,
-          "top_right_x": 0.100948334,
-          "top_right_y": 0.100948334,
-          "bottom_right_x": 0.20189667,
-          "bottom_right_y": 0.20189667,
-          "bottom_left_x": 0.20189667,
-          "bottom_left_y": 0.20189667
+          "top_left_x": 0.34557533,
+          "top_left_y": 0.34557533,
+          "top_right_x": 0.34557533,
+          "top_right_y": 0.34557533,
+          "bottom_right_x": 0.69115067,
+          "bottom_right_y": 0.69115067,
+          "bottom_left_x": 0.69115067,
+          "bottom_left_y": 0.69115067
         },
         {
-          "top_left_x": 0.06496239,
-          "top_left_y": 0.06496239,
-          "top_right_x": 0.06496239,
-          "top_right_y": 0.06496239,
-          "bottom_right_x": 0.12992477,
-          "bottom_right_y": 0.12992477,
-          "bottom_left_x": 0.12992477,
-          "bottom_left_y": 0.12992477
+          "top_left_x": 0.27671337,
+          "top_left_y": 0.27671337,
+          "top_right_x": 0.27671337,
+          "top_right_y": 0.27671337,
+          "bottom_right_x": 0.55342674,
+          "bottom_right_y": 0.55342674,
+          "bottom_left_x": 0.55342674,
+          "bottom_left_y": 0.55342674
         },
         {
-          "top_left_x": 0.03526497,
-          "top_left_y": 0.03526497,
-          "top_right_x": 0.03526497,
-          "top_right_y": 0.03526497,
-          "bottom_right_x": 0.07052994,
-          "bottom_right_y": 0.07052994,
-          "bottom_left_x": 0.07052994,
-          "bottom_left_y": 0.07052994
+          "top_left_x": 0.20785141,
+          "top_left_y": 0.20785141,
+          "top_right_x": 0.20785141,
+          "top_right_y": 0.20785141,
+          "bottom_right_x": 0.41570282,
+          "bottom_right_y": 0.41570282,
+          "bottom_left_x": 0.41570282,
+          "bottom_left_y": 0.41570282
         },
         {
-          "top_left_x": 0.014661789,
-          "top_left_y": 0.014661789,
-          "top_right_x": 0.014661789,
-          "top_right_y": 0.014661789,
-          "bottom_right_x": 0.029323578,
-          "bottom_right_y": 0.029323578,
-          "bottom_left_x": 0.029323578,
-          "bottom_left_y": 0.029323578
+          "top_left_x": 0.1601448,
+          "top_left_y": 0.1601448,
+          "top_right_x": 0.1601448,
+          "top_right_y": 0.1601448,
+          "bottom_right_x": 0.3202896,
+          "bottom_right_y": 0.3202896,
+          "bottom_left_x": 0.3202896,
+          "bottom_left_y": 0.3202896
         },
         {
-          "top_left_x": 0.0041856766,
-          "top_left_y": 0.0041856766,
-          "top_right_x": 0.0041856766,
-          "top_right_y": 0.0041856766,
-          "bottom_right_x": 0.008371353,
-          "bottom_right_y": 0.008371353,
-          "bottom_left_x": 0.008371353,
-          "bottom_left_y": 0.008371353
+          "top_left_x": 0.117860794,
+          "top_left_y": 0.117860794,
+          "top_right_x": 0.117860794,
+          "top_right_y": 0.117860794,
+          "bottom_right_x": 0.23572159,
+          "bottom_right_y": 0.23572159,
+          "bottom_left_x": 0.23572159,
+          "bottom_left_y": 0.23572159
+        },
+        {
+          "top_left_x": 0.08036041,
+          "top_left_y": 0.08036041,
+          "top_right_x": 0.08036041,
+          "top_right_y": 0.08036041,
+          "bottom_right_x": 0.16072083,
+          "bottom_right_y": 0.16072083,
+          "bottom_left_x": 0.16072083,
+          "bottom_left_y": 0.16072083
+        },
+        {
+          "top_left_x": 0.05836296,
+          "top_left_y": 0.05836296,
+          "top_right_x": 0.05836296,
+          "top_right_y": 0.05836296,
+          "bottom_right_x": 0.11672592,
+          "bottom_right_y": 0.11672592,
+          "bottom_left_x": 0.11672592,
+          "bottom_left_y": 0.11672592
+        },
+        {
+          "top_left_x": 0.03636551,
+          "top_left_y": 0.03636551,
+          "top_right_x": 0.03636551,
+          "top_right_y": 0.03636551,
+          "bottom_right_x": 0.07273102,
+          "bottom_right_y": 0.07273102,
+          "bottom_left_x": 0.07273102,
+          "bottom_left_y": 0.07273102
+        },
+        {
+          "top_left_x": 0.018137932,
+          "top_left_y": 0.018137932,
+          "top_right_x": 0.018137932,
+          "top_right_y": 0.018137932,
+          "bottom_right_x": 0.036275864,
+          "bottom_right_y": 0.036275864,
+          "bottom_left_x": 0.036275864,
+          "bottom_left_y": 0.036275864
+        },
+        {
+          "top_left_x": 0.0082063675,
+          "top_left_y": 0.0082063675,
+          "top_right_x": 0.0082063675,
+          "top_right_y": 0.0082063675,
+          "bottom_right_x": 0.016412735,
+          "bottom_right_y": 0.016412735,
+          "bottom_left_x": 0.016412735,
+          "bottom_left_y": 0.016412735
+        },
+        {
+          "top_left_x": 0.0031013489,
+          "top_left_y": 0.0031013489,
+          "top_right_x": 0.0031013489,
+          "top_right_y": 0.0031013489,
+          "bottom_right_x": 0.0062026978,
+          "bottom_right_y": 0.0062026978,
+          "bottom_left_x": 0.0062026978,
+          "bottom_left_y": 0.0062026978
         },
         {
           "top_left_x": 0,
@@ -367,19 +461,24 @@
       "type": "int",
       "data_points": [
         0,
+        96,
+        153,
+        192,
+        220,
+        238,
+        249,
+        254,
+        233,
+        191,
+        153,
+        117,
+        85,
+        57,
+        33,
+        14,
+        3,
         0,
-        115,
-        178,
-        217,
-        241,
-        253,
-        239,
-        183,
-        135,
-        91,
-        53,
-        23,
-        5,
+        0,
         0,
         0,
         0,
diff --git a/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning_withSpring.json b/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning_withSpring.json
new file mode 100644
index 0000000..a840d3c
--- /dev/null
+++ b/packages/SystemUI/tests/goldens/backgroundAnimation_whenReturning_withSpring.json
@@ -0,0 +1,375 @@
+{
+  "frame_ids": [
+    0,
+    16,
+    32,
+    48,
+    64,
+    80,
+    96,
+    112,
+    128,
+    144,
+    160,
+    176,
+    192,
+    208,
+    224,
+    240,
+    256,
+    272,
+    288,
+    304
+  ],
+  "features": [
+    {
+      "name": "bounds",
+      "type": "rect",
+      "data_points": [
+        {
+          "left": 0,
+          "top": 0,
+          "right": 0,
+          "bottom": 0
+        },
+        {
+          "left": 94,
+          "top": 284,
+          "right": 206,
+          "bottom": 414
+        },
+        {
+          "left": 83,
+          "top": 251,
+          "right": 219,
+          "bottom": 447
+        },
+        {
+          "left": 70,
+          "top": 212,
+          "right": 234,
+          "bottom": 485
+        },
+        {
+          "left": 57,
+          "top": 173,
+          "right": 250,
+          "bottom": 522
+        },
+        {
+          "left": 46,
+          "top": 139,
+          "right": 264,
+          "bottom": 555
+        },
+        {
+          "left": 36,
+          "top": 109,
+          "right": 276,
+          "bottom": 584
+        },
+        {
+          "left": 28,
+          "top": 84,
+          "right": 285,
+          "bottom": 608
+        },
+        {
+          "left": 21,
+          "top": 65,
+          "right": 293,
+          "bottom": 627
+        },
+        {
+          "left": 16,
+          "top": 49,
+          "right": 300,
+          "bottom": 642
+        },
+        {
+          "left": 12,
+          "top": 36,
+          "right": 305,
+          "bottom": 653
+        },
+        {
+          "left": 9,
+          "top": 27,
+          "right": 308,
+          "bottom": 662
+        },
+        {
+          "left": 7,
+          "top": 20,
+          "right": 312,
+          "bottom": 669
+        },
+        {
+          "left": 5,
+          "top": 14,
+          "right": 314,
+          "bottom": 675
+        },
+        {
+          "left": 4,
+          "top": 11,
+          "right": 315,
+          "bottom": 678
+        },
+        {
+          "left": 3,
+          "top": 8,
+          "right": 316,
+          "bottom": 681
+        },
+        {
+          "left": 2,
+          "top": 5,
+          "right": 317,
+          "bottom": 684
+        },
+        {
+          "left": 1,
+          "top": 4,
+          "right": 318,
+          "bottom": 685
+        },
+        {
+          "left": 1,
+          "top": 3,
+          "right": 318,
+          "bottom": 686
+        },
+        {
+          "left": 0,
+          "top": 2,
+          "right": 319,
+          "bottom": 687
+        }
+      ]
+    },
+    {
+      "name": "corner_radii",
+      "type": "cornerRadii",
+      "data_points": [
+        null,
+        {
+          "top_left_x": 9.492916,
+          "top_left_y": 9.492916,
+          "top_right_x": 9.492916,
+          "top_right_y": 9.492916,
+          "bottom_right_x": 18.985832,
+          "bottom_right_y": 18.985832,
+          "bottom_left_x": 18.985832,
+          "bottom_left_y": 18.985832
+        },
+        {
+          "top_left_x": 8.381761,
+          "top_left_y": 8.381761,
+          "top_right_x": 8.381761,
+          "top_right_y": 8.381761,
+          "bottom_right_x": 16.763521,
+          "bottom_right_y": 16.763521,
+          "bottom_left_x": 16.763521,
+          "bottom_left_y": 16.763521
+        },
+        {
+          "top_left_x": 7.07397,
+          "top_left_y": 7.07397,
+          "top_right_x": 7.07397,
+          "top_right_y": 7.07397,
+          "bottom_right_x": 14.14794,
+          "bottom_right_y": 14.14794,
+          "bottom_left_x": 14.14794,
+          "bottom_left_y": 14.14794
+        },
+        {
+          "top_left_x": 5.7880254,
+          "top_left_y": 5.7880254,
+          "top_right_x": 5.7880254,
+          "top_right_y": 5.7880254,
+          "bottom_right_x": 11.576051,
+          "bottom_right_y": 11.576051,
+          "bottom_left_x": 11.576051,
+          "bottom_left_y": 11.576051
+        },
+        {
+          "top_left_x": 4.6295347,
+          "top_left_y": 4.6295347,
+          "top_right_x": 4.6295347,
+          "top_right_y": 4.6295347,
+          "bottom_right_x": 9.259069,
+          "bottom_right_y": 9.259069,
+          "bottom_left_x": 9.259069,
+          "bottom_left_y": 9.259069
+        },
+        {
+          "top_left_x": 3.638935,
+          "top_left_y": 3.638935,
+          "top_right_x": 3.638935,
+          "top_right_y": 3.638935,
+          "bottom_right_x": 7.27787,
+          "bottom_right_y": 7.27787,
+          "bottom_left_x": 7.27787,
+          "bottom_left_y": 7.27787
+        },
+        {
+          "top_left_x": 2.8209057,
+          "top_left_y": 2.8209057,
+          "top_right_x": 2.8209057,
+          "top_right_y": 2.8209057,
+          "bottom_right_x": 5.6418114,
+          "bottom_right_y": 5.6418114,
+          "bottom_left_x": 5.6418114,
+          "bottom_left_y": 5.6418114
+        },
+        {
+          "top_left_x": 2.1620893,
+          "top_left_y": 2.1620893,
+          "top_right_x": 2.1620893,
+          "top_right_y": 2.1620893,
+          "bottom_right_x": 4.3241787,
+          "bottom_right_y": 4.3241787,
+          "bottom_left_x": 4.3241787,
+          "bottom_left_y": 4.3241787
+        },
+        {
+          "top_left_x": 1.6414614,
+          "top_left_y": 1.6414614,
+          "top_right_x": 1.6414614,
+          "top_right_y": 1.6414614,
+          "bottom_right_x": 3.2829227,
+          "bottom_right_y": 3.2829227,
+          "bottom_left_x": 3.2829227,
+          "bottom_left_y": 3.2829227
+        },
+        {
+          "top_left_x": 1.2361269,
+          "top_left_y": 1.2361269,
+          "top_right_x": 1.2361269,
+          "top_right_y": 1.2361269,
+          "bottom_right_x": 2.4722538,
+          "bottom_right_y": 2.4722538,
+          "bottom_left_x": 2.4722538,
+          "bottom_left_y": 2.4722538
+        },
+        {
+          "top_left_x": 0.92435074,
+          "top_left_y": 0.92435074,
+          "top_right_x": 0.92435074,
+          "top_right_y": 0.92435074,
+          "bottom_right_x": 1.8487015,
+          "bottom_right_y": 1.8487015,
+          "bottom_left_x": 1.8487015,
+          "bottom_left_y": 1.8487015
+        },
+        {
+          "top_left_x": 0.68693924,
+          "top_left_y": 0.68693924,
+          "top_right_x": 0.68693924,
+          "top_right_y": 0.68693924,
+          "bottom_right_x": 1.3738785,
+          "bottom_right_y": 1.3738785,
+          "bottom_left_x": 1.3738785,
+          "bottom_left_y": 1.3738785
+        },
+        {
+          "top_left_x": 0.5076904,
+          "top_left_y": 0.5076904,
+          "top_right_x": 0.5076904,
+          "top_right_y": 0.5076904,
+          "bottom_right_x": 1.0153809,
+          "bottom_right_y": 1.0153809,
+          "bottom_left_x": 1.0153809,
+          "bottom_left_y": 1.0153809
+        },
+        {
+          "top_left_x": 0.3733511,
+          "top_left_y": 0.3733511,
+          "top_right_x": 0.3733511,
+          "top_right_y": 0.3733511,
+          "bottom_right_x": 0.7467022,
+          "bottom_right_y": 0.7467022,
+          "bottom_left_x": 0.7467022,
+          "bottom_left_y": 0.7467022
+        },
+        {
+          "top_left_x": 0.27331638,
+          "top_left_y": 0.27331638,
+          "top_right_x": 0.27331638,
+          "top_right_y": 0.27331638,
+          "bottom_right_x": 0.54663277,
+          "bottom_right_y": 0.54663277,
+          "bottom_left_x": 0.54663277,
+          "bottom_left_y": 0.54663277
+        },
+        {
+          "top_left_x": 0.19925308,
+          "top_left_y": 0.19925308,
+          "top_right_x": 0.19925308,
+          "top_right_y": 0.19925308,
+          "bottom_right_x": 0.39850616,
+          "bottom_right_y": 0.39850616,
+          "bottom_left_x": 0.39850616,
+          "bottom_left_y": 0.39850616
+        },
+        {
+          "top_left_x": 0.14470005,
+          "top_left_y": 0.14470005,
+          "top_right_x": 0.14470005,
+          "top_right_y": 0.14470005,
+          "bottom_right_x": 0.2894001,
+          "bottom_right_y": 0.2894001,
+          "bottom_left_x": 0.2894001,
+          "bottom_left_y": 0.2894001
+        },
+        {
+          "top_left_x": 0.10470486,
+          "top_left_y": 0.10470486,
+          "top_right_x": 0.10470486,
+          "top_right_y": 0.10470486,
+          "bottom_right_x": 0.20940971,
+          "bottom_right_y": 0.20940971,
+          "bottom_left_x": 0.20940971,
+          "bottom_left_y": 0.20940971
+        },
+        {
+          "top_left_x": 0.07550812,
+          "top_left_y": 0.07550812,
+          "top_right_x": 0.07550812,
+          "top_right_y": 0.07550812,
+          "bottom_right_x": 0.15101624,
+          "bottom_right_y": 0.15101624,
+          "bottom_left_x": 0.15101624,
+          "bottom_left_y": 0.15101624
+        }
+      ]
+    },
+    {
+      "name": "alpha",
+      "type": "int",
+      "data_points": [
+        0,
+        45,
+        126,
+        190,
+        228,
+        246,
+        253,
+        255,
+        255,
+        255,
+        249,
+        226,
+        192,
+        153,
+        112,
+        72,
+        34,
+        0,
+        0,
+        0
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/TransitionAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/animation/TransitionAnimatorTest.kt
index 762cfa0..8b427fb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/animation/TransitionAnimatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/animation/TransitionAnimatorTest.kt
@@ -16,43 +16,44 @@
 
 package com.android.systemui.animation
 
-import android.animation.AnimatorSet
+import android.animation.AnimatorRuleRecordingSpec
+import android.animation.AnimatorTestRuleToolkit
+import android.animation.MotionControl
+import android.animation.recordMotion
 import android.graphics.drawable.GradientDrawable
 import android.platform.test.annotations.MotionTest
 import android.view.ViewGroup
 import android.widget.FrameLayout
 import androidx.test.ext.junit.rules.ActivityScenarioRule
-import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
+import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.activity.EmptyTestActivity
 import com.android.systemui.concurrency.fakeExecutor
 import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.testScope
+import kotlin.test.assertTrue
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
 import platform.test.motion.MotionTestRule
 import platform.test.motion.RecordedMotion
-import platform.test.motion.view.AnimationSampling.Companion.evenlySampled
 import platform.test.motion.view.DrawableFeatureCaptures
-import platform.test.motion.view.ViewRecordingSpec.Companion.captureWithoutScreenshot
-import platform.test.motion.view.ViewToolkit
-import platform.test.motion.view.record
-import platform.test.screenshot.DeviceEmulationRule
-import platform.test.screenshot.DeviceEmulationSpec
-import platform.test.screenshot.DisplaySpec
+import platform.test.runner.parameterized.ParameterizedAndroidJunit4
+import platform.test.runner.parameterized.Parameters
 import platform.test.screenshot.GoldenPathManager
 import platform.test.screenshot.PathConfig
 
 @SmallTest
 @MotionTest
-@RunWith(AndroidJUnit4::class)
-class TransitionAnimatorTest : SysuiTestCase() {
+@RunWith(ParameterizedAndroidJunit4::class)
+class TransitionAnimatorTest(val useSpring: Boolean) : SysuiTestCase() {
     companion object {
         private const val GOLDENS_PATH = "frameworks/base/packages/SystemUI/tests/goldens"
 
-        private val emulationSpec =
-            DeviceEmulationSpec(DisplaySpec("phone", width = 320, height = 690, densityDpi = 160))
+        @get:Parameters(name = "{0}")
+        @JvmStatic
+        val useSpringValues = booleanArrayOf(false, true).toList()
     }
 
     private val kosmos = Kosmos()
@@ -62,31 +63,50 @@
             kosmos.fakeExecutor,
             ActivityTransitionAnimator.TIMINGS,
             ActivityTransitionAnimator.INTERPOLATORS,
+            ActivityTransitionAnimator.SPRING_TIMINGS,
+            ActivityTransitionAnimator.SPRING_INTERPOLATORS,
         )
+    private val withSpring =
+        if (useSpring) {
+            "_withSpring"
+        } else {
+            ""
+        }
 
-    @get:Rule(order = 0) val deviceEmulationRule = DeviceEmulationRule(emulationSpec)
     @get:Rule(order = 1) val activityRule = ActivityScenarioRule(EmptyTestActivity::class.java)
-    @get:Rule(order = 2)
-    val motionRule = MotionTestRule(ViewToolkit { activityRule.scenario }, pathManager)
+    @get:Rule(order = 2) val animatorTestRule = android.animation.AnimatorTestRule(this)
+    @get:Rule(order = 3)
+    val motionRule =
+        MotionTestRule(AnimatorTestRuleToolkit(animatorTestRule, kosmos.testScope), pathManager)
 
     @Test
     fun backgroundAnimation_whenLaunching() {
         val backgroundLayer = GradientDrawable().apply { alpha = 0 }
-        val animator = setUpTest(backgroundLayer, isLaunching = true)
+        val animator =
+            setUpTest(backgroundLayer, isLaunching = true).apply {
+                getInstrumentation().runOnMainSync { start() }
+            }
 
         val recordedMotion = recordMotion(backgroundLayer, animator)
 
-        motionRule.assertThat(recordedMotion).timeSeriesMatchesGolden()
+        motionRule
+            .assertThat(recordedMotion)
+            .timeSeriesMatchesGolden("backgroundAnimation_whenLaunching$withSpring")
     }
 
     @Test
     fun backgroundAnimation_whenReturning() {
         val backgroundLayer = GradientDrawable().apply { alpha = 0 }
-        val animator = setUpTest(backgroundLayer, isLaunching = false)
+        val animator =
+            setUpTest(backgroundLayer, isLaunching = false).apply {
+                getInstrumentation().runOnMainSync { start() }
+            }
 
         val recordedMotion = recordMotion(backgroundLayer, animator)
 
-        motionRule.assertThat(recordedMotion).timeSeriesMatchesGolden()
+        motionRule
+            .assertThat(recordedMotion)
+            .timeSeriesMatchesGolden("backgroundAnimation_whenReturning$withSpring")
     }
 
     @Test
@@ -94,10 +114,13 @@
         val backgroundLayer = GradientDrawable().apply { alpha = 0 }
         val animator =
             setUpTest(backgroundLayer, isLaunching = true, fadeWindowBackgroundLayer = false)
+                .apply { getInstrumentation().runOnMainSync { start() } }
 
         val recordedMotion = recordMotion(backgroundLayer, animator)
 
-        motionRule.assertThat(recordedMotion).timeSeriesMatchesGolden()
+        motionRule
+            .assertThat(recordedMotion)
+            .timeSeriesMatchesGolden("backgroundAnimationWithoutFade_whenLaunching$withSpring")
     }
 
     @Test
@@ -105,17 +128,20 @@
         val backgroundLayer = GradientDrawable().apply { alpha = 0 }
         val animator =
             setUpTest(backgroundLayer, isLaunching = false, fadeWindowBackgroundLayer = false)
+                .apply { getInstrumentation().runOnMainSync { start() } }
 
         val recordedMotion = recordMotion(backgroundLayer, animator)
 
-        motionRule.assertThat(recordedMotion).timeSeriesMatchesGolden()
+        motionRule
+            .assertThat(recordedMotion)
+            .timeSeriesMatchesGolden("backgroundAnimationWithoutFade_whenReturning$withSpring")
     }
 
     private fun setUpTest(
         backgroundLayer: GradientDrawable,
         isLaunching: Boolean,
         fadeWindowBackgroundLayer: Boolean = true,
-    ): AnimatorSet {
+    ): TransitionAnimator.Animation {
         lateinit var transitionContainer: ViewGroup
         activityRule.scenario.onActivity { activity ->
             transitionContainer = FrameLayout(activity).apply { setBackgroundColor(0x00FF00) }
@@ -124,18 +150,14 @@
         waitForIdleSync()
 
         val controller = TestController(transitionContainer, isLaunching)
-        val animation =
-            transitionAnimator.createAnimation(
-                controller,
-                controller.createAnimatorState(),
-                createEndState(transitionContainer),
-                backgroundLayer,
-                fadeWindowBackgroundLayer,
-            ) as TransitionAnimator.InterpolatedAnimation
-        return AnimatorSet().apply {
-            duration = animation.animator.duration
-            play(animation.animator)
-        }
+        return transitionAnimator.createAnimation(
+            controller,
+            controller.createAnimatorState(),
+            createEndState(transitionContainer),
+            backgroundLayer,
+            fadeWindowBackgroundLayer,
+            useSpring,
+        )
     }
 
     private fun createEndState(container: ViewGroup): TransitionAnimator.State {
@@ -144,8 +166,8 @@
         return TransitionAnimator.State(
             left = containerLocation[0],
             top = containerLocation[1],
-            right = containerLocation[0] + emulationSpec.display.width,
-            bottom = containerLocation[1] + emulationSpec.display.height,
+            right = containerLocation[0] + 320,
+            bottom = containerLocation[1] + 690,
             topCornerRadius = 0f,
             bottomCornerRadius = 0f,
         )
@@ -153,16 +175,35 @@
 
     private fun recordMotion(
         backgroundLayer: GradientDrawable,
-        animator: AnimatorSet,
+        animation: TransitionAnimator.Animation,
     ): RecordedMotion {
-        return motionRule.record(
-            animator,
-            backgroundLayer.captureWithoutScreenshot(evenlySampled(20)) {
-                feature(DrawableFeatureCaptures.bounds, "bounds")
-                feature(DrawableFeatureCaptures.cornerRadii, "corner_radii")
-                feature(DrawableFeatureCaptures.alpha, "alpha")
-            },
-        )
+        fun record(motionControl: MotionControl, sampleIntervalMs: Long): RecordedMotion {
+            return motionRule.recordMotion(
+                AnimatorRuleRecordingSpec(backgroundLayer, motionControl, sampleIntervalMs) {
+                    feature(DrawableFeatureCaptures.bounds, "bounds")
+                    feature(DrawableFeatureCaptures.cornerRadii, "corner_radii")
+                    feature(DrawableFeatureCaptures.alpha, "alpha")
+                }
+            )
+        }
+
+        val motionControl: MotionControl
+        val sampleIntervalMs: Long
+        if (useSpring) {
+            assertTrue { animation is TransitionAnimator.MultiSpringAnimation }
+            motionControl = MotionControl {
+                awaitCondition { (animation as TransitionAnimator.MultiSpringAnimation).isDone }
+            }
+            sampleIntervalMs = 16L
+        } else {
+            assertTrue { animation is TransitionAnimator.InterpolatedAnimation }
+            motionControl = MotionControl { awaitFrames(count = 26) }
+            sampleIntervalMs = 20L
+        }
+
+        var recording: RecordedMotion? = null
+        getInstrumentation().runOnMainSync { recording = record(motionControl, sampleIntervalMs) }
+        return recording!!
     }
 }
 
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepositoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryKosmos.kt
similarity index 68%
rename from packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepositoryKosmos.kt
rename to packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryKosmos.kt
index 2f5daaa..0ca025f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/FixedColumnsRepositoryKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/data/repository/QSColumnsRepositoryKosmos.kt
@@ -16,6 +16,12 @@
 
 package com.android.systemui.qs.panels.data.repository
 
+import android.content.res.mainResources
+import com.android.systemui.common.ui.data.repository.configurationRepository
 import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.applicationCoroutineScope
 
-val Kosmos.fixedColumnsRepository by Kosmos.Fixture { FixedColumnsRepository() }
+val Kosmos.qsColumnsRepository by
+    Kosmos.Fixture {
+        QSColumnsRepository(applicationCoroutineScope, mainResources, configurationRepository)
+    }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/InfiniteGridLayoutKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/InfiniteGridLayoutKosmos.kt
index 546129f..b4317ad 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/InfiniteGridLayoutKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/InfiniteGridLayoutKosmos.kt
@@ -18,11 +18,11 @@
 
 import com.android.systemui.kosmos.Kosmos
 import com.android.systemui.qs.panels.ui.compose.infinitegrid.InfiniteGridLayout
-import com.android.systemui.qs.panels.ui.viewmodel.fixedColumnsSizeViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.iconTilesViewModel
+import com.android.systemui.qs.panels.ui.viewmodel.qsColumnsViewModel
 import com.android.systemui.qs.panels.ui.viewmodel.tileSquishinessViewModel
 
 val Kosmos.infiniteGridLayout by
     Kosmos.Fixture {
-        InfiniteGridLayout(iconTilesViewModel, fixedColumnsSizeViewModel, tileSquishinessViewModel)
+        InfiniteGridLayout(iconTilesViewModel, qsColumnsViewModel, tileSquishinessViewModel)
     }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt
similarity index 78%
rename from packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractorKosmos.kt
rename to packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt
index f4d281d..02ed264 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/FixedColumnsSizeInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/domain/interactor/QSColumnsInteractorKosmos.kt
@@ -17,7 +17,6 @@
 package com.android.systemui.qs.panels.domain.interactor
 
 import com.android.systemui.kosmos.Kosmos
-import com.android.systemui.qs.panels.data.repository.fixedColumnsRepository
+import com.android.systemui.qs.panels.data.repository.qsColumnsRepository
 
-val Kosmos.fixedColumnsSizeInteractor by
-    Kosmos.Fixture { FixedColumnsSizeInteractor(fixedColumnsRepository) }
+val Kosmos.qsColumnsInteractor by Kosmos.Fixture { QSColumnsInteractor(qsColumnsRepository) }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModelKosmos.kt
index 85e9265..10d8e1e 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PaginatedGridViewModelKosmos.kt
@@ -24,7 +24,7 @@
     Kosmos.Fixture {
         PaginatedGridViewModel(
             iconTilesViewModel,
-            fixedColumnsSizeViewModel,
+            qsColumnsViewModel,
             iconLabelVisibilityViewModel,
             paginatedGridInteractor,
             applicationCoroutineScope,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModelKosmos.kt
deleted file mode 100644
index fde174d..0000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/PartitionedGridViewModelKosmos.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.panels.ui.viewmodel
-
-import com.android.systemui.kosmos.Kosmos
-
-val Kosmos.partitionedGridViewModel by
-    Kosmos.Fixture {
-        PartitionedGridViewModel(
-            iconTilesViewModel,
-            fixedColumnsSizeViewModel,
-            iconLabelVisibilityViewModel,
-        )
-    }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModelKosmos.kt
similarity index 77%
rename from packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModelKosmos.kt
rename to packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModelKosmos.kt
index feadc91..16b2f54 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/FixedColumnsSizeViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QSColumnsViewModelKosmos.kt
@@ -17,7 +17,6 @@
 package com.android.systemui.qs.panels.ui.viewmodel
 
 import com.android.systemui.kosmos.Kosmos
-import com.android.systemui.qs.panels.domain.interactor.fixedColumnsSizeInteractor
+import com.android.systemui.qs.panels.domain.interactor.qsColumnsInteractor
 
-val Kosmos.fixedColumnsSizeViewModel by
-    Kosmos.Fixture { FixedColumnsSizeViewModelImpl(fixedColumnsSizeInteractor) }
+val Kosmos.qsColumnsViewModel by Kosmos.Fixture { QSColumnsSizeViewModelImpl(qsColumnsInteractor) }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelKosmos.kt
index babbd50..67d9e0e 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/panels/ui/viewmodel/QuickQuickSettingsViewModelKosmos.kt
@@ -25,7 +25,7 @@
     Kosmos.Fixture {
         QuickQuickSettingsViewModel(
             currentTilesInteractor,
-            fixedColumnsSizeViewModel,
+            qsColumnsViewModel,
             quickQuickSettingsRowInteractor,
             tileSquishinessViewModel,
             iconTilesViewModel,
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index 9629a87..8896d77 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -12,11 +12,19 @@
 }
 
 filegroup {
+    name: "ravenwood-common-policies",
+    srcs: [
+        "texts/ravenwood-common-policies.txt",
+    ],
+    visibility: ["//visibility:private"],
+}
+
+filegroup {
     name: "ravenwood-services-policies",
     srcs: [
         "texts/ravenwood-services-policies.txt",
     ],
-    visibility: ["//visibility:public"],
+    visibility: ["//visibility:private"],
 }
 
 filegroup {
@@ -24,7 +32,7 @@
     srcs: [
         "texts/ravenwood-framework-policies.txt",
     ],
-    visibility: ["//visibility:public"],
+    visibility: ["//visibility:private"],
 }
 
 filegroup {
@@ -32,7 +40,7 @@
     srcs: [
         "texts/ravenwood-standard-options.txt",
     ],
-    visibility: ["//visibility:public"],
+    visibility: ["//visibility:private"],
 }
 
 filegroup {
@@ -40,7 +48,7 @@
     srcs: [
         "texts/ravenwood-annotation-allowed-classes.txt",
     ],
-    visibility: ["//visibility:public"],
+    visibility: ["//visibility:private"],
 }
 
 // This and the next module contain the same classes with different implementations.
@@ -337,6 +345,30 @@
     ],
 }
 
+// JARs in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
+// Rename some of the dependencies to make sure they're included in the intended order.
+
+java_library {
+    name: "100-framework-minus-apex.ravenwood",
+    installable: false,
+    static_libs: ["framework-minus-apex.ravenwood"],
+    visibility: ["//visibility:private"],
+}
+
+java_library {
+    name: "200-kxml2-android",
+    installable: false,
+    static_libs: ["kxml2-android"],
+    visibility: ["//visibility:private"],
+}
+
+java_library {
+    name: "z00-all-updatable-modules-system-stubs",
+    installable: false,
+    static_libs: ["all-updatable-modules-system-stubs-for-host"],
+    visibility: ["//visibility:private"],
+}
+
 android_ravenwood_libgroup {
     name: "ravenwood-runtime",
     data: [
@@ -395,3 +427,7 @@
         "inline-mockito-ravenwood-prebuilt",
     ],
 }
+
+build = [
+    "Framework.bp",
+]
diff --git a/ravenwood/Framework.bp b/ravenwood/Framework.bp
new file mode 100644
index 0000000..5cb1479
--- /dev/null
+++ b/ravenwood/Framework.bp
@@ -0,0 +1,292 @@
+// Copyright (C) 2024 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.
+
+// This file hosts all the genrule and module definitions for all Android specific
+// code that needs further post-processing by hoststubgen to support Ravenwood.
+
+/////////////////////////
+// framework-minus-apex
+/////////////////////////
+
+// Process framework-minus-apex with hoststubgen for Ravenwood.
+// This step takes several tens of seconds, so we manually shard it to multiple modules.
+// All the copies have to be kept in sync.
+// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
+// making a better build rule.
+
+genrule_defaults {
+    name: "framework-minus-apex.ravenwood-base_defaults",
+    tools: ["hoststubgen"],
+    srcs: [
+        ":framework-minus-apex-for-host",
+        ":ravenwood-common-policies",
+        ":ravenwood-framework-policies",
+        ":ravenwood-standard-options",
+        ":ravenwood-annotation-allowed-classes",
+    ],
+    out: [
+        "ravenwood.jar",
+        "hoststubgen_framework-minus-apex.log",
+    ],
+    visibility: ["//visibility:private"],
+}
+
+framework_minus_apex_cmd = "$(location hoststubgen) " +
+    "@$(location :ravenwood-standard-options) " +
+    "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
+    "--out-jar $(location ravenwood.jar) " +
+    "--in-jar $(location :framework-minus-apex-for-host) " +
+    "--policy-override-file $(location :ravenwood-common-policies) " +
+    "--policy-override-file $(location :ravenwood-framework-policies) " +
+    "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X0",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X1",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X2",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X3",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X4",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X5",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X6",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X7",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X8",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
+}
+
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_X9",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
+}
+
+// Build framework-minus-apex.ravenwood-base without sharding.
+// We extract the various dump files from this one, rather than the sharded ones, because
+// some dumps use the output from other classes (e.g. base classes) which may not be in the
+// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
+// the output contains the information from all the input classes, rather than the output classes.
+// Not using sharding is fine for this module because it's only used for collecting the
+// dump / stats files, which don't have to happen regularly.
+java_genrule {
+    name: "framework-minus-apex.ravenwood-base_all",
+    defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+    cmd: framework_minus_apex_cmd +
+        "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
+        "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
+
+        "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
+        "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
+
+    out: [
+        "hoststubgen_framework-minus-apex_keep_all.txt",
+        "hoststubgen_framework-minus-apex_dump.txt",
+        "hoststubgen_framework-minus-apex_stats.csv",
+        "hoststubgen_framework-minus-apex_apis.csv",
+    ],
+}
+
+// Marge all the sharded jars
+java_genrule {
+    name: "framework-minus-apex.ravenwood",
+    defaults: ["ravenwood-internal-only-visibility-java"],
+    cmd: "$(location merge_zips) $(out) $(in)",
+    tools: ["merge_zips"],
+    srcs: [
+        ":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
+        ":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
+    ],
+    out: [
+        "framework-minus-apex.ravenwood.jar",
+    ],
+}
+
+//////////////////
+// services.core
+//////////////////
+
+java_library {
+    name: "services.core-for-host",
+    installable: false, // host only jar.
+    static_libs: [
+        "services.core",
+    ],
+    sdk_version: "core_platform",
+    visibility: ["//visibility:private"],
+}
+
+java_genrule {
+    name: "services.core.ravenwood-base",
+    tools: ["hoststubgen"],
+    cmd: "$(location hoststubgen) " +
+        "@$(location :ravenwood-standard-options) " +
+
+        "--debug-log $(location hoststubgen_services.core.log) " +
+        "--stats-file $(location hoststubgen_services.core_stats.csv) " +
+        "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
+        "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
+        "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
+
+        "--out-jar $(location ravenwood.jar) " +
+        "--in-jar $(location :services.core-for-host) " +
+
+        "--policy-override-file $(location :ravenwood-common-policies) " +
+        "--policy-override-file $(location :ravenwood-services-policies) " +
+        "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+    srcs: [
+        ":services.core-for-host",
+        ":ravenwood-common-policies",
+        ":ravenwood-services-policies",
+        ":ravenwood-standard-options",
+        ":ravenwood-annotation-allowed-classes",
+    ],
+    out: [
+        "ravenwood.jar",
+
+        // Following files are created just as FYI.
+        "hoststubgen_services.core_keep_all.txt",
+        "hoststubgen_services.core_dump.txt",
+
+        "hoststubgen_services.core.log",
+        "hoststubgen_services.core_stats.csv",
+        "hoststubgen_services.core_apis.csv",
+    ],
+    visibility: ["//visibility:private"],
+}
+
+java_genrule {
+    name: "services.core.ravenwood",
+    defaults: ["ravenwood-internal-only-visibility-genrule"],
+    cmd: "cp $(in) $(out)",
+    srcs: [
+        ":services.core.ravenwood-base{ravenwood.jar}",
+    ],
+    out: [
+        "services.core.ravenwood.jar",
+    ],
+}
+
+// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
+// but services.core.ravenwood has complex dependencies, so it'll take more than
+// just using hoststubgen "rename"s.
+java_library {
+    name: "services.core.ravenwood-jarjar",
+    defaults: ["ravenwood-internal-only-visibility-java"],
+    installable: false,
+    static_libs: [
+        "services.core.ravenwood",
+    ],
+    jarjar_rules: ":ravenwood-services-jarjar-rules",
+}
+
+///////////////
+// core-icu4j
+///////////////
+
+java_genrule {
+    name: "core-icu4j-for-host.ravenwood-base",
+    tools: ["hoststubgen"],
+    cmd: "$(location hoststubgen) " +
+        "@$(location :ravenwood-standard-options) " +
+
+        "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " +
+        "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " +
+        "--supported-api-list-file $(location hoststubgen_core-icu4j-for-host_apis.csv) " +
+        "--gen-keep-all-file $(location hoststubgen_core-icu4j-for-host_keep_all.txt) " +
+        "--gen-input-dump-file $(location hoststubgen_core-icu4j-for-host_dump.txt) " +
+
+        "--out-jar $(location ravenwood.jar) " +
+        "--in-jar $(location :core-icu4j-for-host) " +
+
+        "--policy-override-file $(location :ravenwood-common-policies) " +
+        "--policy-override-file $(location :icu-ravenwood-policies) ",
+    srcs: [
+        ":core-icu4j-for-host",
+
+        ":ravenwood-common-policies",
+        ":icu-ravenwood-policies",
+        ":ravenwood-standard-options",
+    ],
+    out: [
+        "ravenwood.jar",
+
+        // Following files are created just as FYI.
+        "hoststubgen_core-icu4j-for-host_keep_all.txt",
+        "hoststubgen_core-icu4j-for-host_dump.txt",
+
+        "hoststubgen_core-icu4j-for-host.log",
+        "hoststubgen_core-icu4j-for-host_stats.csv",
+        "hoststubgen_core-icu4j-for-host_apis.csv",
+    ],
+    visibility: ["//visibility:private"],
+}
+
+java_genrule {
+    name: "core-icu4j-for-host.ravenwood",
+    defaults: ["ravenwood-internal-only-visibility-genrule"],
+    cmd: "cp $(in) $(out)",
+    srcs: [
+        ":core-icu4j-for-host.ravenwood-base{ravenwood.jar}",
+    ],
+    out: [
+        "core-icu4j-for-host.ravenwood.jar",
+    ],
+}
diff --git a/ravenwood/texts/ravenwood-common-policies.txt b/ravenwood/texts/ravenwood-common-policies.txt
new file mode 100644
index 0000000..08f53977
--- /dev/null
+++ b/ravenwood/texts/ravenwood-common-policies.txt
@@ -0,0 +1,20 @@
+# Ravenwood "policy" that should apply to all code.
+
+# Keep all AIDL interfaces
+class :aidl keepclass
+
+# Keep all feature flag implementations
+class :feature_flags keepclass
+
+# Keep all sysprops generated code implementations
+class :sysprops keepclass
+
+# Keep all resource R classes
+class :r keepclass
+
+# Support APIs not available in standard JRE
+class java.io.FileDescriptor keep
+    method getInt$ ()I @com.android.ravenwood.RavenwoodJdkPatch.getInt$
+    method setInt$ (I)V @com.android.ravenwood.RavenwoodJdkPatch.setInt$
+class java.util.LinkedHashMap keep
+    method eldest ()Ljava/util/Map$Entry; @com.android.ravenwood.RavenwoodJdkPatch.eldest
diff --git a/ravenwood/texts/ravenwood-framework-policies.txt b/ravenwood/texts/ravenwood-framework-policies.txt
index d962c82..3649f0e 100644
--- a/ravenwood/texts/ravenwood-framework-policies.txt
+++ b/ravenwood/texts/ravenwood-framework-policies.txt
@@ -1,29 +1,10 @@
 # Ravenwood "policy" file for framework-minus-apex.
 
-# Keep all AIDL interfaces
-class :aidl keepclass
-
-# Keep all feature flag implementations
-class :feature_flags keepclass
-
-# Keep all sysprops generated code implementations
-class :sysprops keepclass
-
-# Keep all resource R classes
-class :r keepclass
-
 # To avoid VerifyError on nano proto files (b/324063814), we rename nano proto classes.
 # Note: The "rename" directive must use slashes (/) as a package name separator.
 rename com/.*/nano/   devicenano/
 rename android/.*/nano/   devicenano/
 
-# Support APIs not available in standard JRE
-class java.io.FileDescriptor keep
-    method getInt$ ()I @com.android.ravenwood.RavenwoodJdkPatch.getInt$
-    method setInt$ (I)V @com.android.ravenwood.RavenwoodJdkPatch.setInt$
-class java.util.LinkedHashMap keep
-    method eldest ()Ljava/util/Map$Entry; @com.android.ravenwood.RavenwoodJdkPatch.eldest
-
 # Exported to Mainline modules; cannot use annotations
 class com.android.internal.util.FastXmlSerializer keepclass
 class com.android.internal.util.FileRotator keepclass
diff --git a/ravenwood/texts/ravenwood-services-policies.txt b/ravenwood/texts/ravenwood-services-policies.txt
index 5cdb4f7..cc2fa60 100644
--- a/ravenwood/texts/ravenwood-services-policies.txt
+++ b/ravenwood/texts/ravenwood-services-policies.txt
@@ -1,7 +1 @@
 # Ravenwood "policy" file for services.core.
-
-# Keep all AIDL interfaces
-class :aidl keepclass
-
-# Keep all feature flag implementations
-class :feature_flags keepclass
diff --git a/services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java b/services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java
index 3d67ed4..281a2ce 100644
--- a/services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java
+++ b/services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java
@@ -909,7 +909,7 @@
                 break;
             case POLICY_TYPE_CLIPBOARD:
                 if (Flags.crossDeviceClipboard()) {
-                    if (policyType == DEVICE_POLICY_CUSTOM
+                    if (devicePolicy == DEVICE_POLICY_CUSTOM
                             && mContext.checkCallingOrSelfPermission(ADD_TRUSTED_DISPLAY)
                             != PackageManager.PERMISSION_GRANTED) {
                         throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to "
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index bcca20b..f42f91e 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -12824,6 +12824,8 @@
             final long lostRAM = memInfo.getTotalSizeKb()
                     - (ss[INDEX_TOTAL_PSS] - ss[INDEX_TOTAL_SWAP_PSS])
                     - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
+                    // NR_SHMEM is subtracted twice (getCachedSizeKb() and getKernelUsedSizeKb())
+                    + memInfo.getShmemSizeKb()
                     - kernelUsed - memInfo.getZramTotalSizeKb();
             if (!opts.isCompact) {
                 pw.print(" Used RAM: "); pw.print(stringifyKBSize(ss[INDEX_TOTAL_PSS] - cachedPss
@@ -13337,6 +13339,8 @@
             long lostRAM = memInfo.getTotalSizeKb()
                     - (ss[INDEX_TOTAL_PSS] - ss[INDEX_TOTAL_SWAP_PSS])
                     - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
+                    // NR_SHMEM is subtracted twice (getCachedSizeKb() and getKernelUsedSizeKb())
+                    + memInfo.getShmemSizeKb()
                     - memInfo.getKernelUsedSizeKb() - memInfo.getZramTotalSizeKb();
             proto.write(MemInfoDumpProto.USED_PSS_KB, ss[INDEX_TOTAL_PSS] - cachedPss);
             proto.write(MemInfoDumpProto.USED_KERNEL_KB, memInfo.getKernelUsedSizeKb());
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 262c76e..31ae966 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -1920,175 +1920,8 @@
                 return false;
             }
 
-            boolean needStart = false;
-            boolean updateUmState = false;
-            UserState uss;
-
-            // If the user we are switching to is not currently started, then
-            // we need to start it now.
-            t.traceBegin("updateStartedUserArrayStarting");
-            synchronized (mLock) {
-                uss = mStartedUsers.get(userId);
-                if (uss == null) {
-                    uss = new UserState(UserHandle.of(userId));
-                    uss.mUnlockProgress.addListener(new UserProgressListener());
-                    mStartedUsers.put(userId, uss);
-                    updateStartedUserArrayLU();
-                    needStart = true;
-                    updateUmState = true;
-                } else if (uss.state == UserState.STATE_SHUTDOWN
-                        || mDoNotAbortShutdownUserIds.contains(userId)) {
-                    Slogf.i(TAG, "User #" + userId
-                            + " is shutting down - will start after full shutdown");
-                    mPendingUserStarts.add(new PendingUserStart(userId, userStartMode,
-                            unlockListener));
-                    t.traceEnd(); // updateStartedUserArrayStarting
-                    return true;
-                }
-            }
-
-            // No matter what, the fact that we're requested to start the user (even if it is
-            // already running) puts it towards the end of the mUserLru list.
-            addUserToUserLru(userId);
-            if (android.multiuser.Flags.scheduleStopOfBackgroundUser()) {
-                mHandler.removeEqualMessages(SCHEDULED_STOP_BACKGROUND_USER_MSG,
-                        Integer.valueOf(userId));
-            }
-
-            if (unlockListener != null) {
-                uss.mUnlockProgress.addListener(unlockListener);
-            }
-            t.traceEnd(); // updateStartedUserArrayStarting
-
-            if (updateUmState) {
-                t.traceBegin("setUserState");
-                mInjector.getUserManagerInternal().setUserState(userId, uss.state);
-                t.traceEnd();
-            }
-            t.traceBegin("updateConfigurationAndProfileIds");
-            if (foreground) {
-                // Make sure the old user is no longer considering the display to be on.
-                mInjector.reportGlobalUsageEvent(UsageEvents.Event.SCREEN_NON_INTERACTIVE);
-                boolean userSwitchUiEnabled;
-                synchronized (mLock) {
-                    mCurrentUserId = userId;
-                    ActivityManager.invalidateGetCurrentUserIdCache();
-                    userSwitchUiEnabled = mUserSwitchUiEnabled;
-                }
-                mInjector.updateUserConfiguration();
-                // NOTE: updateProfileRelatedCaches() is called on both if and else parts, ideally
-                // it should be moved outside, but for now it's not as there are many calls to
-                // external components here afterwards
-                updateProfileRelatedCaches();
-                dispatchOnBeforeUserSwitching(userId);
-                mInjector.getWindowManager().setCurrentUser(userId);
-                mInjector.reportCurWakefulnessUsageEvent();
-                // Once the internal notion of the active user has switched, we lock the device
-                // with the option to show the user switcher on the keyguard.
-                if (userSwitchUiEnabled) {
-                    mInjector.getWindowManager().setSwitchingUser(true);
-                    // Only lock if the user has a secure keyguard PIN/Pattern/Pwd
-                    if (mInjector.getKeyguardManager().isDeviceSecure(userId)) {
-                        // Make sure the device is locked before moving on with the user switch
-                        mInjector.lockDeviceNowAndWaitForKeyguardShown();
-                    }
-                }
-
-            } else {
-                updateProfileRelatedCaches();
-                // We are starting a non-foreground user. They have already been added to the end
-                // of mUserLru, so we need to ensure that the foreground user isn't displaced.
-                addUserToUserLru(mCurrentUserId);
-            }
-            if (userStartMode == USER_START_MODE_BACKGROUND && !userInfo.isProfile()) {
-                scheduleStopOfBackgroundUser(userId);
-            }
-            t.traceEnd();
-
-            // Make sure user is in the started state.  If it is currently
-            // stopping, we need to knock that off.
-            if (uss.state == UserState.STATE_STOPPING) {
-                t.traceBegin("updateStateStopping");
-                // If we are stopping, we haven't sent ACTION_SHUTDOWN,
-                // so we can just fairly silently bring the user back from
-                // the almost-dead.
-                uss.setState(uss.lastState);
-                mInjector.getUserManagerInternal().setUserState(userId, uss.state);
-                synchronized (mLock) {
-                    updateStartedUserArrayLU();
-                }
-                needStart = true;
-                t.traceEnd();
-            } else if (uss.state == UserState.STATE_SHUTDOWN) {
-                t.traceBegin("updateStateShutdown");
-                // This means ACTION_SHUTDOWN has been sent, so we will
-                // need to treat this as a new boot of the user.
-                uss.setState(UserState.STATE_BOOTING);
-                mInjector.getUserManagerInternal().setUserState(userId, uss.state);
-                synchronized (mLock) {
-                    updateStartedUserArrayLU();
-                }
-                needStart = true;
-                t.traceEnd();
-            }
-
-            if (uss.state == UserState.STATE_BOOTING) {
-                t.traceBegin("updateStateBooting");
-                // Give user manager a chance to propagate user restrictions
-                // to other services and prepare app storage
-                mInjector.getUserManager().onBeforeStartUser(userId);
-
-                // Booting up a new user, need to tell system services about it.
-                // Note that this is on the same handler as scheduling of broadcasts,
-                // which is important because it needs to go first.
-                mHandler.sendMessage(mHandler.obtainMessage(USER_START_MSG, userId, NO_ARG2));
-                t.traceEnd();
-            }
-
-            t.traceBegin("sendMessages");
-            if (foreground) {
-                mHandler.sendMessage(mHandler.obtainMessage(USER_CURRENT_MSG, userId, oldUserId));
-                mHandler.removeMessages(REPORT_USER_SWITCH_MSG);
-                mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG);
-                mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_MSG,
-                        oldUserId, userId, uss));
-                mHandler.sendMessageDelayed(mHandler.obtainMessage(USER_SWITCH_TIMEOUT_MSG,
-                        oldUserId, userId, uss), getUserSwitchTimeoutMs());
-            }
-
-            if (userInfo.preCreated) {
-                needStart = false;
-            }
-
-            // In most cases, broadcast for the system user starting/started is sent by
-            // ActivityManagerService#systemReady(). However on some HSUM devices (e.g. tablets)
-            // the user switches from the system user to a secondary user while running
-            // ActivityManagerService#systemReady(), thus broadcast is not sent for the system user.
-            // Therefore we send the broadcast for the system user here as well in HSUM.
-            // TODO(b/266158156): Improve/refactor the way broadcasts are sent for the system user
-            // in HSUM. Ideally it'd be best to have one single place that sends this notification.
-            final boolean isSystemUserInHeadlessMode = (userId == UserHandle.USER_SYSTEM)
-                    && mInjector.isHeadlessSystemUserMode();
-            if (needStart || isSystemUserInHeadlessMode) {
-                sendUserStartedBroadcast(userId, callingUid, callingPid);
-            }
-            t.traceEnd();
-
-            if (foreground) {
-                t.traceBegin("moveUserToForeground");
-                moveUserToForeground(uss, userId);
-                t.traceEnd();
-            } else {
-                t.traceBegin("finishUserBoot");
-                finishUserBoot(uss);
-                t.traceEnd();
-            }
-
-            if (needStart || isSystemUserInHeadlessMode) {
-                t.traceBegin("sendRestartBroadcast");
-                sendUserStartingBroadcast(userId, callingUid, callingPid);
-                t.traceEnd();
-            }
+            mHandler.post(() -> startUserInternalOnHandler(userId, oldUserId, userStartMode,
+                    unlockListener, callingUid, callingPid));
         } finally {
             Binder.restoreCallingIdentity(ident);
         }
@@ -2096,6 +1929,183 @@
         return true;
     }
 
+    private void startUserInternalOnHandler(int userId, int oldUserId, int userStartMode,
+            IProgressListener unlockListener, int callingUid, int callingPid) {
+        final TimingsTraceAndSlog t = new TimingsTraceAndSlog();
+        final boolean foreground = userStartMode == USER_START_MODE_FOREGROUND;
+        final UserInfo userInfo = getUserInfo(userId);
+
+        boolean needStart = false;
+        boolean updateUmState = false;
+        UserState uss;
+
+        // If the user we are switching to is not currently started, then
+        // we need to start it now.
+        t.traceBegin("updateStartedUserArrayStarting");
+        synchronized (mLock) {
+            uss = mStartedUsers.get(userId);
+            if (uss == null) {
+                uss = new UserState(UserHandle.of(userId));
+                uss.mUnlockProgress.addListener(new UserProgressListener());
+                mStartedUsers.put(userId, uss);
+                updateStartedUserArrayLU();
+                needStart = true;
+                updateUmState = true;
+            } else if (uss.state == UserState.STATE_SHUTDOWN
+                    || mDoNotAbortShutdownUserIds.contains(userId)) {
+                Slogf.i(TAG, "User #" + userId
+                        + " is shutting down - will start after full shutdown");
+                mPendingUserStarts.add(new PendingUserStart(userId, userStartMode,
+                        unlockListener));
+                t.traceEnd(); // updateStartedUserArrayStarting
+                return;
+            }
+        }
+
+        // No matter what, the fact that we're requested to start the user (even if it is
+        // already running) puts it towards the end of the mUserLru list.
+        addUserToUserLru(userId);
+        if (android.multiuser.Flags.scheduleStopOfBackgroundUser()) {
+            mHandler.removeEqualMessages(SCHEDULED_STOP_BACKGROUND_USER_MSG,
+                    Integer.valueOf(userId));
+        }
+
+        if (unlockListener != null) {
+            uss.mUnlockProgress.addListener(unlockListener);
+        }
+        t.traceEnd(); // updateStartedUserArrayStarting
+
+        if (updateUmState) {
+            t.traceBegin("setUserState");
+            mInjector.getUserManagerInternal().setUserState(userId, uss.state);
+            t.traceEnd();
+        }
+        t.traceBegin("updateConfigurationAndProfileIds");
+        if (foreground) {
+            // Make sure the old user is no longer considering the display to be on.
+            mInjector.reportGlobalUsageEvent(UsageEvents.Event.SCREEN_NON_INTERACTIVE);
+            boolean userSwitchUiEnabled;
+            synchronized (mLock) {
+                mCurrentUserId = userId;
+                ActivityManager.invalidateGetCurrentUserIdCache();
+                userSwitchUiEnabled = mUserSwitchUiEnabled;
+            }
+            mInjector.updateUserConfiguration();
+            // NOTE: updateProfileRelatedCaches() is called on both if and else parts, ideally
+            // it should be moved outside, but for now it's not as there are many calls to
+            // external components here afterwards
+            updateProfileRelatedCaches();
+            dispatchOnBeforeUserSwitching(userId);
+            mInjector.getWindowManager().setCurrentUser(userId);
+            mInjector.reportCurWakefulnessUsageEvent();
+            // Once the internal notion of the active user has switched, we lock the device
+            // with the option to show the user switcher on the keyguard.
+            if (userSwitchUiEnabled) {
+                mInjector.getWindowManager().setSwitchingUser(true);
+                // Only lock if the user has a secure keyguard PIN/Pattern/Pwd
+                if (mInjector.getKeyguardManager().isDeviceSecure(userId)) {
+                    // Make sure the device is locked before moving on with the user switch
+                    mInjector.lockDeviceNowAndWaitForKeyguardShown();
+                }
+            }
+
+        } else {
+            updateProfileRelatedCaches();
+            // We are starting a non-foreground user. They have already been added to the end
+            // of mUserLru, so we need to ensure that the foreground user isn't displaced.
+            addUserToUserLru(mCurrentUserId);
+        }
+        if (userStartMode == USER_START_MODE_BACKGROUND && !userInfo.isProfile()) {
+            scheduleStopOfBackgroundUser(userId);
+        }
+        t.traceEnd();
+
+        // Make sure user is in the started state.  If it is currently
+        // stopping, we need to knock that off.
+        if (uss.state == UserState.STATE_STOPPING) {
+            t.traceBegin("updateStateStopping");
+            // If we are stopping, we haven't sent ACTION_SHUTDOWN,
+            // so we can just fairly silently bring the user back from
+            // the almost-dead.
+            uss.setState(uss.lastState);
+            mInjector.getUserManagerInternal().setUserState(userId, uss.state);
+            synchronized (mLock) {
+                updateStartedUserArrayLU();
+            }
+            needStart = true;
+            t.traceEnd();
+        } else if (uss.state == UserState.STATE_SHUTDOWN) {
+            t.traceBegin("updateStateShutdown");
+            // This means ACTION_SHUTDOWN has been sent, so we will
+            // need to treat this as a new boot of the user.
+            uss.setState(UserState.STATE_BOOTING);
+            mInjector.getUserManagerInternal().setUserState(userId, uss.state);
+            synchronized (mLock) {
+                updateStartedUserArrayLU();
+            }
+            needStart = true;
+            t.traceEnd();
+        }
+
+        if (uss.state == UserState.STATE_BOOTING) {
+            t.traceBegin("updateStateBooting");
+            // Give user manager a chance to propagate user restrictions
+            // to other services and prepare app storage
+            mInjector.getUserManager().onBeforeStartUser(userId);
+
+            // Booting up a new user, need to tell system services about it.
+            // Note that this is on the same handler as scheduling of broadcasts,
+            // which is important because it needs to go first.
+            mHandler.sendMessage(mHandler.obtainMessage(USER_START_MSG, userId, NO_ARG2));
+            t.traceEnd();
+        }
+
+        t.traceBegin("sendMessages");
+        if (foreground) {
+            mHandler.sendMessage(mHandler.obtainMessage(USER_CURRENT_MSG, userId, oldUserId));
+            mHandler.removeMessages(REPORT_USER_SWITCH_MSG);
+            mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG);
+            mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_MSG,
+                    oldUserId, userId, uss));
+            mHandler.sendMessageDelayed(mHandler.obtainMessage(USER_SWITCH_TIMEOUT_MSG,
+                    oldUserId, userId, uss), getUserSwitchTimeoutMs());
+        }
+
+        if (userInfo.preCreated) {
+            needStart = false;
+        }
+
+        // In most cases, broadcast for the system user starting/started is sent by
+        // ActivityManagerService#systemReady(). However on some HSUM devices (e.g. tablets)
+        // the user switches from the system user to a secondary user while running
+        // ActivityManagerService#systemReady(), thus broadcast is not sent for the system user.
+        // Therefore we send the broadcast for the system user here as well in HSUM.
+        // TODO(b/266158156): Improve/refactor the way broadcasts are sent for the system user
+        // in HSUM. Ideally it'd be best to have one single place that sends this notification.
+        final boolean isSystemUserInHeadlessMode = (userId == UserHandle.USER_SYSTEM)
+                && mInjector.isHeadlessSystemUserMode();
+        if (needStart || isSystemUserInHeadlessMode) {
+            sendUserStartedBroadcast(userId, callingUid, callingPid);
+        }
+        t.traceEnd();
+
+        if (foreground) {
+            t.traceBegin("moveUserToForeground");
+            moveUserToForeground(uss, userId);
+            t.traceEnd();
+        } else {
+            t.traceBegin("finishUserBoot");
+            finishUserBoot(uss);
+            t.traceEnd();
+        }
+
+        if (needStart || isSystemUserInHeadlessMode) {
+            t.traceBegin("sendRestartBroadcast");
+            sendUserStartingBroadcast(userId, callingUid, callingPid);
+            t.traceEnd();
+        }
+    }
+
     /**
      * Start user, if it's not already running, and bring it to foreground.
      */
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 35b5171..939aad4 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -187,7 +187,6 @@
 import com.android.server.companion.virtual.VirtualDeviceManagerInternal;
 import com.android.server.input.InputManagerInternal;
 import com.android.server.inputmethod.InputMethodManagerInternal.InputMethodListListener;
-import com.android.server.inputmethod.InputMethodMenuControllerNew.MenuItem;
 import com.android.server.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
 import com.android.server.pm.UserManagerInternal;
 import com.android.server.statusbar.StatusBarManagerInternal;
@@ -4078,65 +4077,6 @@
         }
     }
 
-    /**
-     * Gets the list of Input Method Switcher Menu items and the index of the selected item.
-     *
-     * @param items                the list of input method and subtype items.
-     * @param selectedImeId        the ID of the selected input method.
-     * @param selectedSubtypeIndex the index of the selected subtype in the input method's array of
-     *                             subtypes, or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if no
-     *                             subtype is selected.
-     * @param userId               the ID of the user for which to get the menu items.
-     * @return the list of menu items, and the index of the selected item,
-     * or {@code -1} if no item is selected.
-     */
-    @GuardedBy("ImfLock.class")
-    @NonNull
-    private Pair<List<MenuItem>, Integer> getInputMethodPickerItems(
-            @NonNull List<ImeSubtypeListItem> items, @Nullable String selectedImeId,
-            int selectedSubtypeIndex, @UserIdInt int userId) {
-        final var bindingController = getInputMethodBindingController(userId);
-        final var settings = InputMethodSettingsRepository.get(userId);
-
-        if (selectedSubtypeIndex == NOT_A_SUBTYPE_INDEX) {
-            // TODO(b/351124299): Check if this fallback logic is still necessary.
-            final var curSubtype = bindingController.getCurrentInputMethodSubtype();
-            if (curSubtype != null) {
-                final var curMethodId = bindingController.getSelectedMethodId();
-                final var curImi = settings.getMethodMap().get(curMethodId);
-                selectedSubtypeIndex = SubtypeUtils.getSubtypeIndexFromHashCode(
-                        curImi, curSubtype.hashCode());
-            }
-        }
-
-        // No item is selected by default. When we have a list of explicitly enabled
-        // subtypes, the implicit subtype is no longer listed. If the implicit one
-        // is still selected, no items will be shown as selected.
-        int selectedIndex = -1;
-        String prevImeId = null;
-        final var menuItems = new ArrayList<MenuItem>();
-        for (int i = 0; i < items.size(); i++) {
-            final var item = items.get(i);
-            final var imeId = item.mImi.getId();
-            if (imeId.equals(selectedImeId)) {
-                final int subtypeIndex = item.mSubtypeIndex;
-                // Check if this is the selected IME-subtype pair.
-                if ((subtypeIndex == 0 && selectedSubtypeIndex == NOT_A_SUBTYPE_INDEX)
-                        || subtypeIndex == NOT_A_SUBTYPE_INDEX
-                        || subtypeIndex == selectedSubtypeIndex) {
-                    selectedIndex = i;
-                }
-            }
-            final boolean hasHeader = !imeId.equals(prevImeId);
-            final boolean hasDivider = hasHeader && prevImeId != null;
-            prevImeId = imeId;
-            menuItems.add(new MenuItem(item.mImeName, item.mSubtypeName, item.mImi,
-                    item.mSubtypeIndex, hasHeader, hasDivider));
-        }
-
-        return new Pair<>(menuItems, selectedIndex);
-    }
-
     @IInputMethodManagerImpl.PermissionVerified(allOf = {
             Manifest.permission.INTERACT_ACROSS_USERS_FULL,
             Manifest.permission.WRITE_SECURE_SETTINGS})
@@ -4973,18 +4913,21 @@
                         + " preferredInputMethodSubtypeIndex=" + lastInputMethodSubtypeIndex);
             }
 
-            final var itemsAndIndex = getInputMethodPickerItems(imList,
-                    lastInputMethodId, lastInputMethodSubtypeIndex, userId);
-            final var menuItems = itemsAndIndex.first;
-            final int selectedIndex = itemsAndIndex.second;
-
-            if (selectedIndex == -1) {
-                Slog.w(TAG, "Switching menu shown with no item selected"
-                        + ", IME id: " + lastInputMethodId
-                        + ", subtype index: " + lastInputMethodSubtypeIndex);
+            int selectedSubtypeIndex = lastInputMethodSubtypeIndex;
+            if (selectedSubtypeIndex == NOT_A_SUBTYPE_INDEX) {
+                // TODO(b/351124299): Check if this fallback logic is still necessary.
+                final var bindingController = getInputMethodBindingController(userId);
+                final var curSubtype = bindingController.getCurrentInputMethodSubtype();
+                if (curSubtype != null) {
+                    final var curMethodId = bindingController.getSelectedMethodId();
+                    final var curImi = settings.getMethodMap().get(curMethodId);
+                    selectedSubtypeIndex = SubtypeUtils.getSubtypeIndexFromHashCode(
+                            curImi, curSubtype.hashCode());
+                }
             }
 
-            mMenuControllerNew.show(menuItems, selectedIndex, displayId, userId);
+            mMenuControllerNew.show(imList, lastInputMethodId, selectedSubtypeIndex, displayId,
+                    userId);
         } else {
             mMenuController.showInputMethodMenuLocked(showAuxSubtypes, displayId,
                     lastInputMethodId, lastInputMethodSubtypeIndex, imList, userId);
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
index cf2cdc1..1d0e3c6 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
@@ -30,7 +30,6 @@
 import android.annotation.UserIdInt;
 import android.app.AlertDialog;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.os.UserHandle;
 import android.provider.Settings;
@@ -48,8 +47,11 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.widget.RecyclerView;
+import com.android.server.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -80,18 +82,27 @@
     /**
      * Shows the Input Method Switcher Menu, with a list of IMEs and their subtypes.
      *
-     * @param items         the list of menu items.
-     * @param selectedIndex the index of the menu item that is selected.
-     *                      If no other IMEs are enabled, this index will be out of reach.
-     * @param displayId     the ID of the display where the menu was requested.
-     * @param userId        the ID of the user that requested the menu.
+     * @param items                the list of input method and subtype items.
+     * @param selectedImeId        the ID of the selected input method.
+     * @param selectedSubtypeIndex the index of the selected subtype in the input method's array of
+     *                             subtypes, or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if no
+     *                             subtype is selected.
+     * @param displayId            the ID of the display where the menu was requested.
+     * @param userId               the ID of the user that requested the menu.
      */
     @RequiresPermission(allOf = {INTERACT_ACROSS_USERS, HIDE_OVERLAY_WINDOWS})
-    void show(@NonNull List<MenuItem> items, int selectedIndex, int displayId,
-            @UserIdInt int userId) {
+    void show(@NonNull List<ImeSubtypeListItem> items, @Nullable String selectedImeId,
+            int selectedSubtypeIndex, int displayId, @UserIdInt int userId) {
         // Hide the menu in case it was already showing.
         hide(displayId, userId);
 
+        final var menuItems = getMenuItems(items);
+        final int selectedIndex = getSelectedIndex(menuItems, selectedImeId, selectedSubtypeIndex);
+        if (selectedIndex == -1) {
+            Slog.w(TAG, "Switching menu shown with no item selected, IME id: " + selectedImeId
+                    + ", subtype index: " + selectedSubtypeIndex);
+        }
+
         final Context dialogWindowContext = mDialogWindowContext.get(displayId);
         final var builder = new AlertDialog.Builder(dialogWindowContext,
                 com.android.internal.R.style.Theme_DeviceDefault_InputMethodSwitcherDialog);
@@ -104,52 +115,28 @@
                 dialogWindowContext.getText(com.android.internal.R.string.select_input_method));
         builder.setView(contentView);
 
-        final DialogInterface.OnClickListener onClickListener = (dialog, which) -> {
-            if (which != selectedIndex) {
-                final var item = items.get(which);
+        final OnClickListener onClickListener = (item, isSelected) -> {
+            if (!isSelected) {
                 InputMethodManagerInternal.get()
                         .switchToInputMethod(item.mImi.getId(), item.mSubtypeIndex, userId);
             }
             hide(displayId, userId);
         };
 
-        final var selectedImi = selectedIndex >= 0 ? items.get(selectedIndex).mImi : null;
-        final var languageSettingsIntent = selectedImi != null
-                ? selectedImi.createImeLanguageSettingsActivityIntent() : null;
-        final boolean isDeviceProvisioned = Settings.Global.getInt(
-                dialogWindowContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED,
-                0) != 0;
-        final boolean hasLanguageSettingsButton = languageSettingsIntent != null
-                && isDeviceProvisioned;
-        if (hasLanguageSettingsButton) {
-            final View buttonBar = contentView
-                    .requireViewById(com.android.internal.R.id.button_bar);
-            buttonBar.setVisibility(View.VISIBLE);
-
-            languageSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            final Button languageSettingsButton = contentView
-                    .requireViewById(com.android.internal.R.id.button1);
-            languageSettingsButton.setVisibility(View.VISIBLE);
-            languageSettingsButton.setOnClickListener(v -> {
-                v.getContext().startActivityAsUser(languageSettingsIntent, UserHandle.of(userId));
-                hide(displayId, userId);
-            });
-        }
-
         // Create the current IME subtypes list.
         final RecyclerView recyclerView = contentView
                 .requireViewById(com.android.internal.R.id.list);
-        recyclerView.setAdapter(new Adapter(items, selectedIndex, inflater, onClickListener));
+        recyclerView.setAdapter(new Adapter(menuItems, selectedIndex, inflater, onClickListener));
         // Scroll to the currently selected IME. This must run after the recycler view is laid out.
         recyclerView.post(() -> recyclerView.scrollToPosition(selectedIndex));
-        // Indicate that the list can be scrolled.
-        recyclerView.setScrollIndicators(
-                hasLanguageSettingsButton ? View.SCROLL_INDICATOR_BOTTOM : 0);
         // Request focus to enable rotary scrolling on watches.
         recyclerView.requestFocus();
 
+        final var selectedItem = selectedIndex > -1 ? menuItems.get(selectedIndex) : null;
+        updateLanguageSettingsButton(selectedItem, contentView, displayId, userId);
+
         builder.setOnCancelListener(dialog -> hide(displayId, userId));
-        mMenuItems = items;
+        mMenuItems = menuItems;
         mDialog = builder.create();
         mDialog.setCanceledOnTouchOutside(true);
         final Window w = mDialog.getWindow();
@@ -208,98 +195,303 @@
     }
 
     /**
-     * Item to be shown in the Input Method Switcher Menu, containing an input method and
-     * optionally an input method subtype.
+     * Creates the list of menu items from the given list of input methods and subtypes. This
+     * handles adding headers and dividers between groups of items from different input methods
+     * as follows:
+     *
+     * <li>If there is only one group, no divider or header will be added.</li>
+     * <li>A divider is added before each group, except the first one.</li>
+     * <li>A header is added before each group (after the divider, if it exists) if the group has
+     * at least two items, or a single item with a subtype name.</li>
+     *
+     * @param items the list of input method and subtype items.
      */
-    static class MenuItem {
+    @VisibleForTesting
+    @NonNull
+    static List<MenuItem> getMenuItems(@NonNull List<ImeSubtypeListItem> items) {
+        final var menuItems = new ArrayList<MenuItem>();
+        if (items.isEmpty()) {
+            return menuItems;
+        }
+
+        final var itemsArray = (ArrayList<ImeSubtypeListItem>) items;
+        final int numItems = itemsArray.size();
+        // Initialize to the last IME id to avoid headers if there is only a single IME.
+        String prevImeId = itemsArray.getLast().mImi.getId();
+        boolean firstGroup = true;
+        for (int i = 0; i < numItems; i++) {
+            final var item = itemsArray.get(i);
+
+            final var imeId = item.mImi.getId();
+            final boolean groupChange = !imeId.equals(prevImeId);
+            if (groupChange) {
+                if (!firstGroup) {
+                    menuItems.add(DividerItem.getInstance());
+                }
+                // Add a header if we have at least two items, or a single item with a subtype name.
+                final var nextItemId = i + 1 < numItems ? itemsArray.get(i + 1).mImi.getId() : null;
+                final boolean addHeader = item.mSubtypeName != null || imeId.equals(nextItemId);
+                if (addHeader) {
+                    menuItems.add(new HeaderItem(item.mImeName));
+                }
+                firstGroup = false;
+                prevImeId = imeId;
+            }
+
+            menuItems.add(new SubtypeItem(item.mImeName, item.mSubtypeName, item.mImi,
+                    item.mSubtypeIndex));
+        }
+
+        return menuItems;
+    }
+
+    /**
+     * Gets the index of the selected item.
+     *
+     * @param items                the list of menu items.
+     * @param selectedImeId        the ID of the selected input method.
+     * @param selectedSubtypeIndex the index of the selected subtype in the input method's array of
+     *                             subtypes, or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if no
+     *                             subtype is selected.
+     * @return the index of the selected item, or {@code -1} if no item is selected.
+     */
+    @VisibleForTesting
+    @IntRange(from = -1)
+    static int getSelectedIndex(@NonNull List<MenuItem> items, @Nullable String selectedImeId,
+            int selectedSubtypeIndex) {
+        for (int i = 0; i < items.size(); i++) {
+            final var item = items.get(i);
+            if (item instanceof SubtypeItem subtypeItem) {
+                final var imeId = subtypeItem.mImi.getId();
+                final int subtypeIndex = subtypeItem.mSubtypeIndex;
+                if (imeId.equals(selectedImeId)
+                        && ((subtypeIndex == 0 && selectedSubtypeIndex == NOT_A_SUBTYPE_INDEX)
+                            || subtypeIndex == NOT_A_SUBTYPE_INDEX
+                            || subtypeIndex == selectedSubtypeIndex)) {
+                    return i;
+                }
+            }
+        }
+        // Either there is no selected IME, or the selected subtype is enabled but not in the list.
+        // This can happen if an implicit subtype is selected, but we got a list of explicit
+        // subtypes. In this case, the implicit subtype will no longer be included in the list.
+        return -1;
+    }
+
+    /**
+     * Updates the visibility of the Language Settings button to visible if the currently selected
+     * item specifies a (language) settings activity and the device is provisioned. Otherwise,
+     * the button won't be shown.
+     *
+     * @param selectedItem the currently selected item, or {@code null} if no item is selected.
+     * @param view         the menu dialog view.
+     * @param displayId    the ID of the display where the menu was requested.
+     * @param userId       the ID of the user that requested the menu.
+     */
+    @RequiresPermission(allOf = {INTERACT_ACROSS_USERS})
+    private void updateLanguageSettingsButton(@Nullable MenuItem selectedItem, @NonNull View view,
+            int displayId, @UserIdInt int userId) {
+        final var settingsIntent = (selectedItem instanceof SubtypeItem selectedSubtypeItem)
+                ? selectedSubtypeItem.mImi.createImeLanguageSettingsActivityIntent() : null;
+        final boolean isDeviceProvisioned = Settings.Global.getInt(
+                view.getContext().getContentResolver(), Settings.Global.DEVICE_PROVISIONED,
+                0) != 0;
+        final boolean hasButton = settingsIntent != null && isDeviceProvisioned;
+        final View buttonBar = view.requireViewById(com.android.internal.R.id.button_bar);
+        final Button button = view.requireViewById(com.android.internal.R.id.button1);
+        final RecyclerView recyclerView = view.requireViewById(com.android.internal.R.id.list);
+        if (hasButton) {
+            settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            buttonBar.setVisibility(View.VISIBLE);
+            button.setOnClickListener(v -> {
+                v.getContext().startActivityAsUser(settingsIntent, UserHandle.of(userId));
+                hide(displayId, userId);
+            });
+            // Indicate that the list can be scrolled.
+            recyclerView.setScrollIndicators(View.SCROLL_INDICATOR_BOTTOM);
+        } else {
+            buttonBar.setVisibility(View.GONE);
+            button.setOnClickListener(null);
+            // Remove scroll indicator as there is nothing drawn below the list.
+            recyclerView.setScrollIndicators(0 /* indicators */);
+        }
+    }
+
+    /**
+     * Interface definition for callbacks to be invoked when a {@link SubtypeItem} is clicked.
+     */
+    private interface OnClickListener {
+
+        /**
+         * Called when an item is clicked.
+         *
+         * @param item       The item that was clicked.
+         * @param isSelected Whether the item is the currently selected one.
+         */
+        void onClick(@NonNull SubtypeItem item, boolean isSelected);
+    }
+
+    /** Item to be displayed in the menu. */
+    sealed interface MenuItem {}
+
+    /** Subtype item containing an input method and optionally an input method subtype. */
+    static final class SubtypeItem implements MenuItem {
 
         /** The name of the input method. */
         @NonNull
-        private final CharSequence mImeName;
+        final CharSequence mImeName;
 
         /**
          * The name of the input method subtype, or {@code null} if this item doesn't have a
          * subtype.
          */
         @Nullable
-        private final CharSequence mSubtypeName;
+        final CharSequence mSubtypeName;
 
         /** The info of the input method. */
         @NonNull
-        private final InputMethodInfo mImi;
+        final InputMethodInfo mImi;
 
         /**
          * The index of the subtype in the input method's array of subtypes,
          * or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if this item doesn't have a subtype.
          */
         @IntRange(from = NOT_A_SUBTYPE_INDEX)
-        private final int mSubtypeIndex;
+        final int mSubtypeIndex;
 
-        /** Whether this item has a group header (only the first item of each input method). */
-        private final boolean mHasHeader;
-
-        /**
-         * Whether this item should has a group divider (same as {@link #mHasHeader},
-         * excluding the first IME).
-         */
-        private final boolean mHasDivider;
-
-        MenuItem(@NonNull CharSequence imeName, @Nullable CharSequence subtypeName,
+        SubtypeItem(@NonNull CharSequence imeName, @Nullable CharSequence subtypeName,
                 @NonNull InputMethodInfo imi,
-                @IntRange(from = NOT_A_SUBTYPE_INDEX) int subtypeIndex, boolean hasHeader,
-                boolean hasDivider) {
+                @IntRange(from = NOT_A_SUBTYPE_INDEX) int subtypeIndex) {
             mImeName = imeName;
             mSubtypeName = subtypeName;
             mImi = imi;
             mSubtypeIndex = subtypeIndex;
-            mHasHeader = hasHeader;
-            mHasDivider = hasDivider;
         }
 
         @Override
         public String toString() {
-            return "MenuItem{"
+            return "SubtypeItem{"
                     + "mImeName=" + mImeName
                     + " mSubtypeName=" + mSubtypeName
                     + " mSubtypeIndex=" + mSubtypeIndex
-                    + " mHasHeader=" + mHasHeader
-                    + " mHasDivider=" + mHasDivider
                     + "}";
         }
     }
 
-    private static class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder> {
+    /** Header item displayed before a group of {@link SubtypeItem} of the same input method. */
+    static final class HeaderItem implements MenuItem {
+
+        /** The header title. */
+        @NonNull
+        final CharSequence mTitle;
+
+        HeaderItem(@NonNull CharSequence title) {
+            mTitle = title;
+        }
+
+        @Override
+        public String toString() {
+            return "HeaderItem{"
+                    + "mTitle=" + mTitle
+                    + "}";
+        }
+    }
+
+    /** Divider item displayed before a {@link HeaderItem}. */
+    static final class DividerItem implements MenuItem {
+
+        private static DividerItem sInstance;
+
+        /** Gets a singleton instance of DividerItem. */
+        @NonNull
+        static DividerItem getInstance() {
+            if (sInstance == null) {
+                sInstance = new DividerItem();
+            }
+            return sInstance;
+        }
+
+        @Override
+        public String toString() {
+            return "DividerItem{}";
+        }
+    }
+
+    private static final class Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+
+        /** View type for unknown item. */
+        private static final int TYPE_UNKNOWN = -1;
+
+        /** View type for {@link SubtypeItem}. */
+        private static final int TYPE_SUBTYPE = 0;
+
+        /** View type for {@link HeaderItem}. */
+        private static final int TYPE_HEADER = 1;
+
+        /** View type for {@link DividerItem}. */
+        private static final int TYPE_DIVIDER = 2;
 
         /** The list of items to show. */
         @NonNull
         private final List<MenuItem> mItems;
         /** The index of the selected item. */
+        @IntRange(from = -1)
         private final int mSelectedIndex;
         @NonNull
         private final LayoutInflater mInflater;
+        /** The listener used to handle clicks on {@link SubtypeViewHolder} items. */
         @NonNull
-        private final DialogInterface.OnClickListener mOnClickListener;
+        private final OnClickListener mListener;
 
-        Adapter(@NonNull List<MenuItem> items, int selectedIndex,
+        Adapter(@NonNull List<MenuItem> items, @IntRange(from = -1) int selectedIndex,
                 @NonNull LayoutInflater inflater,
-                @NonNull DialogInterface.OnClickListener onClickListener) {
+                @NonNull OnClickListener listener) {
             mItems = items;
             mSelectedIndex = selectedIndex;
             mInflater = inflater;
-            mOnClickListener = onClickListener;
+            mListener = listener;
         }
 
         @Override
-        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-            final View view = mInflater.inflate(
-                    com.android.internal.R.layout.input_method_switch_item_new, parent, false);
-
-            return new ViewHolder(view, mOnClickListener);
+        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+            switch (viewType) {
+                case TYPE_SUBTYPE -> {
+                    final View view = mInflater.inflate(
+                            com.android.internal.R.layout.input_method_switch_item_new, parent,
+                            false);
+                    return new SubtypeViewHolder(view, mListener);
+                }
+                case TYPE_HEADER -> {
+                    final View view = mInflater.inflate(
+                            com.android.internal.R.layout.input_method_switch_item_header, parent,
+                            false);
+                    return new HeaderViewHolder(view);
+                }
+                case TYPE_DIVIDER -> {
+                    final View view = mInflater.inflate(
+                            com.android.internal.R.layout.input_method_switch_item_divider, parent,
+                            false);
+                    return new DividerViewHolder(view);
+                }
+                default -> throw new IllegalArgumentException("Unknown viewType: " + viewType);
+            }
         }
 
         @Override
-        public void onBindViewHolder(ViewHolder holder, int position) {
-            holder.bind(mItems.get(position), position == mSelectedIndex /* isSelected */);
+        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
+            final var item = mItems.get(position);
+            if (holder instanceof SubtypeViewHolder subtypeHolder
+                    && item instanceof SubtypeItem subtypeItem) {
+                subtypeHolder.bind(subtypeItem, position == mSelectedIndex /* isSelected */);
+            } else if (holder instanceof HeaderViewHolder headerHolder
+                    && item instanceof HeaderItem headerItem) {
+                headerHolder.bind(headerItem);
+            } else if (holder instanceof DividerViewHolder && item instanceof DividerItem) {
+                // Nothing to bind for dividers.
+                return;
+            } else {
+                Slog.w(TAG, "Holder type: " + holder + " doesn't match item type: " + item);
+            }
         }
 
         @Override
@@ -307,7 +499,21 @@
             return mItems.size();
         }
 
-        private static class ViewHolder extends RecyclerView.ViewHolder {
+        @Override
+        public int getItemViewType(int position) {
+            final var item = mItems.get(position);
+            if (item instanceof SubtypeItem) {
+                return TYPE_SUBTYPE;
+            } else if (item instanceof HeaderItem) {
+                return TYPE_HEADER;
+            } else if (item instanceof DividerItem) {
+                return TYPE_DIVIDER;
+            } else {
+                return TYPE_UNKNOWN;
+            }
+        }
+
+        private static final class SubtypeViewHolder extends RecyclerView.ViewHolder {
 
             /** The container of the item. */
             @NonNull
@@ -318,46 +524,74 @@
             /** Indicator for the selected status of the item. */
             @NonNull
             private final ImageView mCheckmark;
-            /** The group header optionally drawn above the item. */
-            @NonNull
-            private final TextView mHeader;
-            /** The group divider optionally drawn above the item. */
-            @NonNull
-            private final View mDivider;
 
-            private ViewHolder(@NonNull View itemView,
-                    @NonNull DialogInterface.OnClickListener onClickListener) {
+            /** The bound item data, or {@code null} if no item was bound yet. */
+            @Nullable
+            private SubtypeItem mItem;
+            /** Whether this item is the currently selected one. */
+            private boolean mIsSelected;
+
+            SubtypeViewHolder(@NonNull View itemView, @NonNull OnClickListener listener) {
                 super(itemView);
 
-                mContainer = itemView.requireViewById(com.android.internal.R.id.list_item);
+                mContainer = itemView;
                 mName = itemView.requireViewById(com.android.internal.R.id.text);
                 mCheckmark = itemView.requireViewById(com.android.internal.R.id.image);
-                mHeader = itemView.requireViewById(com.android.internal.R.id.header_text);
-                mDivider = itemView.requireViewById(com.android.internal.R.id.divider);
 
-                mContainer.setOnClickListener((v) ->
-                        onClickListener.onClick(null /* dialog */, getAdapterPosition()));
+                mContainer.setOnClickListener((v) -> {
+                    if (mItem != null) {
+                        listener.onClick(mItem, mIsSelected);
+                    }
+                });
             }
 
             /**
              * Binds the given item to the current view.
              *
              * @param item       the item to bind.
-             * @param isSelected whether this is selected.
+             * @param isSelected whether the item is selected.
              */
-            private void bind(@NonNull MenuItem item, boolean isSelected) {
+            void bind(@NonNull SubtypeItem item, boolean isSelected) {
+                mItem = item;
+                mIsSelected = isSelected;
                 // Use the IME name for subtypes with an empty subtype name.
                 final var name = TextUtils.isEmpty(item.mSubtypeName)
                         ? item.mImeName : item.mSubtypeName;
                 mContainer.setActivated(isSelected);
                 // Activated is the correct state, but we also set selected for accessibility info.
                 mContainer.setSelected(isSelected);
+                // Trigger the ellipsize marquee behaviour by selecting the name.
                 mName.setSelected(isSelected);
                 mName.setText(name);
                 mCheckmark.setVisibility(isSelected ? View.VISIBLE : View.GONE);
-                mHeader.setText(item.mImeName);
-                mHeader.setVisibility(item.mHasHeader ? View.VISIBLE : View.GONE);
-                mDivider.setVisibility(item.mHasDivider ? View.VISIBLE : View.GONE);
+            }
+        }
+
+        private static final class HeaderViewHolder extends RecyclerView.ViewHolder {
+
+            /** The title view, only visible if the bound item has a title. */
+            private final TextView mTitle;
+
+            HeaderViewHolder(@NonNull View itemView) {
+                super(itemView);
+
+                mTitle = itemView.requireViewById(com.android.internal.R.id.header_text);
+            }
+
+            /**
+             * Binds the given item to the current view.
+             *
+             * @param item the item to bind.
+             */
+            void bind(@NonNull HeaderItem item) {
+                mTitle.setText(item.mTitle);
+            }
+        }
+
+        private static final class DividerViewHolder extends RecyclerView.ViewHolder {
+
+            DividerViewHolder(@NonNull View itemView) {
+                super(itemView);
             }
         }
     }
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
index 9e70f81..3349b13 100644
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
@@ -1986,6 +1986,7 @@
      * bypassing DND. It should be called whenever a channel is created, updated, or deleted, or
      * when the current user (or its profiles) change.
      */
+    // TODO: b/368247671 - remove fromSystemOrSystemUi argument when modes_ui is inlined.
     private void updateCurrentUserHasChannelsBypassingDnd(int callingUid,
             boolean fromSystemOrSystemUi) {
         ArraySet<Pair<String, Integer>> candidatePkgs = new ArraySet<>();
@@ -2016,7 +2017,12 @@
         boolean haveBypassingApps = candidatePkgs.size() > 0;
         if (mCurrentUserHasChannelsBypassingDnd != haveBypassingApps) {
             mCurrentUserHasChannelsBypassingDnd = haveBypassingApps;
-            updateZenPolicy(mCurrentUserHasChannelsBypassingDnd, callingUid, fromSystemOrSystemUi);
+            if (android.app.Flags.modesUi()) {
+                mZenModeHelper.updateHasPriorityChannels(mCurrentUserHasChannelsBypassingDnd);
+            } else {
+                updateZenPolicy(mCurrentUserHasChannelsBypassingDnd, callingUid,
+                        fromSystemOrSystemUi);
+            }
         }
     }
 
@@ -2034,6 +2040,9 @@
         return true;
     }
 
+    // TODO: b/368247671 - delete this method when modes_ui is inlined, as
+    //                     updateCurrentUserHasChannelsBypassingDnd was the only caller and
+    //                     PreferencesHelper should otherwise not need to modify actual policy
     public void updateZenPolicy(boolean areChannelsBypassingDnd, int callingUid,
             boolean fromSystemOrSystemUi) {
         NotificationManager.Policy policy = mZenModeHelper.getNotificationPolicy();
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index ea211a9..5547bd3 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -1567,6 +1567,28 @@
         return azr;
     }
 
+    // Update only the hasPriorityChannels state (aka areChannelsBypassingDnd) without modifying
+    // any of the rest of the existing policy. This allows components that only want to modify
+    // this bit (PreferencesHelper) to not have to adjust the rest of the policy.
+    protected void updateHasPriorityChannels(boolean hasPriorityChannels) {
+        if (!Flags.modesUi()) {
+            Log.wtf(TAG, "updateHasPriorityChannels called without modes_ui");
+        }
+        synchronized (mConfigLock) {
+            // If it already matches, do nothing
+            if (mConfig.areChannelsBypassingDnd == hasPriorityChannels) {
+                return;
+            }
+
+            ZenModeConfig newConfig = mConfig.copy();
+            newConfig.areChannelsBypassingDnd = hasPriorityChannels;
+            // The updated calculation of whether there are priority channels is always done by
+            // the system, even if the event causing the calculation had a different origin.
+            setConfigLocked(newConfig, null, ORIGIN_SYSTEM, "updateHasPriorityChannels",
+                    Process.SYSTEM_UID);
+        }
+    }
+
     @SuppressLint("MissingPermission")
     void scheduleActivationBroadcast(String pkg, @UserIdInt int userId, String ruleId,
             boolean activated) {
diff --git a/services/core/java/com/android/server/notification/flags.aconfig b/services/core/java/com/android/server/notification/flags.aconfig
index 0b34177..a24c743 100644
--- a/services/core/java/com/android/server/notification/flags.aconfig
+++ b/services/core/java/com/android/server/notification/flags.aconfig
@@ -180,3 +180,10 @@
     purpose: PURPOSE_BUGFIX
   }
 }
+
+flag {
+  name: "notification_vibration_in_sound_uri_for_channel"
+  namespace: "systemui"
+  description: "Enables sound uri with vibration source in notification channel"
+  bug: "351975435"
+}
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index b228bb9..be7631d 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -2768,7 +2768,8 @@
             enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false,
                     !isRecentsAccessingChildProfiles(Binder.getCallingUid(), userId),
                     "MATCH_ANY_USER flag requires INTERACT_ACROSS_USERS permission");
-        } else if ((flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0
+        } else if (!Flags.removeCrossUserPermissionHack()
+                && (flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0
                 && isCallerSystemUser
                 && mUserManager.hasProfile(UserHandle.USER_SYSTEM)) {
             // If the caller wants all packages and has a profile associated with it,
diff --git a/services/core/java/com/android/server/wm/InsetsSourceProvider.java b/services/core/java/com/android/server/wm/InsetsSourceProvider.java
index 8f28f59..6067a99 100644
--- a/services/core/java/com/android/server/wm/InsetsSourceProvider.java
+++ b/services/core/java/com/android/server/wm/InsetsSourceProvider.java
@@ -384,16 +384,19 @@
         }
         final boolean serverVisibleChanged = mServerVisible != isServerVisible;
         setServerVisible(isServerVisible);
-        final boolean positionChanged = updateInsetsControlPosition(windowState);
-        if (mControl != null && !positionChanged
-                // The insets hint would be updated if the position is changed. Here updates it for
-                // the possible change of the bounds or the server visibility.
-                && (updateInsetsHint()
-                        || serverVisibleChanged
-                                && android.view.inputmethod.Flags.refactorInsetsController())) {
-            // Only call notifyControlChanged here when the position is not changed. Otherwise, it
-            // is called or is scheduled to be called during updateInsetsControlPosition.
-            mStateController.notifyControlChanged(mControlTarget, this);
+        if (mControl != null) {
+            final boolean positionChanged = updateInsetsControlPosition(windowState);
+            if (!(positionChanged || mHasPendingPosition)
+                    // The insets hint would be updated while changing the position. Here updates it
+                    // for the possible change of the bounds or the server visibility.
+                    && (updateInsetsHint()
+                            || (android.view.inputmethod.Flags.refactorInsetsController()))
+                                    && serverVisibleChanged) {
+                // Only call notifyControlChanged here when the position hasn't been or won't be
+                // changed. Otherwise, it has been called or scheduled to be called during
+                // updateInsetsControlPosition.
+                mStateController.notifyControlChanged(mControlTarget, this);
+            }
         }
     }
 
@@ -409,6 +412,7 @@
             mPosition.set(position.x, position.y);
             if (windowState != null && windowState.getWindowFrames().didFrameSizeChange()
                     && windowState.mWinAnimator.getShown() && mWindowContainer.okToDisplay()) {
+                mHasPendingPosition = true;
                 windowState.applyWithNextDraw(mSetControlPositionConsumer);
             } else {
                 Transaction t = mWindowContainer.getSyncTransaction();
diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodMenuControllerTest.java b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodMenuControllerTest.java
new file mode 100644
index 0000000..02dc86b
--- /dev/null
+++ b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodMenuControllerTest.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (C) 2024 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.inputmethod;
+
+import static com.android.server.inputmethod.InputMethodMenuControllerNew.getMenuItems;
+import static com.android.server.inputmethod.InputMethodMenuControllerNew.getSelectedIndex;
+import static com.android.server.inputmethod.InputMethodSubtypeSwitchingControllerTest.addTestImeSubtypeListItems;
+import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_INDEX;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.platform.test.annotations.RequiresFlagsEnabled;
+import android.platform.test.flag.junit.CheckFlagsRule;
+import android.platform.test.flag.junit.DeviceFlagsValueProvider;
+import android.view.inputmethod.Flags;
+
+import com.android.server.inputmethod.InputMethodMenuControllerNew.DividerItem;
+import com.android.server.inputmethod.InputMethodMenuControllerNew.HeaderItem;
+import com.android.server.inputmethod.InputMethodMenuControllerNew.SubtypeItem;
+import com.android.server.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RequiresFlagsEnabled(Flags.FLAG_IME_SWITCHER_REVAMP)
+public class InputMethodMenuControllerTest {
+
+    @Rule
+    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
+
+    /** Verifies that getMenuItems maintains the same order and information from the given items. */
+    @Test
+    public void testGetMenuItems() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                null, true /* supportsSwitchingToNextInputMethod */);
+
+        final var menuItems = getMenuItems(items);
+
+        int itemsIndex = 0;
+
+        for (int i = 0; i < menuItems.size(); i++) {
+            final var menuItem = menuItems.get(i);
+            if (menuItem instanceof SubtypeItem subtypeItem) {
+                final var item = items.get(itemsIndex);
+
+                assertWithMessage("IME name does not match").that(subtypeItem.mImeName)
+                        .isEqualTo(item.mImeName);
+                assertWithMessage("Subtype name does not match").that(subtypeItem.mSubtypeName)
+                        .isEqualTo(item.mSubtypeName);
+                assertWithMessage("InputMethodInfo does not match").that(subtypeItem.mImi)
+                        .isEqualTo(item.mImi);
+                assertWithMessage("Subtype index does not match").that(subtypeItem.mSubtypeIndex)
+                        .isEqualTo(item.mSubtypeIndex);
+
+                itemsIndex++;
+            }
+        }
+
+        assertWithMessage("Items list was not fully traversed").that(itemsIndex)
+                .isEqualTo(items.size());
+    }
+
+    /**
+     * Verifies that getMenuItems does not add a header or divider if all the items belong to
+     * a single input method.
+     */
+    @Test
+    public void testGetMenuItemsNoHeaderOrDividerForSingleInputMethod() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+
+        final var menuItems = getMenuItems(items);
+
+        assertThat(menuItems.stream()
+                .filter(item -> item instanceof HeaderItem || item instanceof DividerItem).toList())
+                .isEmpty();
+    }
+
+    /**
+     * Verifies that getMenuItems only adds headers for item groups with at least two items,
+     * or with a single item with a subtype name.
+     */
+    @Test
+    public void testGetMenuItemsHeaders() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "DefaultIme", "DefaultIme",
+                null, true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "ItalianIme", "ItalianIme",
+                List.of("it"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                null, true /* supportsSwitchingToNextInputMethod */);
+
+        final var menuItems = getMenuItems(items);
+
+        assertWithMessage("Must have menu items").that(menuItems).isNotEmpty();
+
+        final var headersAndDividers = menuItems.stream()
+                .filter(item -> item instanceof HeaderItem || item instanceof DividerItem)
+                .toList();
+
+        assertWithMessage("Must have header and divider items").that(headersAndDividers).hasSize(5);
+
+        assertWithMessage("First group has no header")
+                .that(menuItems.getFirst()).isInstanceOf(SubtypeItem.class);
+        assertWithMessage("Group with multiple items has divider")
+                .that(headersAndDividers.get(0)).isInstanceOf(DividerItem.class);
+        assertWithMessage("Group with multiple items has header")
+                .that(headersAndDividers.get(1)).isInstanceOf(HeaderItem.class);
+        assertWithMessage("Group with single item with subtype name has divider")
+                .that(headersAndDividers.get(2)).isInstanceOf(DividerItem.class);
+        assertWithMessage("Group with single item with subtype name has header")
+                .that(headersAndDividers.get(3)).isInstanceOf(HeaderItem.class);
+        assertWithMessage("Group with single item without subtype name has divider only")
+                .that(headersAndDividers.get(4)).isInstanceOf(DividerItem.class);
+    }
+
+    /** Verifies that getMenuItems adds a divider before every header except the first one. */
+    @Test
+    public void testGetMenuItemsDivider() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "ItalianIme", "ItalianIme",
+                List.of("it"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                null, true /* supportsSwitchingToNextInputMethod */);
+
+        final var menuItems = getMenuItems(items);
+
+        assertWithMessage("First item is a header")
+                .that(menuItems.getFirst()).isInstanceOf(HeaderItem.class);
+        assertWithMessage("Last item is a subtype")
+                .that(menuItems.getLast()).isInstanceOf(SubtypeItem.class);
+
+        for (int i = 0; i < menuItems.size(); i++) {
+            final var item = menuItems.get(i);
+            if (item instanceof HeaderItem && i > 0) {
+                final var prevItem = menuItems.get(i - 1);
+                assertWithMessage("The item before a header should be a divider")
+                        .that(prevItem).isInstanceOf(DividerItem.class);
+            } else if (item instanceof DividerItem && i < menuItems.size() - 1) {
+                final var nextItem = menuItems.get(i + 1);
+                assertWithMessage("The item after a divider should be a header or subtype")
+                        .that(nextItem instanceof HeaderItem || nextItem instanceof SubtypeItem)
+                        .isTrue();
+            }
+        }
+    }
+
+    /**
+     * Verifies that getSelectedIndex returns the matching item when the selected subtype is given.
+     */
+    @Test
+    public void testGetSelectedIndexWithSelectedSubtype() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                List.of("it", "jp", "pt"),  true /* supportsSwitchingToNextInputMethod */);
+
+        final var simpleImeId = items.get(2).mImi.getId();
+        final var menuItems = getMenuItems(items);
+
+        final int selectedIndex = getSelectedIndex(menuItems, simpleImeId, 1);
+        // Two headers + one divider + three items
+        assertThat(selectedIndex).isEqualTo(6);
+    }
+
+    /**
+     * Verifies that getSelectedIndex returns the first item of the selected input method,
+     * when no selected subtype is given.
+     */
+    @Test
+    public void testGetSelectedIndexWithoutSelectedSubtype() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                List.of("it", "jp", "pt"),  true /* supportsSwitchingToNextInputMethod */);
+
+        final var simpleImeId = items.get(2).mImi.getId();
+        final var menuItems = getMenuItems(items);
+
+        final int selectedIndex = getSelectedIndex(menuItems, simpleImeId, NOT_A_SUBTYPE_INDEX);
+
+        // Two headers + one divider + two items
+        assertThat(selectedIndex).isEqualTo(5);
+    }
+
+    /**
+     * Verifies that getSelectedIndex will return the item of the selected input method that has
+     * no subtype, when this is the first one reached, regardless of the given selected subtype.
+     */
+    @Test
+    public void getSelectedIndexNoSubtype() {
+        final var items = new ArrayList<ImeSubtypeListItem>();
+        addTestImeSubtypeListItems(items, "LatinIme", "LatinIme",
+                List.of("en", "fr"), true /* supportsSwitchingToNextInputMethod */);
+        addTestImeSubtypeListItems(items, "SimpleIme", "SimpleIme",
+                null,  true /* supportsSwitchingToNextInputMethod */);
+
+        final var simpleImeId = items.get(2).mImi.getId();
+        final var menuItems = getMenuItems(items);
+
+        final int selectedIndex = getSelectedIndex(menuItems, simpleImeId, 1);
+
+        // One header + one divider + two items
+        assertThat(selectedIndex).isEqualTo(4);
+    }
+}
diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodSubtypeSwitchingControllerTest.java b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodSubtypeSwitchingControllerTest.java
index 770451c..a804f24 100644
--- a/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodSubtypeSwitchingControllerTest.java
+++ b/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodSubtypeSwitchingControllerTest.java
@@ -75,7 +75,7 @@
                 .build();
     }
 
-    private static void addTestImeSubtypeListItems(@NonNull List<ImeSubtypeListItem> items,
+    static void addTestImeSubtypeListItems(@NonNull List<ImeSubtypeListItem> items,
             @NonNull String imeName, @NonNull String imeLabel,
             @Nullable List<String> subtypeLocales, boolean supportsSwitchingToNextInputMethod) {
         final ApplicationInfo ai = new ApplicationInfo();
diff --git a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
index 390eb93..2fe6918 100644
--- a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
@@ -181,12 +181,14 @@
             Intent.ACTION_USER_STARTING);
 
     private static final Set<Integer> START_FOREGROUND_USER_MESSAGE_CODES = newHashSet(
+            0, // for startUserInternalOnHandler
             REPORT_USER_SWITCH_MSG,
             USER_SWITCH_TIMEOUT_MSG,
             USER_START_MSG,
             USER_CURRENT_MSG);
 
     private static final Set<Integer> START_BACKGROUND_USER_MESSAGE_CODES = newHashSet(
+            0, // for startUserInternalOnHandler
             USER_START_MSG,
             REPORT_LOCKED_BOOT_COMPLETE_MSG);
 
@@ -374,7 +376,7 @@
         // and the cascade effect goes on...). In fact, a better approach would to not assert the
         // binder calls, but their side effects (in this case, that the user is stopped right away)
         assertWithMessage("wrong binder message calls").that(mInjector.mHandler.getMessageCodes())
-                .containsExactly(USER_START_MSG);
+                .containsExactly(/* for startUserInternalOnHandler */ 0, USER_START_MSG);
     }
 
     private void startUserAssertions(
diff --git a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
index 8a1bb00..e386808 100644
--- a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
@@ -116,7 +116,6 @@
 
 import androidx.test.platform.app.InstrumentationRegistry;
 
-import com.android.compatibility.common.util.SystemUtil;
 import com.android.internal.app.BlockedAppStreamingActivity;
 import com.android.internal.os.BackgroundThread;
 import com.android.server.LocalServices;
@@ -559,6 +558,68 @@
     }
 
     @Test
+    public void deviceOwner_cannotMessWithAnotherDeviceTheyDoNotOwn() {
+        VirtualDeviceImpl unownedDevice =
+                createVirtualDevice(VIRTUAL_DEVICE_ID_2, DEVICE_OWNER_UID_2);
+
+        // The arguments don't matter, the owner uid check is always the first statement.
+        assertThrows(SecurityException.class, () -> unownedDevice.goToSleep());
+        assertThrows(SecurityException.class, () -> unownedDevice.wakeUp());
+
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.launchPendingIntent(0, null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.registerIntentInterceptor(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.unregisterIntentInterceptor(null));
+
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.addActivityPolicyExemption(null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.removeActivityPolicyExemption(null));
+        assertThrows(SecurityException.class, () -> unownedDevice.setDevicePolicy(0, 0));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.setDevicePolicyForDisplay(0, 0, 0));
+        assertThrows(SecurityException.class, () -> unownedDevice.setDisplayImePolicy(0, 0));
+
+        assertThrows(SecurityException.class, () -> unownedDevice.registerVirtualCamera(null));
+        assertThrows(SecurityException.class, () -> unownedDevice.unregisterVirtualCamera(null));
+
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.onAudioSessionStarting(0, null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.onAudioSessionEnded());
+
+        assertThrows(SecurityException.class, () -> unownedDevice.createVirtualDisplay(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.createVirtualDpad(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.createVirtualMouse(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.createVirtualTouchscreen(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.createVirtualNavigationTouchpad(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.createVirtualStylus(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.createVirtualRotaryEncoder(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.unregisterInputDevice(null));
+
+        assertThrows(SecurityException.class, () -> unownedDevice.sendDpadKeyEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.sendKeyEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.sendButtonEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.sendTouchEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.sendRelativeEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.sendScrollEvent(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.sendStylusMotionEvent(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.sendStylusButtonEvent(null, null));
+        assertThrows(SecurityException.class,
+                () -> unownedDevice.sendRotaryEncoderScrollEvent(null, null));
+        assertThrows(SecurityException.class, () -> unownedDevice.setShowPointerIcon(true));
+
+        assertThrows(SecurityException.class, () -> unownedDevice.getVirtualSensorList());
+        assertThrows(SecurityException.class, () -> unownedDevice.sendSensorEvent(null, null));
+    }
+
+    @Test
     public void getDeviceOwnerUid_oneDevice_returnsCorrectId() {
         int ownerUid = mLocalService.getDeviceOwnerUid(mDeviceImpl.getDeviceId());
         assertThat(ownerUid).isEqualTo(mDeviceImpl.getOwnerUid());
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
index d64b9e8..404ede6 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -18,6 +18,7 @@
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.app.AppOpsManager.MODE_DEFAULT;
 import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
+import static android.app.Flags.FLAG_MODES_UI;
 import static android.app.Notification.VISIBILITY_PRIVATE;
 import static android.app.Notification.VISIBILITY_SECRET;
 import static android.app.NotificationChannel.ALLOW_BUBBLE_ON;
@@ -81,6 +82,7 @@
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
@@ -248,7 +250,7 @@
     @Parameters(name = "{0}")
     public static List<FlagsParameterization> getParams() {
         return FlagsParameterization.allCombinationsOf(
-                FLAG_NOTIFICATION_CLASSIFICATION);
+                FLAG_NOTIFICATION_CLASSIFICATION, FLAG_MODES_UI);
     }
 
     public PreferencesHelperTest(FlagsParameterization flags) {
@@ -2701,7 +2703,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel, true, false,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // create notification channel that can bypass dnd
@@ -2711,18 +2717,30 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel2, true, true,
                 uid, false);
         assertTrue(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(true));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // delete channels
         mHelper.deleteNotificationChannel(PKG_N_MR1, uid, channel.getId(), uid, false);
         assertTrue(mHelper.areChannelsBypassingDnd()); // channel2 can still bypass DND
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         mHelper.deleteNotificationChannel(PKG_N_MR1, uid, channel2.getId(), uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2738,7 +2756,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel, true, false,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // Recreate a channel & now the app has dnd access granted and can set the bypass dnd field
@@ -2748,7 +2770,11 @@
                 uid, false);
 
         assertTrue(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(true));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2764,7 +2790,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel, true, false,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // create notification channel that can bypass dnd, using local app level settings
@@ -2774,18 +2804,30 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel2, true, true,
                 uid, false);
         assertTrue(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(true));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // delete channels
         mHelper.deleteNotificationChannel(PKG_N_MR1, uid, channel.getId(), uid, false);
         assertTrue(mHelper.areChannelsBypassingDnd()); // channel2 can still bypass DND
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         mHelper.deleteNotificationChannel(PKG_N_MR1, uid, channel2.getId(), uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2812,7 +2854,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel2, true, true,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2834,7 +2880,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel2, true, true,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2856,7 +2906,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel2, true, true,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2872,7 +2926,11 @@
         mHelper.createNotificationChannel(PKG_N_MR1, uid, channel, true, false,
                 uid, false);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // update channel so it CAN bypass dnd:
@@ -2880,7 +2938,11 @@
         channel.setBypassDnd(true);
         mHelper.updateNotificationChannel(PKG_N_MR1, uid, channel, true, SYSTEM_UID, true);
         assertTrue(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(true));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
 
         // update channel so it can't bypass dnd:
@@ -2888,7 +2950,11 @@
         channel.setBypassDnd(false);
         mHelper.updateNotificationChannel(PKG_N_MR1, uid, channel, true, SYSTEM_UID, true);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2901,7 +2967,11 @@
         when(mMockZenModeHelper.getNotificationPolicy()).thenReturn(mTestNotificationPolicy);
         mHelper.syncChannelsBypassingDnd();
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, times(1)).updateHasPriorityChannels(eq(false));
+        } else {
+            verify(mMockZenModeHelper, times(1)).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
@@ -2911,7 +2981,11 @@
         mTestNotificationPolicy = new NotificationManager.Policy(0, 0, 0, 0, 0, 0);
         when(mMockZenModeHelper.getNotificationPolicy()).thenReturn(mTestNotificationPolicy);
         assertFalse(mHelper.areChannelsBypassingDnd());
-        verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        if (android.app.Flags.modesUi()) {
+            verify(mMockZenModeHelper, never()).updateHasPriorityChannels(anyBoolean());
+        } else {
+            verify(mMockZenModeHelper, never()).setNotificationPolicy(any(), anyInt(), anyInt());
+        }
         resetZenModeHelper();
     }
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
index 294027b..8b3ac2b 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
@@ -7027,6 +7027,29 @@
                 ZenModeConfig.EVENTS_OBSOLETE_RULE_ID);
     }
 
+    @Test
+    @EnableFlags({FLAG_MODES_API, FLAG_MODES_UI})
+    public void updateHasPriorityChannels_keepsChannelSettings() {
+        setupZenConfig();
+
+        // Set priority channels setting on manual mode to confirm that it is unaffected by changes
+        // to the state describing the existence of such channels.
+        mZenModeHelper.mConfig.manualRule.zenPolicy =
+                new ZenPolicy.Builder(mZenModeHelper.mConfig.manualRule.zenPolicy)
+                        .allowPriorityChannels(false)
+                        .build();
+
+        mZenModeHelper.updateHasPriorityChannels(true);
+        assertThat(mZenModeHelper.getNotificationPolicy().hasPriorityChannels()).isTrue();
+
+        // getNotificationPolicy() gets its policy from the manual rule; channels not permitted
+        assertThat(mZenModeHelper.getNotificationPolicy().allowPriorityChannels()).isFalse();
+
+        mZenModeHelper.updateHasPriorityChannels(false);
+        assertThat(mZenModeHelper.getNotificationPolicy().hasPriorityChannels()).isFalse();
+        assertThat(mZenModeHelper.getNotificationPolicy().allowPriorityChannels()).isFalse();
+    }
+
     private static void addZenRule(ZenModeConfig config, String id, String ownerPkg, int zenMode,
             @Nullable ZenPolicy zenPolicy) {
         ZenRule rule = new ZenRule();
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
index 165bb57..6d8d7b7 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
@@ -27,7 +27,7 @@
 import com.android.hoststubgen.filters.KeepNativeFilter
 import com.android.hoststubgen.filters.OutputFilter
 import com.android.hoststubgen.filters.SanitizationFilter
-import com.android.hoststubgen.filters.createFilterFromTextPolicyFile
+import com.android.hoststubgen.filters.TextFileFilterPolicyParser
 import com.android.hoststubgen.filters.printAsTextPolicy
 import com.android.hoststubgen.utils.ClassFilter
 import com.android.hoststubgen.visitors.BaseAdapter
@@ -178,8 +178,10 @@
 
         // Next, "text based" filter, which allows to override polices without touching
         // the target code.
-        options.policyOverrideFile.ifSet {
-            filter = createFilterFromTextPolicyFile(it, allClasses, filter)
+        if (options.policyOverrideFiles.isNotEmpty()) {
+            val parser = TextFileFilterPolicyParser(allClasses, filter)
+            options.policyOverrideFiles.forEach(parser::parse)
+            filter = parser.createOutputFilter()
         }
 
         // Apply the implicit filter.
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
index b083d89..55e853e 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
@@ -100,7 +100,7 @@
         var defaultClassLoadHook: SetOnce<String?> = SetOnce(null),
         var defaultMethodCallHook: SetOnce<String?> = SetOnce(null),
 
-        var policyOverrideFile: SetOnce<String?> = SetOnce(null),
+        var policyOverrideFiles: MutableList<String> = mutableListOf(),
 
         var defaultPolicy: SetOnce<FilterPolicy> = SetOnce(FilterPolicy.Remove),
 
@@ -164,7 +164,7 @@
                         "--out-jar", "--out-impl-jar" -> ret.outJar.set(nextArg())
 
                         "--policy-override-file" ->
-                            ret.policyOverrideFile.set(nextArg())!!.ensureFileExists()
+                            ret.policyOverrideFiles.add(nextArg().ensureFileExists())
 
                         "--clean-up-on-error" -> ret.cleanUpOnError.set(true)
                         "--no-clean-up-on-error" -> ret.cleanUpOnError.set(false)
@@ -291,7 +291,7 @@
               annotationAllowedClassesFile=$annotationAllowedClassesFile,
               defaultClassLoadHook=$defaultClassLoadHook,
               defaultMethodCallHook=$defaultMethodCallHook,
-              policyOverrideFile=$policyOverrideFile,
+              policyOverrideFiles=${policyOverrideFiles.toTypedArray().contentToString()},
               defaultPolicy=$defaultPolicy,
               cleanUpOnError=$cleanUpOnError,
               enableClassChecker=$enableClassChecker,
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
index 073b503..caf80eb 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
@@ -23,13 +23,10 @@
 import com.android.hoststubgen.log
 import com.android.hoststubgen.normalizeTextLine
 import com.android.hoststubgen.whitespaceRegex
-import org.objectweb.asm.Opcodes
-import org.objectweb.asm.tree.ClassNode
-import java.io.BufferedReader
-import java.io.FileReader
+import java.io.File
 import java.io.PrintWriter
-import java.util.Objects
 import java.util.regex.Pattern
+import org.objectweb.asm.tree.ClassNode
 
 /**
  * Print a class node as a "keep" policy.
@@ -49,256 +46,56 @@
     }
 }
 
-/** Return true if [access] is either public or protected. */
-private fun isVisible(access: Int): Boolean {
-    return (access and (Opcodes.ACC_PUBLIC or Opcodes.ACC_PROTECTED)) != 0
-}
-
 private const val FILTER_REASON = "file-override"
 
-/**
- * Read a given "policy" file and return as an [OutputFilter]
- */
-fun createFilterFromTextPolicyFile(
-        filename: String,
-        classes: ClassNodes,
-        fallback: OutputFilter,
-        ): OutputFilter {
-    log.i("Loading offloaded annotations from $filename ...")
-    log.withIndent {
-        val subclassFilter = SubclassFilter(classes, fallback)
-        val packageFilter = PackageFilter(subclassFilter)
-        val imf = InMemoryOutputFilter(classes, packageFilter)
+private enum class SpecialClass {
+    NotSpecial,
+    Aidl,
+    FeatureFlags,
+    Sysprops,
+    RFile,
+}
 
-        var lineNo = 0
+class TextFileFilterPolicyParser(
+    private val classes: ClassNodes,
+    fallback: OutputFilter
+) {
+    private val subclassFilter = SubclassFilter(classes, fallback)
+    private val packageFilter = PackageFilter(subclassFilter)
+    private val imf = InMemoryOutputFilter(classes, packageFilter)
+    private var aidlPolicy: FilterPolicyWithReason? = null
+    private var featureFlagsPolicy: FilterPolicyWithReason? = null
+    private var syspropsPolicy: FilterPolicyWithReason? = null
+    private var rFilePolicy: FilterPolicyWithReason? = null
+    private val typeRenameSpec = mutableListOf<TextFilePolicyRemapperFilter.TypeRenameSpec>()
+    private val methodReplaceSpec =
+        mutableListOf<TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec>()
 
-        var aidlPolicy: FilterPolicyWithReason? = null
-        var featureFlagsPolicy: FilterPolicyWithReason? = null
-        var syspropsPolicy: FilterPolicyWithReason? = null
-        var rFilePolicy: FilterPolicyWithReason? = null
-        val typeRenameSpec = mutableListOf<TextFilePolicyRemapperFilter.TypeRenameSpec>()
-        val methodReplaceSpec =
-            mutableListOf<TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec>()
+    private lateinit var currentClassName: String
 
-        try {
-            BufferedReader(FileReader(filename)).use { reader ->
-                var className = ""
-
-                while (true) {
-                    var line = reader.readLine() ?: break
+    /**
+     * Read a given "policy" file and return as an [OutputFilter]
+     */
+    fun parse(file: String) {
+        log.i("Loading offloaded annotations from $file ...")
+        log.withIndent {
+            var lineNo = 0
+            try {
+                File(file).forEachLine {
                     lineNo++
-
-                    line = normalizeTextLine(line)
-
+                    val line = normalizeTextLine(it)
                     if (line.isEmpty()) {
-                        continue // skip empty lines.
+                        return@forEachLine // skip empty lines.
                     }
-
-
-                    // TODO: Method too long, break it up.
-
-                    val fields = line.split(whitespaceRegex).toTypedArray()
-                    when (fields[0].lowercase()) {
-                        "p", "package" -> {
-                            if (fields.size < 3) {
-                                throw ParseException("Package ('p') expects 2 fields.")
-                            }
-                            val name = fields[1]
-                            val rawPolicy = fields[2]
-                            if (resolveExtendingClass(name) != null) {
-                                throw ParseException("Package can't be a super class type")
-                            }
-                            if (resolveSpecialClass(name) != SpecialClass.NotSpecial) {
-                                throw ParseException("Package can't be a special class type")
-                            }
-                            if (rawPolicy.startsWith("!")) {
-                                throw ParseException("Package can't have a substitution")
-                            }
-                            if (rawPolicy.startsWith("~")) {
-                                throw ParseException("Package can't have a class load hook")
-                            }
-                            val policy = parsePolicy(rawPolicy)
-                            if (!policy.isUsableWithClasses) {
-                                throw ParseException("Package can't have policy '$policy'")
-                            }
-                            packageFilter.addPolicy(name, policy.withReason(FILTER_REASON))
-                        }
-
-                        "c", "class" -> {
-                            if (fields.size < 3) {
-                                throw ParseException("Class ('c') expects 2 fields.")
-                            }
-                            className = fields[1]
-
-                            // superClass is set when the class name starts with a "*".
-                            val superClass = resolveExtendingClass(className)
-
-                            // :aidl, etc?
-                            val classType = resolveSpecialClass(className)
-
-                            if (fields[2].startsWith("!")) {
-                                if (classType != SpecialClass.NotSpecial) {
-                                    // We could support it, but not needed at least for now.
-                                    throw ParseException(
-                                            "Special class can't have a substitution")
-                                }
-                                // It's a redirection class.
-                                val toClass = fields[2].substring(1)
-                                imf.setRedirectionClass(className, toClass)
-                            } else if (fields[2].startsWith("~")) {
-                                if (classType != SpecialClass.NotSpecial) {
-                                    // We could support it, but not needed at least for now.
-                                    throw ParseException(
-                                            "Special class can't have a class load hook")
-                                }
-                                // It's a class-load hook
-                                val callback = fields[2].substring(1)
-                                imf.setClassLoadHook(className, callback)
-                            } else {
-                                val policy = parsePolicy(fields[2])
-                                if (!policy.isUsableWithClasses) {
-                                    throw ParseException("Class can't have policy '$policy'")
-                                }
-                                Objects.requireNonNull(className)
-
-                                when (classType) {
-                                    SpecialClass.NotSpecial -> {
-                                        // TODO: Duplicate check, etc
-                                        if (superClass == null) {
-                                            imf.setPolicyForClass(
-                                                className, policy.withReason(FILTER_REASON)
-                                            )
-                                        } else {
-                                            subclassFilter.addPolicy(superClass,
-                                                policy.withReason("extends $superClass"))
-                                        }
-                                    }
-                                    SpecialClass.Aidl -> {
-                                        if (aidlPolicy != null) {
-                                            throw ParseException(
-                                                    "Policy for AIDL classes already defined")
-                                        }
-                                        aidlPolicy = policy.withReason(
-                                                "$FILTER_REASON (special-class AIDL)")
-                                    }
-                                    SpecialClass.FeatureFlags -> {
-                                        if (featureFlagsPolicy != null) {
-                                            throw ParseException(
-                                                    "Policy for feature flags already defined")
-                                        }
-                                        featureFlagsPolicy = policy.withReason(
-                                                "$FILTER_REASON (special-class feature flags)")
-                                    }
-                                    SpecialClass.Sysprops -> {
-                                        if (syspropsPolicy != null) {
-                                            throw ParseException(
-                                                    "Policy for sysprops already defined")
-                                        }
-                                        syspropsPolicy = policy.withReason(
-                                                "$FILTER_REASON (special-class sysprops)")
-                                    }
-                                    SpecialClass.RFile -> {
-                                        if (rFilePolicy != null) {
-                                            throw ParseException(
-                                                "Policy for R file already defined")
-                                        }
-                                        rFilePolicy = policy.withReason(
-                                            "$FILTER_REASON (special-class R file)")
-                                    }
-                                }
-                            }
-                        }
-
-                        "f", "field" -> {
-                            if (fields.size < 3) {
-                                throw ParseException("Field ('f') expects 2 fields.")
-                            }
-                            val name = fields[1]
-                            val policy = parsePolicy(fields[2])
-                            if (!policy.isUsableWithFields) {
-                                throw ParseException("Field can't have policy '$policy'")
-                            }
-                            Objects.requireNonNull(className)
-
-                            // TODO: Duplicate check, etc
-                            imf.setPolicyForField(className, name, policy.withReason(FILTER_REASON))
-                        }
-
-                        "m", "method" -> {
-                            if (fields.size < 4) {
-                                throw ParseException("Method ('m') expects 3 fields.")
-                            }
-                            val name = fields[1]
-                            val signature = fields[2]
-                            val policy = parsePolicy(fields[3])
-
-                            if (!policy.isUsableWithMethods) {
-                                throw ParseException("Method can't have policy '$policy'")
-                            }
-
-                            Objects.requireNonNull(className)
-
-                            imf.setPolicyForMethod(className, name, signature,
-                                    policy.withReason(FILTER_REASON))
-                            if (policy == FilterPolicy.Substitute) {
-                                val fromName = fields[3].substring(1)
-
-                                if (fromName == name) {
-                                    throw ParseException(
-                                            "Substitution must have a different name")
-                                }
-
-                                // Set the policy for the "from" method.
-                                imf.setPolicyForMethod(className, fromName, signature,
-                                    FilterPolicy.Keep.withReason(FILTER_REASON))
-
-                                val classAndMethod = splitWithLastPeriod(fromName)
-                                if (classAndMethod != null) {
-                                    // If the substitution target contains a ".", then
-                                    // it's a method call redirect.
-                                    methodReplaceSpec.add(
-                                        TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec(
-                                            className.toJvmClassName(),
-                                            name,
-                                            signature,
-                                            classAndMethod.first.toJvmClassName(),
-                                            classAndMethod.second,
-                                        )
-                                    )
-                                } else {
-                                    // It's an in-class replace.
-                                    // ("@RavenwoodReplace" equivalent)
-                                    imf.setRenameTo(className, fromName, signature, name)
-                                }
-                            }
-                        }
-                        "r", "rename" -> {
-                            if (fields.size < 3) {
-                                throw ParseException("Rename ('r') expects 2 fields.")
-                            }
-                            // Add ".*" to make it a prefix match.
-                            val pattern = Pattern.compile(fields[1] + ".*")
-
-                            // Removing the leading /'s from the prefix. This allows
-                            // using a single '/' as an empty suffix, which is useful to have a
-                            // "negative" rename rule to avoid subsequent raname's from getting
-                            // applied. (Which is needed for services.jar)
-                            val prefix = fields[2].trimStart('/')
-
-                            typeRenameSpec += TextFilePolicyRemapperFilter.TypeRenameSpec(
-                                pattern, prefix)
-                        }
-
-                        else -> {
-                            throw ParseException("Unknown directive \"${fields[0]}\"")
-                        }
-                    }
+                    parseLine(line)
                 }
+            } catch (e: ParseException) {
+                throw e.withSourceInfo(file, lineNo)
             }
-        } catch (e: ParseException) {
-            throw e.withSourceInfo(filename, lineNo)
         }
+    }
 
+    fun createOutputFilter(): OutputFilter {
         var ret: OutputFilter = imf
         if (typeRenameSpec.isNotEmpty()) {
             ret = TextFilePolicyRemapperFilter(typeRenameSpec, ret)
@@ -309,54 +106,271 @@
 
         // Wrap the in-memory-filter with AHF.
         ret = AndroidHeuristicsFilter(
-                classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, ret)
+            classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, ret
+        )
 
         return ret
     }
-}
 
-private enum class SpecialClass {
-    NotSpecial,
-    Aidl,
-    FeatureFlags,
-    Sysprops,
-    RFile,
-}
-
-private fun resolveSpecialClass(className: String): SpecialClass {
-    if (!className.startsWith(":")) {
-        return SpecialClass.NotSpecial
+    private fun parseLine(line: String) {
+        val fields = line.split(whitespaceRegex).toTypedArray()
+        when (fields[0].lowercase()) {
+            "p", "package" -> parsePackage(fields)
+            "c", "class" -> parseClass(fields)
+            "f", "field" -> parseField(fields)
+            "m", "method" -> parseMethod(fields)
+            "r", "rename" -> parseRename(fields)
+            else -> throw ParseException("Unknown directive \"${fields[0]}\"")
+        }
     }
-    when (className.lowercase()) {
-        ":aidl" -> return SpecialClass.Aidl
-        ":feature_flags" -> return SpecialClass.FeatureFlags
-        ":sysprops" -> return SpecialClass.Sysprops
-        ":r" -> return SpecialClass.RFile
-    }
-    throw ParseException("Invalid special class name \"$className\"")
-}
 
-private fun resolveExtendingClass(className: String): String? {
-    if (!className.startsWith("*")) {
-        return null
+    private fun resolveSpecialClass(className: String): SpecialClass {
+        if (!className.startsWith(":")) {
+            return SpecialClass.NotSpecial
+        }
+        when (className.lowercase()) {
+            ":aidl" -> return SpecialClass.Aidl
+            ":feature_flags" -> return SpecialClass.FeatureFlags
+            ":sysprops" -> return SpecialClass.Sysprops
+            ":r" -> return SpecialClass.RFile
+        }
+        throw ParseException("Invalid special class name \"$className\"")
     }
-    return className.substring(1)
-}
 
-private fun parsePolicy(s: String): FilterPolicy {
-    return when (s.lowercase()) {
-        "k", "keep" -> FilterPolicy.Keep
-        "t", "throw" -> FilterPolicy.Throw
-        "r", "remove" -> FilterPolicy.Remove
-        "kc", "keepclass" -> FilterPolicy.KeepClass
-        "i", "ignore" -> FilterPolicy.Ignore
-        "rdr", "redirect" -> FilterPolicy.Redirect
-        else -> {
-            if (s.startsWith("@")) {
-                FilterPolicy.Substitute
-            } else {
-                throw ParseException("Invalid policy \"$s\"")
+    private fun resolveExtendingClass(className: String): String? {
+        if (!className.startsWith("*")) {
+            return null
+        }
+        return className.substring(1)
+    }
+
+    private fun parsePolicy(s: String): FilterPolicy {
+        return when (s.lowercase()) {
+            "k", "keep" -> FilterPolicy.Keep
+            "t", "throw" -> FilterPolicy.Throw
+            "r", "remove" -> FilterPolicy.Remove
+            "kc", "keepclass" -> FilterPolicy.KeepClass
+            "i", "ignore" -> FilterPolicy.Ignore
+            "rdr", "redirect" -> FilterPolicy.Redirect
+            else -> {
+                if (s.startsWith("@")) {
+                    FilterPolicy.Substitute
+                } else {
+                    throw ParseException("Invalid policy \"$s\"")
+                }
             }
         }
     }
+
+    private fun parsePackage(fields: Array<String>) {
+        if (fields.size < 3) {
+            throw ParseException("Package ('p') expects 2 fields.")
+        }
+        val name = fields[1]
+        val rawPolicy = fields[2]
+        if (resolveExtendingClass(name) != null) {
+            throw ParseException("Package can't be a super class type")
+        }
+        if (resolveSpecialClass(name) != SpecialClass.NotSpecial) {
+            throw ParseException("Package can't be a special class type")
+        }
+        if (rawPolicy.startsWith("!")) {
+            throw ParseException("Package can't have a substitution")
+        }
+        if (rawPolicy.startsWith("~")) {
+            throw ParseException("Package can't have a class load hook")
+        }
+        val policy = parsePolicy(rawPolicy)
+        if (!policy.isUsableWithClasses) {
+            throw ParseException("Package can't have policy '$policy'")
+        }
+        packageFilter.addPolicy(name, policy.withReason(FILTER_REASON))
+    }
+
+    private fun parseClass(fields: Array<String>) {
+        if (fields.size < 3) {
+            throw ParseException("Class ('c') expects 2 fields.")
+        }
+        currentClassName = fields[1]
+
+        // superClass is set when the class name starts with a "*".
+        val superClass = resolveExtendingClass(currentClassName)
+
+        // :aidl, etc?
+        val classType = resolveSpecialClass(currentClassName)
+
+        if (fields[2].startsWith("!")) {
+            if (classType != SpecialClass.NotSpecial) {
+                // We could support it, but not needed at least for now.
+                throw ParseException(
+                    "Special class can't have a substitution"
+                )
+            }
+            // It's a redirection class.
+            val toClass = fields[2].substring(1)
+            imf.setRedirectionClass(currentClassName, toClass)
+        } else if (fields[2].startsWith("~")) {
+            if (classType != SpecialClass.NotSpecial) {
+                // We could support it, but not needed at least for now.
+                throw ParseException(
+                    "Special class can't have a class load hook"
+                )
+            }
+            // It's a class-load hook
+            val callback = fields[2].substring(1)
+            imf.setClassLoadHook(currentClassName, callback)
+        } else {
+            val policy = parsePolicy(fields[2])
+            if (!policy.isUsableWithClasses) {
+                throw ParseException("Class can't have policy '$policy'")
+            }
+
+            when (classType) {
+                SpecialClass.NotSpecial -> {
+                    // TODO: Duplicate check, etc
+                    if (superClass == null) {
+                        imf.setPolicyForClass(
+                            currentClassName, policy.withReason(FILTER_REASON)
+                        )
+                    } else {
+                        subclassFilter.addPolicy(
+                            superClass,
+                            policy.withReason("extends $superClass")
+                        )
+                    }
+                }
+
+                SpecialClass.Aidl -> {
+                    if (aidlPolicy != null) {
+                        throw ParseException(
+                            "Policy for AIDL classes already defined"
+                        )
+                    }
+                    aidlPolicy = policy.withReason(
+                        "$FILTER_REASON (special-class AIDL)"
+                    )
+                }
+
+                SpecialClass.FeatureFlags -> {
+                    if (featureFlagsPolicy != null) {
+                        throw ParseException(
+                            "Policy for feature flags already defined"
+                        )
+                    }
+                    featureFlagsPolicy = policy.withReason(
+                        "$FILTER_REASON (special-class feature flags)"
+                    )
+                }
+
+                SpecialClass.Sysprops -> {
+                    if (syspropsPolicy != null) {
+                        throw ParseException(
+                            "Policy for sysprops already defined"
+                        )
+                    }
+                    syspropsPolicy = policy.withReason(
+                        "$FILTER_REASON (special-class sysprops)"
+                    )
+                }
+
+                SpecialClass.RFile -> {
+                    if (rFilePolicy != null) {
+                        throw ParseException(
+                            "Policy for R file already defined"
+                        )
+                    }
+                    rFilePolicy = policy.withReason(
+                        "$FILTER_REASON (special-class R file)"
+                    )
+                }
+            }
+        }
+    }
+
+    private fun parseField(fields: Array<String>) {
+        if (fields.size < 3) {
+            throw ParseException("Field ('f') expects 2 fields.")
+        }
+        val name = fields[1]
+        val policy = parsePolicy(fields[2])
+        if (!policy.isUsableWithFields) {
+            throw ParseException("Field can't have policy '$policy'")
+        }
+        require(this::currentClassName.isInitialized)
+
+        // TODO: Duplicate check, etc
+        imf.setPolicyForField(currentClassName, name, policy.withReason(FILTER_REASON))
+    }
+
+    private fun parseMethod(fields: Array<String>) {
+        if (fields.size < 4) {
+            throw ParseException("Method ('m') expects 3 fields.")
+        }
+        val name = fields[1]
+        val signature = fields[2]
+        val policy = parsePolicy(fields[3])
+
+        if (!policy.isUsableWithMethods) {
+            throw ParseException("Method can't have policy '$policy'")
+        }
+
+        require(this::currentClassName.isInitialized)
+
+        imf.setPolicyForMethod(
+            currentClassName, name, signature,
+            policy.withReason(FILTER_REASON)
+        )
+        if (policy == FilterPolicy.Substitute) {
+            val fromName = fields[3].substring(1)
+
+            if (fromName == name) {
+                throw ParseException(
+                    "Substitution must have a different name"
+                )
+            }
+
+            // Set the policy for the "from" method.
+            imf.setPolicyForMethod(
+                currentClassName, fromName, signature,
+                FilterPolicy.Keep.withReason(FILTER_REASON)
+            )
+
+            val classAndMethod = splitWithLastPeriod(fromName)
+            if (classAndMethod != null) {
+                // If the substitution target contains a ".", then
+                // it's a method call redirect.
+                methodReplaceSpec.add(
+                    TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec(
+                        currentClassName.toJvmClassName(),
+                        name,
+                        signature,
+                        classAndMethod.first.toJvmClassName(),
+                        classAndMethod.second,
+                    )
+                )
+            } else {
+                // It's an in-class replace.
+                // ("@RavenwoodReplace" equivalent)
+                imf.setRenameTo(currentClassName, fromName, signature, name)
+            }
+        }
+    }
+
+    private fun parseRename(fields: Array<String>) {
+        if (fields.size < 3) {
+            throw ParseException("Rename ('r') expects 2 fields.")
+        }
+        // Add ".*" to make it a prefix match.
+        val pattern = Pattern.compile(fields[1] + ".*")
+
+        // Removing the leading /'s from the prefix. This allows
+        // using a single '/' as an empty suffix, which is useful to have a
+        // "negative" rename rule to avoid subsequent raname's from getting
+        // applied. (Which is needed for services.jar)
+        val prefix = fields[2].trimStart('/')
+
+        typeRenameSpec += TextFilePolicyRemapperFilter.TypeRenameSpec(
+            pattern, prefix
+        )
+    }
 }