Merge "Fix the exception thrown when API called bug" into main
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index 1287cb4..23b36e2 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -1820,7 +1820,11 @@
                     jobStatus.getEstimatedNetworkUploadBytes(),
                     jobStatus.getWorkCount(),
                     ActivityManager.processStateAmToProto(mUidProcStates.get(jobStatus.getUid())),
-                    jobStatus.getNamespaceHash());
+                    jobStatus.getNamespaceHash(),
+                    /* system_measured_source_download_bytes */0,
+                    /* system_measured_source_upload_bytes */ 0,
+                    /* system_measured_calling_download_bytes */0,
+                    /* system_measured_calling_upload_bytes */ 0);
 
             // If the job is immediately ready to run, then we can just immediately
             // put it in the pending list and try to schedule it.  This is especially
@@ -2257,7 +2261,11 @@
                     cancelled.getEstimatedNetworkUploadBytes(),
                     cancelled.getWorkCount(),
                     ActivityManager.processStateAmToProto(mUidProcStates.get(cancelled.getUid())),
-                    cancelled.getNamespaceHash());
+                    cancelled.getNamespaceHash(),
+                    /* system_measured_source_download_bytes */ 0,
+                    /* system_measured_source_upload_bytes */ 0,
+                    /* system_measured_calling_download_bytes */0,
+                    /* system_measured_calling_upload_bytes */ 0);
         }
         // If this is a replacement, bring in the new version of the job
         if (incomingJob != null) {
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
index 79653f0..2d49cfb 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java
@@ -45,6 +45,7 @@
 import android.content.PermissionChecker;
 import android.content.ServiceConnection;
 import android.net.Network;
+import android.net.TrafficStats;
 import android.net.Uri;
 import android.os.Binder;
 import android.os.Build;
@@ -241,6 +242,14 @@
     private int mDeathMarkInternalStopReason;
     private String mDeathMarkDebugReason;
 
+    private long mInitialDownloadedBytesFromSource;
+
+    private long mInitialUploadedBytesFromSource;
+
+    private long mInitialDownloadedBytesFromCalling;
+
+    private long mInitialUploadedBytesFromCalling;
+
     // Debugging: reason this job was last stopped.
     public String mStoppedReason;
 
@@ -472,6 +481,14 @@
             }
             mJobPackageTracker.noteActive(job);
             final int sourceUid = job.getSourceUid();
+
+            // Measure UID baseline traffic for deltas
+            mInitialDownloadedBytesFromSource = TrafficStats.getUidRxBytes(sourceUid);
+            mInitialUploadedBytesFromSource = TrafficStats.getUidTxBytes(sourceUid);
+
+            mInitialDownloadedBytesFromCalling = TrafficStats.getUidRxBytes(job.getUid());
+            mInitialUploadedBytesFromCalling = TrafficStats.getUidTxBytes(job.getUid());
+
             FrameworkStatsLog.write(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                     job.isProxyJob() ? new int[]{sourceUid, job.getUid()} : new int[]{sourceUid},
                     // Given that the source tag is set by the calling app, it should be connected
@@ -517,7 +534,11 @@
                     job.getEstimatedNetworkUploadBytes(),
                     job.getWorkCount(),
                     ActivityManager.processStateAmToProto(mService.getUidProcState(job.getUid())),
-                    job.getNamespaceHash());
+                    job.getNamespaceHash(),
+                    /* system_measured_source_download_bytes */ 0,
+                    /* system_measured_source_upload_bytes */ 0,
+                    /* system_measured_calling_download_bytes */ 0,
+                    /* system_measured_calling_upload_bytes */ 0);
             sEnqueuedJwiAtJobStart.logSampleWithUid(job.getUid(), job.getWorkCount());
             final String sourcePackage = job.getSourcePackageName();
             if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) {
@@ -1586,7 +1607,15 @@
                 completedJob.getWorkCount(),
                 ActivityManager
                         .processStateAmToProto(mService.getUidProcState(completedJob.getUid())),
-                completedJob.getNamespaceHash());
+                completedJob.getNamespaceHash(),
+                TrafficStats.getUidRxBytes(completedJob.getSourceUid())
+                        - mInitialDownloadedBytesFromSource,
+                TrafficStats.getUidTxBytes(completedJob.getSourceUid())
+                        - mInitialUploadedBytesFromSource,
+                TrafficStats.getUidRxBytes(completedJob.getUid())
+                        - mInitialDownloadedBytesFromCalling,
+                TrafficStats.getUidTxBytes(completedJob.getUid())
+                        - mInitialUploadedBytesFromCalling);
         if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) {
             Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_SYSTEM_SERVER, "JobScheduler",
                     getId());
diff --git a/core/api/current.txt b/core/api/current.txt
index 9962469..cb293c8 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -42599,6 +42599,7 @@
     field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecom.extra.CALL_DISCONNECT_CAUSE";
     field public static final String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecom.extra.CALL_DISCONNECT_MESSAGE";
     field public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
+    field @FlaggedApi("com.android.server.telecom.flags.add_call_uri_for_missed_calls") public static final String EXTRA_CALL_LOG_URI = "android.telecom.extra.CALL_LOG_URI";
     field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telecom.extra.CALL_NETWORK_TYPE";
     field public static final String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
     field public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = "android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME";
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 5674aec..183b925 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -627,6 +627,7 @@
     field public static final String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service";
     field public static final String OPSTR_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD = "android:capture_consentless_bugreport_on_userdebug_build";
     field public static final String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state";
+    field @FlaggedApi("android.view.contentprotection.flags.create_accessibility_overlay_app_op_enabled") public static final String OPSTR_CREATE_ACCESSIBILITY_OVERLAY = "android:create_accessibility_overlay";
     field public static final String OPSTR_ESTABLISH_VPN_MANAGER = "android:establish_vpn_manager";
     field public static final String OPSTR_ESTABLISH_VPN_SERVICE = "android:establish_vpn_service";
     field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts";
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 7e84ceb..b03bd59 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -16,10 +16,13 @@
 
 package android.app;
 
+import static android.view.contentprotection.flags.Flags.FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED;
+
 import static java.lang.Long.max;
 
 import android.Manifest;
 import android.annotation.CallbackExecutor;
+import android.annotation.FlaggedApi;
 import android.annotation.IntDef;
 import android.annotation.IntRange;
 import android.annotation.NonNull;
@@ -1495,9 +1498,17 @@
     public static final int OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA =
             AppProtoEnums.APP_OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA;
 
+    /**
+     * Creation of an overlay using accessibility services
+     *
+     * @hide
+     */
+    public static final int OP_CREATE_ACCESSIBILITY_OVERLAY =
+            AppProtoEnums.APP_OP_CREATE_ACCESSIBILITY_OVERLAY;
+
     /** @hide */
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
-    public static final int _NUM_OP = 138;
+    public static final int _NUM_OP = 139;
 
     /**
      * All app ops represented as strings.
@@ -1641,7 +1652,8 @@
             OPSTR_CAMERA_SANDBOXED,
             OPSTR_RECORD_AUDIO_SANDBOXED,
             OPSTR_RECEIVE_SANDBOX_TRIGGER_AUDIO,
-            OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA
+            OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA,
+            OPSTR_CREATE_ACCESSIBILITY_OVERLAY,
     })
     public @interface AppOpString {}
 
@@ -2270,6 +2282,16 @@
     public static final String OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA =
             "android:RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA";
 
+    /**
+     * Creation of an overlay using accessibility services
+     *
+     * @hide
+     */
+    @SystemApi
+    @FlaggedApi(FLAG_CREATE_ACCESSIBILITY_OVERLAY_APP_OP_ENABLED)
+    public static final String OPSTR_CREATE_ACCESSIBILITY_OVERLAY =
+            "android:create_accessibility_overlay";
+
     /** {@link #sAppOpsToNote} not initialized yet for this op */
     private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
     /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -2819,7 +2841,11 @@
                 OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA,
                 "RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA")
                 .setPermission(Manifest.permission.RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA)
-                .setDefaultMode(AppOpsManager.MODE_DEFAULT).build()
+                .setDefaultMode(AppOpsManager.MODE_DEFAULT).build(),
+        new AppOpInfo.Builder(OP_CREATE_ACCESSIBILITY_OVERLAY,
+                OPSTR_CREATE_ACCESSIBILITY_OVERLAY,
+                "CREATE_ACCESSIBILITY_OVERLAY")
+                .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
     };
 
     // The number of longs needed to form a full bitmask of app ops
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java
index 3abe1d9..c6012bb 100644
--- a/core/java/android/appwidget/AppWidgetManager.java
+++ b/core/java/android/appwidget/AppWidgetManager.java
@@ -562,13 +562,6 @@
         });
     }
 
-    private boolean isPostingTaskToBackground(@Nullable RemoteViews views) {
-        return Looper.myLooper() == Looper.getMainLooper()
-                && RemoteViews.isAdapterConversionEnabled()
-                && (mHasPostedLegacyLists = mHasPostedLegacyLists
-                        || (views != null && views.hasLegacyLists()));
-    }
-
     /**
      * Set the RemoteViews to use for the specified appWidgetIds.
      * <p>
@@ -593,16 +586,25 @@
             return;
         }
 
-        if (isPostingTaskToBackground(views)) {
-            createUpdateExecutorIfNull().execute(() -> {
-                try {
-                    mService.updateAppWidgetIds(mPackageName, appWidgetIds, views);
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Error updating app widget views in background", e);
-                }
-            });
+        final boolean isConvertingAdapter = RemoteViews.isAdapterConversionEnabled()
+                && (mHasPostedLegacyLists = mHasPostedLegacyLists
+                        || (views != null && views.hasLegacyLists()));
 
-            return;
+        if (isConvertingAdapter) {
+            views.collectAllIntents();
+
+            if (Looper.getMainLooper() == Looper.myLooper()) {
+                RemoteViews viewsCopy = new RemoteViews(views);
+                createUpdateExecutorIfNull().execute(() -> {
+                    try {
+                        mService.updateAppWidgetIds(mPackageName, appWidgetIds, viewsCopy);
+                    } catch (RemoteException e) {
+                        Log.e(TAG, "Error updating app widget views in background", e);
+                    }
+                });
+
+                return;
+            }
         }
 
         try {
@@ -714,16 +716,25 @@
             return;
         }
 
-        if (isPostingTaskToBackground(views)) {
-            createUpdateExecutorIfNull().execute(() -> {
-                try {
-                    mService.partiallyUpdateAppWidgetIds(mPackageName, appWidgetIds, views);
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Error partially updating app widget views in background", e);
-                }
-            });
+        final boolean isConvertingAdapter = RemoteViews.isAdapterConversionEnabled()
+                && (mHasPostedLegacyLists = mHasPostedLegacyLists
+                        || (views != null && views.hasLegacyLists()));
 
-            return;
+        if (isConvertingAdapter) {
+            views.collectAllIntents();
+
+            if (Looper.getMainLooper() == Looper.myLooper()) {
+                RemoteViews viewsCopy = new RemoteViews(views);
+                createUpdateExecutorIfNull().execute(() -> {
+                    try {
+                        mService.partiallyUpdateAppWidgetIds(mPackageName, appWidgetIds, viewsCopy);
+                    } catch (RemoteException e) {
+                        Log.e(TAG, "Error partially updating app widget views in background", e);
+                    }
+                });
+
+                return;
+            }
         }
 
         try {
@@ -782,16 +793,26 @@
             return;
         }
 
-        if (isPostingTaskToBackground(views)) {
-            createUpdateExecutorIfNull().execute(() -> {
-                try {
-                    mService.updateAppWidgetProvider(provider, views);
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Error updating app widget view using provider in background", e);
-                }
-            });
+        final boolean isConvertingAdapter = RemoteViews.isAdapterConversionEnabled()
+                && (mHasPostedLegacyLists = mHasPostedLegacyLists
+                        || (views != null && views.hasLegacyLists()));
 
-            return;
+        if (isConvertingAdapter) {
+            views.collectAllIntents();
+
+            if (Looper.getMainLooper() == Looper.myLooper()) {
+                RemoteViews viewsCopy = new RemoteViews(views);
+                createUpdateExecutorIfNull().execute(() -> {
+                    try {
+                        mService.updateAppWidgetProvider(provider, viewsCopy);
+                    } catch (RemoteException e) {
+                        Log.e(TAG, "Error updating app widget view using provider in background",
+                                e);
+                    }
+                });
+
+                return;
+            }
         }
 
         try {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index ffc4805..ea54c91 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1164,6 +1164,11 @@
      * numbers.  Applications can <strong>dial</strong> emergency numbers using
      * {@link #ACTION_DIAL}, however.
      *
+     * <p>Note: This Intent can only be used to dial call forwarding MMI codes if the application
+     * using this intent is set as the default or system dialer. The system will treat any other
+     * application using this Intent for the purpose of dialing call forwarding MMI codes as if the
+     * {@link #ACTION_DIAL} Intent was used instead.
+     *
      * <p>Note: An app filling the {@link android.app.role.RoleManager#ROLE_DIALER} role should use
      * {@link android.telecom.TelecomManager#placeCall(Uri, Bundle)} to place calls rather than
      * relying on this intent.
diff --git a/core/java/android/view/SurfaceControlRegistry.java b/core/java/android/view/SurfaceControlRegistry.java
index 52be8f6..127d4a7 100644
--- a/core/java/android/view/SurfaceControlRegistry.java
+++ b/core/java/android/view/SurfaceControlRegistry.java
@@ -337,13 +337,13 @@
     @VisibleForTesting
     public final boolean matchesForCallStackDebugging(@Nullable String name, @NonNull String call) {
         final boolean matchCall = !sCallStackDebuggingMatchCall.isEmpty();
-        if (matchCall && !call.toLowerCase().contains(sCallStackDebuggingMatchCall)) {
+        if (matchCall && !sCallStackDebuggingMatchCall.contains(call.toLowerCase())) {
             // Skip if target call doesn't match requested caller
             return false;
         }
         final boolean matchName = !sCallStackDebuggingMatchName.isEmpty();
         if (matchName && (name == null
-                || !name.toLowerCase().contains(sCallStackDebuggingMatchName))) {
+                || !sCallStackDebuggingMatchName.contains(name.toLowerCase()))) {
             // Skip if target surface doesn't match requested surface
             return false;
         }
diff --git a/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig b/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig
index f6ee061..f3dc33c 100644
--- a/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig
+++ b/core/java/android/view/contentprotection/flags/content_protection_flags.aconfig
@@ -20,3 +20,10 @@
     description: "If true, content protection setting ui is displayed in Settings > Privacy & Security > More security & privacy."
     bug: "305792348"
 }
+
+flag {
+    name: "create_accessibility_overlay_app_op_enabled"
+    namespace: "content_protection"
+    description: "If true, an appop is logged on creation of accessibility overlays."
+    bug: "289081465"
+}
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 3078801..403b403 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -85,6 +85,7 @@
 import android.util.LongArray;
 import android.util.Pair;
 import android.util.SizeF;
+import android.util.SparseArray;
 import android.util.SparseIntArray;
 import android.util.TypedValue;
 import android.util.TypedValue.ComplexDimensionUnit;
@@ -367,6 +368,11 @@
     @UnsupportedAppUsage
     private BitmapCache mBitmapCache = new BitmapCache();
 
+    /**
+     * Maps Intent ID to RemoteCollectionItems to avoid duplicate items
+     */
+    private RemoteCollectionCache mCollectionCache = new RemoteCollectionCache();
+
     /** Cache of ApplicationInfos used by collection items. */
     private ApplicationInfoCache mApplicationInfoCache = new ApplicationInfoCache();
 
@@ -784,9 +790,12 @@
                 if (action instanceof SetRemoteCollectionItemListAdapterAction itemsAction
                         && itemsAction.mViewId == viewId
                         && itemsAction.mServiceIntent != null) {
-                    mActions.set(i,
-                            new SetRemoteCollectionItemListAdapterAction(itemsAction.mViewId,
-                                    itemsAction.mServiceIntent));
+                    SetRemoteCollectionItemListAdapterAction newCollectionAction =
+                            new SetRemoteCollectionItemListAdapterAction(
+                                    itemsAction.mViewId, itemsAction.mServiceIntent);
+                    newCollectionAction.mIntentId = itemsAction.mIntentId;
+                    newCollectionAction.mIsReplacedIntoAction = true;
+                    mActions.set(i, newCollectionAction);
                     isActionReplaced = true;
                 } else if (action instanceof SetRemoteViewsAdapterIntent intentAction
                         && intentAction.mViewId == viewId) {
@@ -1048,6 +1057,8 @@
         @NonNull
         private CompletableFuture<RemoteCollectionItems> mItemsFuture;
         final Intent mServiceIntent;
+        int mIntentId = -1;
+        boolean mIsReplacedIntoAction = false;
 
         SetRemoteCollectionItemListAdapterAction(@IdRes int id,
                 @NonNull RemoteCollectionItems items) {
@@ -1108,38 +1119,36 @@
 
         SetRemoteCollectionItemListAdapterAction(Parcel parcel) {
             mViewId = parcel.readInt();
-            mItemsFuture = CompletableFuture.completedFuture(
-                    new RemoteCollectionItems(parcel, getHierarchyRootData()));
+            mIntentId = parcel.readInt();
+            mItemsFuture = CompletableFuture.completedFuture(mIntentId != -1
+                    ? null
+                    : new RemoteCollectionItems(parcel, getHierarchyRootData()));
             mServiceIntent = parcel.readTypedObject(Intent.CREATOR);
         }
 
         @Override
         public void setHierarchyRootData(HierarchyRootData rootData) {
-            mItemsFuture = mItemsFuture
-                    .thenApply(rc -> {
-                        rc.setHierarchyRootData(rootData);
-                        return rc;
-                    });
-        }
-
-        private static RemoteCollectionItems getCollectionItemsFromFuture(
-                CompletableFuture<RemoteCollectionItems> itemsFuture) {
-            RemoteCollectionItems items;
-            try {
-                items = itemsFuture.get();
-            } catch (Exception e) {
-                Log.e(LOG_TAG, "Error getting collection items from future", e);
-                items = new RemoteCollectionItems.Builder().build();
+            if (mIntentId == -1) {
+                mItemsFuture = mItemsFuture
+                        .thenApply(rc -> {
+                            rc.setHierarchyRootData(rootData);
+                            return rc;
+                        });
+                return;
             }
 
-            return items;
+            // Set the root data for items in the cache instead
+            mCollectionCache.setHierarchyDataForId(mIntentId, rootData);
         }
 
         @Override
         public void writeToParcel(Parcel dest, int flags) {
             dest.writeInt(mViewId);
-            RemoteCollectionItems items = getCollectionItemsFromFuture(mItemsFuture);
-            items.writeToParcel(dest, flags, /* attached= */ true);
+            dest.writeInt(mIntentId);
+            if (mIntentId == -1) {
+                RemoteCollectionItems items = getCollectionItemsFromFuture(mItemsFuture);
+                items.writeToParcel(dest, flags, /* attached= */ true);
+            }
             dest.writeTypedObject(mServiceIntent, flags);
         }
 
@@ -1149,7 +1158,9 @@
             View target = root.findViewById(mViewId);
             if (target == null) return;
 
-            RemoteCollectionItems items = getCollectionItemsFromFuture(mItemsFuture);
+            RemoteCollectionItems items = mIntentId == -1
+                    ? getCollectionItemsFromFuture(mItemsFuture)
+                    : mCollectionCache.getItemsForId(mIntentId);
 
             // Ensure that we are applying to an AppWidget root
             if (!(rootParent instanceof AppWidgetHostView)) {
@@ -1210,6 +1221,153 @@
         }
     }
 
+    private static RemoteCollectionItems getCollectionItemsFromFuture(
+            CompletableFuture<RemoteCollectionItems> itemsFuture) {
+        RemoteCollectionItems items;
+        try {
+            items = itemsFuture.get();
+        } catch (Exception e) {
+            Log.e(LOG_TAG, "Error getting collection items from future", e);
+            items = new RemoteCollectionItems.Builder().build();
+        }
+
+        return items;
+    }
+
+    /**
+     * @hide
+     */
+    public void collectAllIntents() {
+        mCollectionCache.collectAllIntentsNoComplete(this);
+    }
+
+    private class RemoteCollectionCache {
+        private SparseArray<String> mIdToUriMapping = new SparseArray<>();
+        private HashMap<String, RemoteCollectionItems> mUriToCollectionMapping = new HashMap<>();
+
+        // We don't put this into the parcel
+        private HashMap<String, CompletableFuture<RemoteCollectionItems>> mTempUriToFutureMapping =
+                new HashMap<>();
+
+        RemoteCollectionCache() { }
+
+        RemoteCollectionCache(RemoteCollectionCache src) {
+            boolean isWaitingCache = src.mTempUriToFutureMapping.size() != 0;
+            for (int i = 0; i < src.mIdToUriMapping.size(); i++) {
+                String uri = src.mIdToUriMapping.valueAt(i);
+                mIdToUriMapping.put(src.mIdToUriMapping.keyAt(i), uri);
+                if (isWaitingCache) {
+                    mTempUriToFutureMapping.put(uri, src.mTempUriToFutureMapping.get(uri));
+                } else {
+                    mUriToCollectionMapping.put(uri, src.mUriToCollectionMapping.get(uri));
+                }
+            }
+        }
+
+        RemoteCollectionCache(Parcel in) {
+            int cacheSize = in.readInt();
+            HierarchyRootData currentRootData = new HierarchyRootData(mBitmapCache,
+                    this,
+                    mApplicationInfoCache,
+                    mClassCookies);
+            for (int i = 0; i < cacheSize; i++) {
+                int intentId = in.readInt();
+                String intentUri = in.readString8();
+                RemoteCollectionItems items = new RemoteCollectionItems(in, currentRootData);
+                mIdToUriMapping.put(intentId, intentUri);
+                mUriToCollectionMapping.put(intentUri, items);
+            }
+        }
+
+        void setHierarchyDataForId(int intentId, HierarchyRootData data) {
+            String uri = mIdToUriMapping.get(intentId);
+            if (mTempUriToFutureMapping.get(uri) != null) {
+                CompletableFuture<RemoteCollectionItems> itemsFuture =
+                        mTempUriToFutureMapping.get(uri);
+                mTempUriToFutureMapping.put(uri, itemsFuture.thenApply(rc -> {
+                    rc.setHierarchyRootData(data);
+                    return rc;
+                }));
+
+                return;
+            }
+
+            RemoteCollectionItems items = mUriToCollectionMapping.get(uri);
+            items.setHierarchyRootData(data);
+        }
+
+        RemoteCollectionItems getItemsForId(int intentId) {
+            String uri = mIdToUriMapping.get(intentId);
+            return mUriToCollectionMapping.get(uri);
+        }
+
+        void collectAllIntentsNoComplete(@NonNull RemoteViews inViews) {
+            if (inViews.hasSizedRemoteViews()) {
+                for (RemoteViews remoteViews : inViews.mSizedRemoteViews) {
+                    remoteViews.collectAllIntents();
+                }
+            } else if (inViews.hasLandscapeAndPortraitLayouts()) {
+                inViews.mLandscape.collectAllIntents();
+                inViews.mPortrait.collectAllIntents();
+            } else if (inViews.mActions != null) {
+                for (Action action : inViews.mActions) {
+                    if (action instanceof SetRemoteCollectionItemListAdapterAction rca) {
+                        // Deal with the case where the intent is replaced into the action list
+                        if (rca.mIntentId != -1 && !rca.mIsReplacedIntoAction) {
+                            continue;
+                        }
+
+                        if (rca.mIntentId != -1 && rca.mIsReplacedIntoAction) {
+                            String uri = mIdToUriMapping.get(rca.mIntentId);
+                            mTempUriToFutureMapping.put(uri, rca.mItemsFuture);
+                            rca.mItemsFuture = CompletableFuture.completedFuture(null);
+                            continue;
+                        }
+
+                        // Differentiate between the normal collection actions and the ones with
+                        // intents.
+                        if (rca.mServiceIntent != null) {
+                            String uri = rca.mServiceIntent.toUri(0);
+                            int index = mIdToUriMapping.indexOfValue(uri);
+                            if (index == -1) {
+                                int newIntentId = mIdToUriMapping.size();
+                                rca.mIntentId = newIntentId;
+                                mIdToUriMapping.put(newIntentId, uri);
+                                // mUriToIntentMapping.put(uri, mServiceIntent);
+                                mTempUriToFutureMapping.put(uri, rca.mItemsFuture);
+                            } else {
+                                rca.mIntentId = mIdToUriMapping.keyAt(index);
+                            }
+                            rca.mItemsFuture = CompletableFuture.completedFuture(null);
+                        } else {
+                            RemoteCollectionItems items = getCollectionItemsFromFuture(
+                                    rca.mItemsFuture);
+                            for (RemoteViews views : items.mViews) {
+                                views.collectAllIntents();
+                            }
+                        }
+                    } else if (action instanceof ViewGroupActionAdd vgaa
+                            && vgaa.mNestedViews != null) {
+                        vgaa.mNestedViews.collectAllIntents();
+                    }
+                }
+            }
+        }
+
+        public void writeToParcel(Parcel out, int flags) {
+            out.writeInt(mIdToUriMapping.size());
+            for (int i = 0; i < mIdToUriMapping.size(); i++) {
+                out.writeInt(mIdToUriMapping.keyAt(i));
+                String intentUri = mIdToUriMapping.valueAt(i);
+                out.writeString8(intentUri);
+                RemoteCollectionItems items = mTempUriToFutureMapping.get(intentUri) != null
+                        ? getCollectionItemsFromFuture(mTempUriToFutureMapping.get(intentUri))
+                        : mUriToCollectionMapping.get(intentUri);
+                items.writeToParcel(out, flags, true);
+            }
+        }
+    }
+
     private class SetRemoteViewsAdapterIntent extends Action {
         Intent mIntent;
         boolean mIsAsync = false;
@@ -3850,9 +4008,12 @@
     private void initializeFrom(@NonNull RemoteViews src, @Nullable RemoteViews hierarchyRoot) {
         if (hierarchyRoot == null) {
             mBitmapCache = src.mBitmapCache;
+            // We need to create a new instance because we don't reconstruct collection cache
+            mCollectionCache = new RemoteCollectionCache(src.mCollectionCache);
             mApplicationInfoCache = src.mApplicationInfoCache;
         } else {
             mBitmapCache = hierarchyRoot.mBitmapCache;
+            mCollectionCache = hierarchyRoot.mCollectionCache;
             mApplicationInfoCache = hierarchyRoot.mApplicationInfoCache;
         }
         if (hierarchyRoot == null || src.mIsRoot) {
@@ -3926,6 +4087,7 @@
             mBitmapCache = new BitmapCache(parcel);
             // Store the class cookies such that they are available when we clone this RemoteView.
             mClassCookies = parcel.copyClassCookies();
+            mCollectionCache = new RemoteCollectionCache(parcel);
         } else {
             configureAsChild(rootData);
         }
@@ -4087,6 +4249,7 @@
     private void configureAsChild(@NonNull HierarchyRootData rootData) {
         mIsRoot = false;
         mBitmapCache = rootData.mBitmapCache;
+        mCollectionCache = rootData.mRemoteCollectionCache;
         mApplicationInfoCache = rootData.mApplicationInfoCache;
         mClassCookies = rootData.mClassCookies;
         configureDescendantsAsChildren();
@@ -6357,6 +6520,7 @@
             // is shared by all children.
             if (mIsRoot) {
                 mBitmapCache.writeBitmapsToParcel(dest, flags);
+                mCollectionCache.writeToParcel(dest, flags);
             }
             mApplication.writeToParcel(dest, flags);
             if (mIsRoot || mIdealSize == null) {
@@ -6373,6 +6537,7 @@
             dest.writeInt(MODE_HAS_SIZED_REMOTEVIEWS);
             if (mIsRoot) {
                 mBitmapCache.writeBitmapsToParcel(dest, flags);
+                mCollectionCache.writeToParcel(dest, flags);
             }
             dest.writeInt(mSizedRemoteViews.size());
             for (RemoteViews view : mSizedRemoteViews) {
@@ -6384,6 +6549,7 @@
             // is shared by all children.
             if (mIsRoot) {
                 mBitmapCache.writeBitmapsToParcel(dest, flags);
+                mCollectionCache.writeToParcel(dest, flags);
             }
             mLandscape.writeToParcel(dest, flags);
             // Both RemoteViews already share the same package and user
@@ -7262,19 +7428,23 @@
     }
 
     private HierarchyRootData getHierarchyRootData() {
-        return new HierarchyRootData(mBitmapCache, mApplicationInfoCache, mClassCookies);
+        return new HierarchyRootData(mBitmapCache, mCollectionCache,
+                mApplicationInfoCache, mClassCookies);
     }
 
     private static final class HierarchyRootData {
         final BitmapCache mBitmapCache;
+        final RemoteCollectionCache mRemoteCollectionCache;
         final ApplicationInfoCache mApplicationInfoCache;
         final Map<Class, Object> mClassCookies;
 
         HierarchyRootData(
                 BitmapCache bitmapCache,
+                RemoteCollectionCache remoteCollectionCache,
                 ApplicationInfoCache applicationInfoCache,
                 Map<Class, Object> classCookies) {
             mBitmapCache = bitmapCache;
+            mRemoteCollectionCache = remoteCollectionCache;
             mApplicationInfoCache = applicationInfoCache;
             mClassCookies = classCookies;
         }
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 17cc9f8..f78811f 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -60,7 +60,6 @@
             // except for SystemUI-core.
             // Copied from compose/features/Android.bp.
             static_libs: [
-                "CommunalLayoutLib",
                 "PlatformComposeCore",
                 "PlatformComposeSceneTransitionLayout",
 
diff --git a/packages/SystemUI/aconfig/accessibility.aconfig b/packages/SystemUI/aconfig/accessibility.aconfig
index 9e06872..21263a9 100644
--- a/packages/SystemUI/aconfig/accessibility.aconfig
+++ b/packages/SystemUI/aconfig/accessibility.aconfig
@@ -6,7 +6,7 @@
     name: "floating_menu_animated_tuck"
     namespace: "accessibility"
     description: "Sets up animations for tucking/untucking and adjusts clipbounds."
-    bug: "24592044"
+    bug: "297556899"
 }
 
 flag {
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index c26d5f5..8eff9bf 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -51,3 +51,11 @@
     description: "Enables the scene container framework go/flexiglass."
     bug: "283121968"
 }
+
+flag {
+    name: "visual_interruptions_refactor"
+    namespace: "systemui"
+    description: "Enables the refactored version of the code to decide when notifications "
+        "HUN, bubble, pulse, or FSI."
+    bug: "261728888"
+}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
index b8fb264..87a8c35 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
@@ -4,8 +4,14 @@
 import android.os.Bundle
 import android.util.SizeF
 import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.lazy.grid.GridCells
+import androidx.compose.foundation.lazy.grid.GridItemSpan
+import androidx.compose.foundation.lazy.grid.LazyHorizontalGrid
 import androidx.compose.material3.Card
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.collectAsState
@@ -13,16 +19,12 @@
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.dimensionResource
-import androidx.compose.ui.res.integerResource
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
 import androidx.compose.ui.viewinterop.AndroidView
-import com.android.systemui.communal.layout.ui.compose.CommunalGridLayout
-import com.android.systemui.communal.layout.ui.compose.config.CommunalGridLayoutCard
-import com.android.systemui.communal.layout.ui.compose.config.CommunalGridLayoutConfig
 import com.android.systemui.communal.shared.model.CommunalContentSize
 import com.android.systemui.communal.ui.model.CommunalContentUiModel
 import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
-import com.android.systemui.res.R
 
 @Composable
 fun CommunalHub(
@@ -34,68 +36,91 @@
     Box(
         modifier = modifier.fillMaxSize().background(Color.White),
     ) {
-        CommunalGridLayout(
-            modifier = Modifier.align(Alignment.CenterStart),
-            layoutConfig =
-                CommunalGridLayoutConfig(
-                    gridColumnSize = dimensionResource(R.dimen.communal_grid_column_size),
-                    gridGutter = dimensionResource(R.dimen.communal_grid_gutter_size),
-                    gridHeight = dimensionResource(R.dimen.communal_grid_height),
-                    gridColumnsPerCard = integerResource(R.integer.communal_grid_columns_per_card),
-                ),
-            communalCards = if (showTutorial) tutorialContent else widgetContent.map(::contentCard),
-        )
+        LazyHorizontalGrid(
+            modifier = modifier.height(Dimensions.GridHeight).align(Alignment.CenterStart),
+            rows = GridCells.Fixed(CommunalContentSize.FULL.span),
+            horizontalArrangement = Arrangement.spacedBy(Dimensions.Spacing),
+            verticalArrangement = Arrangement.spacedBy(Dimensions.Spacing),
+        ) {
+            if (showTutorial) {
+                items(
+                    count = tutorialContentSizes.size,
+                    // TODO(b/308148193): a more scalable solution for unique ids.
+                    key = { index -> "tutorial_$index" },
+                    span = { index -> GridItemSpan(tutorialContentSizes[index].span) },
+                ) { index ->
+                    TutorialCard(
+                        modifier =
+                            Modifier.size(Dimensions.CardWidth, tutorialContentSizes[index].dp()),
+                    )
+                }
+            } else {
+                items(
+                    count = widgetContent.size,
+                    key = { index -> widgetContent[index].id },
+                    span = { index -> GridItemSpan(widgetContent[index].size.span) },
+                ) { index ->
+                    val widget = widgetContent[index]
+                    ContentCard(
+                        modifier = Modifier.size(Dimensions.CardWidth, widget.size.dp()),
+                        model = widget,
+                    )
+                }
+            }
+        }
     }
 }
 
-private val tutorialContent =
+// A placeholder for tutorial content.
+@Composable
+private fun TutorialCard(modifier: Modifier = Modifier) {
+    Card(modifier = modifier, content = {})
+}
+
+@Composable
+private fun ContentCard(
+    model: CommunalContentUiModel,
+    modifier: Modifier = Modifier,
+) {
+    AndroidView(
+        modifier = modifier,
+        factory = {
+            model.view.apply {
+                if (this is AppWidgetHostView) {
+                    val size = SizeF(Dimensions.CardWidth.value, model.size.dp().value)
+                    updateAppWidgetSize(Bundle.EMPTY, listOf(size))
+                }
+            }
+        },
+    )
+}
+
+private fun CommunalContentSize.dp(): Dp {
+    return when (this) {
+        CommunalContentSize.FULL -> Dimensions.CardHeightFull
+        CommunalContentSize.HALF -> Dimensions.CardHeightHalf
+        CommunalContentSize.THIRD -> Dimensions.CardHeightThird
+    }
+}
+
+// Sizes for the tutorial placeholders.
+private val tutorialContentSizes =
     listOf(
-        tutorialCard(CommunalGridLayoutCard.Size.FULL),
-        tutorialCard(CommunalGridLayoutCard.Size.THIRD),
-        tutorialCard(CommunalGridLayoutCard.Size.THIRD),
-        tutorialCard(CommunalGridLayoutCard.Size.THIRD),
-        tutorialCard(CommunalGridLayoutCard.Size.HALF),
-        tutorialCard(CommunalGridLayoutCard.Size.HALF),
-        tutorialCard(CommunalGridLayoutCard.Size.HALF),
-        tutorialCard(CommunalGridLayoutCard.Size.HALF),
+        CommunalContentSize.FULL,
+        CommunalContentSize.THIRD,
+        CommunalContentSize.THIRD,
+        CommunalContentSize.THIRD,
+        CommunalContentSize.HALF,
+        CommunalContentSize.HALF,
+        CommunalContentSize.HALF,
+        CommunalContentSize.HALF,
     )
 
-private fun tutorialCard(size: CommunalGridLayoutCard.Size): CommunalGridLayoutCard {
-    return object : CommunalGridLayoutCard() {
-        override val supportedSizes = listOf(size)
-
-        @Composable
-        override fun Content(modifier: Modifier, size: SizeF) {
-            Card(modifier = modifier, content = {})
-        }
-    }
-}
-
-private fun contentCard(model: CommunalContentUiModel): CommunalGridLayoutCard {
-    return object : CommunalGridLayoutCard() {
-        override val supportedSizes = listOf(convertToCardSize(model.size))
-        override val priority = model.priority
-
-        @Composable
-        override fun Content(modifier: Modifier, size: SizeF) {
-            AndroidView(
-                modifier = modifier,
-                factory = {
-                    model.view.apply {
-                        if (this is AppWidgetHostView) {
-                            updateAppWidgetSize(Bundle(), listOf(size))
-                        }
-                    }
-                },
-            )
-        }
-    }
-}
-
-private fun convertToCardSize(size: CommunalContentSize): CommunalGridLayoutCard.Size {
-    return when (size) {
-        CommunalContentSize.FULL -> CommunalGridLayoutCard.Size.FULL
-        CommunalContentSize.HALF -> CommunalGridLayoutCard.Size.HALF
-        CommunalContentSize.THIRD -> CommunalGridLayoutCard.Size.THIRD
-    }
+private object Dimensions {
+    val CardWidth = 464.dp
+    val CardHeightFull = 630.dp
+    val CardHeightHalf = 307.dp
+    val CardHeightThird = 199.dp
+    val GridHeight = CardHeightFull
+    val Spacing = 16.dp
 }
diff --git a/packages/SystemUI/res/layout/volume_dnd_icon.xml b/packages/SystemUI/res/layout/volume_dnd_icon.xml
deleted file mode 100644
index 56587b9..0000000
--- a/packages/SystemUI/res/layout/volume_dnd_icon.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-     Copyright (C) 2018 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<FrameLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/dnd_icon"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_gravity="bottom"
-    android:layout_marginTop="6dp"
-    android:layout_marginBottom="6dp">
-
-    <ImageView
-        android:layout_width="14dp"
-        android:layout_height="14dp"
-        android:layout_gravity="center"
-        android:src="@*android:drawable/ic_qs_dnd"
-        android:tint="?android:attr/textColorTertiary"/>
-</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index 85122ba..e69eced 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -18,6 +18,7 @@
 
 import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+
 import static com.android.internal.jank.InteractionJankMonitor.CUJ_BIOMETRIC_PROMPT_TRANSITION;
 
 import android.animation.Animator;
@@ -63,7 +64,6 @@
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.jank.InteractionJankMonitor;
 import com.android.internal.widget.LockPatternUtils;
-import com.android.systemui.res.R;
 import com.android.systemui.biometrics.AuthController.ScaleFactorProvider;
 import com.android.systemui.biometrics.domain.interactor.PromptCredentialInteractor;
 import com.android.systemui.biometrics.domain.interactor.PromptSelectorInteractor;
@@ -76,8 +76,8 @@
 import com.android.systemui.biometrics.ui.viewmodel.CredentialViewModel;
 import com.android.systemui.biometrics.ui.viewmodel.PromptViewModel;
 import com.android.systemui.dagger.qualifiers.Background;
-import com.android.systemui.flags.FeatureFlags;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
+import com.android.systemui.res.R;
 import com.android.systemui.statusbar.VibratorHelper;
 import com.android.systemui.util.concurrency.DelayableExecutor;
 
@@ -280,7 +280,6 @@
 
     // TODO(b/251476085): remove Config and further decompose these properties out of view classes
     AuthContainerView(@NonNull Config config,
-            @NonNull FeatureFlags featureFlags,
             @NonNull CoroutineScope applicationCoroutineScope,
             @Nullable List<FingerprintSensorPropertiesInternal> fpProps,
             @Nullable List<FaceSensorPropertiesInternal> faceProps,
@@ -295,7 +294,7 @@
             @NonNull Provider<CredentialViewModel> credentialViewModelProvider,
             @NonNull @Background DelayableExecutor bgExecutor,
             @NonNull VibratorHelper vibratorHelper) {
-        this(config, featureFlags, applicationCoroutineScope, fpProps, faceProps,
+        this(config, applicationCoroutineScope, fpProps, faceProps,
                 wakefulnessLifecycle, panelInteractionDetector, userManager, lockPatternUtils,
                 jankMonitor, promptSelectorInteractor, promptCredentialInteractor, promptViewModel,
                 credentialViewModelProvider, new Handler(Looper.getMainLooper()), bgExecutor,
@@ -304,7 +303,6 @@
 
     @VisibleForTesting
     AuthContainerView(@NonNull Config config,
-            @NonNull FeatureFlags featureFlags,
             @NonNull CoroutineScope applicationCoroutineScope,
             @Nullable List<FingerprintSensorPropertiesInternal> fpProps,
             @Nullable List<FaceSensorPropertiesInternal> faceProps,
@@ -368,7 +366,7 @@
         showPrompt(config, layoutInflater, promptViewModel,
                 Utils.findFirstSensorProperties(fpProps, mConfig.mSensorIds),
                 Utils.findFirstSensorProperties(faceProps, mConfig.mSensorIds),
-                vibratorHelper, featureFlags);
+                vibratorHelper);
 
         // TODO: De-dupe the logic with AuthCredentialPasswordView
         setOnKeyListener((v, keyCode, event) -> {
@@ -390,8 +388,7 @@
             @NonNull PromptViewModel viewModel,
             @Nullable FingerprintSensorPropertiesInternal fpProps,
             @Nullable FaceSensorPropertiesInternal faceProps,
-            @NonNull VibratorHelper vibratorHelper,
-            @NonNull FeatureFlags featureFlags
+            @NonNull VibratorHelper vibratorHelper
     ) {
         if (Utils.isBiometricAllowed(config.mPromptInfo)) {
             mPromptSelectorInteractorProvider.get().useBiometricsForAuthentication(
@@ -407,7 +404,7 @@
                     getJankListener(view, TRANSIT,
                             BiometricViewSizeBinder.ANIMATE_MEDIUM_TO_LARGE_DURATION_MS),
                     mBackgroundView, mBiometricCallback, mApplicationCoroutineScope,
-                    vibratorHelper, featureFlags);
+                    vibratorHelper);
 
             // TODO(b/251476085): migrate these dependencies
             if (fpProps != null && fpProps.isAnyUdfpsType()) {
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index a64e862..05db56f 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -78,7 +78,6 @@
 import com.android.systemui.dagger.qualifiers.Background;
 import com.android.systemui.dagger.qualifiers.Main;
 import com.android.systemui.doze.DozeReceiver;
-import com.android.systemui.flags.FeatureFlags;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
 import com.android.systemui.keyguard.data.repository.BiometricType;
 import com.android.systemui.statusbar.CommandQueue;
@@ -120,7 +119,6 @@
 
     private final Handler mHandler;
     private final Context mContext;
-    private final FeatureFlags mFeatureFlags;
     private final Execution mExecution;
     private final CommandQueue mCommandQueue;
     private final ActivityTaskManager mActivityTaskManager;
@@ -743,7 +741,6 @@
     }
     @Inject
     public AuthController(Context context,
-            @NonNull FeatureFlags featureFlags,
             @Application CoroutineScope applicationCoroutineScope,
             Execution execution,
             CommandQueue commandQueue,
@@ -770,7 +767,6 @@
             @NonNull UdfpsUtils udfpsUtils,
             @NonNull VibratorHelper vibratorHelper) {
         mContext = context;
-        mFeatureFlags = featureFlags;
         mExecution = execution;
         mUserManager = userManager;
         mLockPatternUtils = lockPatternUtils;
@@ -1316,7 +1312,7 @@
         config.mRequestId = requestId;
         config.mSensorIds = sensorIds;
         config.mScaleProvider = this::getScaleFactor;
-        return new AuthContainerView(config, mFeatureFlags, mApplicationCoroutineScope, mFpProps, mFaceProps,
+        return new AuthContainerView(config, mApplicationCoroutineScope, mFpProps, mFaceProps,
                 wakefulnessLifecycle, panelInteractionDetector, userManager, lockPatternUtils,
                 mInteractionJankMonitor, mPromptCredentialInteractor, mPromptSelectorInteractor,
                 viewModel, mCredentialViewModelProvider, bgExecutor, mVibratorHelper);
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
index ac48b6a..32d9067 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/BiometricViewBinder.kt
@@ -49,8 +49,6 @@
 import com.android.systemui.biometrics.ui.viewmodel.PromptMessage
 import com.android.systemui.biometrics.ui.viewmodel.PromptSize
 import com.android.systemui.biometrics.ui.viewmodel.PromptViewModel
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION
 import com.android.systemui.lifecycle.repeatWhenAttached
 import com.android.systemui.res.R
 import com.android.systemui.statusbar.VibratorHelper
@@ -78,7 +76,6 @@
         legacyCallback: Spaghetti.Callback,
         applicationScope: CoroutineScope,
         vibratorHelper: VibratorHelper,
-        featureFlags: FeatureFlags,
     ): Spaghetti {
         val accessibilityManager = view.context.getSystemService(AccessibilityManager::class.java)!!
 
@@ -380,13 +377,11 @@
                 }
 
                 // Play haptics
-                if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) {
-                    launch {
-                        viewModel.hapticsToPlay.collect { hapticFeedbackConstant ->
-                            if (hapticFeedbackConstant != HapticFeedbackConstants.NO_HAPTICS) {
-                                vibratorHelper.performHapticFeedback(view, hapticFeedbackConstant)
-                                viewModel.clearHaptics()
-                            }
+                launch {
+                    viewModel.hapticsToPlay.collect { hapticFeedbackConstant ->
+                        if (hapticFeedbackConstant != HapticFeedbackConstants.NO_HAPTICS) {
+                            vibratorHelper.performHapticFeedback(view, hapticFeedbackConstant)
+                            viewModel.clearHaptics()
                         }
                     }
                 }
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
index e49b4a7..647aaf3 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt
@@ -29,10 +29,7 @@
 import com.android.systemui.biometrics.shared.model.DisplayRotation
 import com.android.systemui.biometrics.shared.model.PromptKind
 import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION
 import com.android.systemui.res.R
-import com.android.systemui.statusbar.VibratorHelper
 import javax.inject.Inject
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.coroutineScope
@@ -52,9 +49,7 @@
 constructor(
     displayStateInteractor: DisplayStateInteractor,
     promptSelectorInteractor: PromptSelectorInteractor,
-    private val vibrator: VibratorHelper,
     @Application context: Context,
-    private val featureFlags: FeatureFlags,
 ) {
     /** The set of modalities available for this prompt */
     val modalities: Flow<BiometricModalities> =
@@ -339,7 +334,7 @@
         _message.value = PromptMessage.Error(message)
 
         if (hapticFeedback) {
-            vibrator.error(failedModality)
+            vibrateOnError()
         }
 
         messageJob?.cancel()
@@ -457,7 +452,7 @@
         _message.value = PromptMessage.Empty
 
         if (!needsUserConfirmation) {
-            vibrator.success(modality)
+            vibrateOnSuccess()
         }
 
         messageJob?.cancel()
@@ -495,7 +490,7 @@
         _isAuthenticated.value = authState.asExplicitlyConfirmed()
         _message.value = PromptMessage.Empty
 
-        vibrator.success(authState.authenticatedModality)
+        vibrateOnSuccess()
 
         messageJob?.cancel()
         messageJob = null
@@ -530,20 +525,12 @@
         _forceLargeSize.value = true
     }
 
-    private fun VibratorHelper.success(modality: BiometricModality) {
-        if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) {
-            _hapticsToPlay.value = HapticFeedbackConstants.CONFIRM
-        } else {
-            vibrateAuthSuccess("$TAG, modality = $modality BP::success")
-        }
+    private fun vibrateOnSuccess() {
+        _hapticsToPlay.value = HapticFeedbackConstants.CONFIRM
     }
 
-    private fun VibratorHelper.error(modality: BiometricModality = BiometricModality.None) {
-        if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) {
-            _hapticsToPlay.value = HapticFeedbackConstants.REJECT
-        } else {
-            vibrateAuthError("$TAG, modality = $modality BP::error")
-        }
+    private fun vibrateOnError() {
+        _hapticsToPlay.value = HapticFeedbackConstants.REJECT
     }
 
     /** Clears the [hapticsToPlay] variable by setting it to the NO_HAPTICS default. */
diff --git a/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalContentSize.kt b/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalContentSize.kt
index 39a6476..c903709 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalContentSize.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalContentSize.kt
@@ -16,14 +16,19 @@
 
 package com.android.systemui.communal.shared.model
 
-/** Supported sizes for communal content in the layout grid. */
-enum class CommunalContentSize {
+/**
+ * Supported sizes for communal content in the layout grid.
+ *
+ * @param span The span of the content in a column. For example, if FULL is 6, then 3 represents
+ *   HALF, 2 represents THIRD, and 1 represents SIXTH.
+ */
+enum class CommunalContentSize(val span: Int) {
     /** Content takes the full height of the column. */
-    FULL,
+    FULL(6),
 
     /** Content takes half of the height of the column. */
-    HALF,
+    HALF(3),
 
     /** Content takes a third of the height of the column. */
-    THIRD,
+    THIRD(2),
 }
diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/model/CommunalContentUiModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/model/CommunalContentUiModel.kt
index 98060dc..b60dc2a 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/ui/model/CommunalContentUiModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/ui/model/CommunalContentUiModel.kt
@@ -9,7 +9,7 @@
  * This model stays in the UI layer.
  */
 data class CommunalContentUiModel(
+    val id: String,
     val view: View,
-    val size: CommunalContentSize,
-    val priority: Int,
+    val size: CommunalContentSize = CommunalContentSize.HALF,
 )
diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
index 25c64ea..390b580 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
@@ -20,7 +20,6 @@
 import android.content.Context
 import com.android.systemui.communal.domain.interactor.CommunalInteractor
 import com.android.systemui.communal.domain.interactor.CommunalTutorialInteractor
-import com.android.systemui.communal.shared.model.CommunalContentSize
 import com.android.systemui.communal.ui.model.CommunalContentUiModel
 import com.android.systemui.dagger.SysUISingleton
 import com.android.systemui.dagger.qualifiers.Application
@@ -42,16 +41,16 @@
 
     /** List of widgets to be displayed in the communal hub. */
     val widgetContent: Flow<List<CommunalContentUiModel>> =
-        communalInteractor.widgetContent.map {
-            it.map {
+        communalInteractor.widgetContent.map { widgets ->
+            widgets.map Widget@{ widget ->
                 // TODO(b/306406256): As adding and removing widgets functionalities are
                 // supported, cache the host views so they're not recreated each time.
-                val hostView = appWidgetHost.createView(context, it.appWidgetId, it.providerInfo)
-                return@map CommunalContentUiModel(
+                val hostView =
+                    appWidgetHost.createView(context, widget.appWidgetId, widget.providerInfo)
+                return@Widget CommunalContentUiModel(
+                    // TODO(b/308148193): a more scalable solution for unique ids.
+                    id = "widget_${widget.appWidgetId}",
                     view = hostView,
-                    priority = it.priority,
-                    // All widgets have HALF size.
-                    size = CommunalContentSize.HALF,
                 )
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
index 1dd4abf..236c5b8 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
@@ -48,7 +48,6 @@
 import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
 import com.android.systemui.statusbar.NotificationShadeWindowController;
 import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule;
-import com.android.systemui.statusbar.events.StatusBarEventsModule;
 import com.android.systemui.statusbar.phone.DozeServiceHost;
 import com.android.systemui.statusbar.phone.HeadsUpModule;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
@@ -99,7 +98,6 @@
         ReferenceScreenshotModule.class,
         RotationLockModule.class,
         SceneContainerFrameworkModule.class,
-        StatusBarEventsModule.class,
         StartCentralSurfacesModule.class,
         VolumeModule.class,
         WallpaperModule.class,
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index a41bb2f..7915088 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -96,6 +96,7 @@
 import com.android.systemui.statusbar.connectivity.ConnectivityModule;
 import com.android.systemui.statusbar.dagger.StatusBarModule;
 import com.android.systemui.statusbar.disableflags.dagger.DisableFlagsModule;
+import com.android.systemui.statusbar.events.StatusBarEventsModule;
 import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
 import com.android.systemui.statusbar.notification.NotifPipelineFlags;
 import com.android.systemui.statusbar.notification.collection.NotifPipeline;
@@ -209,6 +210,7 @@
         SettingsUtilModule.class,
         SmartRepliesInflationModule.class,
         SmartspaceModule.class,
+        StatusBarEventsModule.class,
         StatusBarModule.class,
         StatusBarPipelineModule.class,
         StatusBarPolicyModule.class,
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index 0c364e1..fa98661 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -409,9 +409,6 @@
     val FILTER_PROVISIONING_NETWORK_SUBSCRIPTIONS =
         releasedFlag("filter_provisioning_network_subscriptions")
 
-    // TODO(b/265892345): Tracking Bug
-    val PLUG_IN_STATUS_BAR_CHIP = releasedFlag("plug_in_status_bar_chip")
-
     // TODO(b/292533677): Tracking Bug
     val WIFI_TRACKER_LIB_FOR_WIFI_ICON = releasedFlag("wifi_tracker_lib_for_wifi_icon")
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/StatusBarEventsModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/StatusBarEventsModule.kt
index 84796f9..ed96482 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/StatusBarEventsModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/StatusBarEventsModule.kt
@@ -17,19 +17,11 @@
 package com.android.systemui.statusbar.events
 
 import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.dagger.qualifiers.Main
-import com.android.systemui.dump.DumpManager
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags
 import com.android.systemui.log.LogBuffer
 import com.android.systemui.log.LogBufferFactory
-import com.android.systemui.statusbar.window.StatusBarWindowController
-import com.android.systemui.util.concurrency.DelayableExecutor
-import com.android.systemui.util.time.SystemClock
+import dagger.Binds
 import dagger.Module
 import dagger.Provides
-import kotlinx.coroutines.CoroutineScope
 
 @Module
 interface StatusBarEventsModule {
@@ -42,41 +34,11 @@
         fun provideSystemStatusAnimationSchedulerLogBuffer(factory: LogBufferFactory): LogBuffer {
             return factory.create("SystemStatusAnimationSchedulerLog", 60)
         }
-
-        @Provides
-        @SysUISingleton
-        fun provideSystemStatusAnimationScheduler(
-                featureFlags: FeatureFlags,
-                coordinator: SystemEventCoordinator,
-                chipAnimationController: SystemEventChipAnimationController,
-                statusBarWindowController: StatusBarWindowController,
-                dumpManager: DumpManager,
-                systemClock: SystemClock,
-                @Application coroutineScope: CoroutineScope,
-                @Main executor: DelayableExecutor,
-                logger: SystemStatusAnimationSchedulerLogger
-        ): SystemStatusAnimationScheduler {
-            return if (featureFlags.isEnabled(Flags.PLUG_IN_STATUS_BAR_CHIP)) {
-                SystemStatusAnimationSchedulerImpl(
-                        coordinator,
-                        chipAnimationController,
-                        statusBarWindowController,
-                        dumpManager,
-                        systemClock,
-                        coroutineScope,
-                        logger
-                )
-            } else {
-                SystemStatusAnimationSchedulerLegacyImpl(
-                        coordinator,
-                        chipAnimationController,
-                        statusBarWindowController,
-                        dumpManager,
-                        systemClock,
-                        executor
-                )
-            }
-        }
     }
-}
 
+    @Binds
+    @SysUISingleton
+    fun bindSystemStatusAnimationScheduler(
+        systemStatusAnimationSchedulerImpl: SystemStatusAnimationSchedulerImpl
+    ): SystemStatusAnimationScheduler
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
index 73c0bfe..fec1765 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
@@ -32,8 +32,6 @@
 import androidx.core.animation.ValueAnimator
 import com.android.internal.annotations.VisibleForTesting
 import com.android.systemui.res.R
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsChangedListener
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
 import com.android.systemui.statusbar.window.StatusBarWindowController
@@ -47,8 +45,7 @@
 class SystemEventChipAnimationController @Inject constructor(
     private val context: Context,
     private val statusBarWindowController: StatusBarWindowController,
-    private val contentInsetsProvider: StatusBarContentInsetsProvider,
-    private val featureFlags: FeatureFlags,
+    private val contentInsetsProvider: StatusBarContentInsetsProvider
 ) : SystemStatusAnimationCallback {
 
     private lateinit var animationWindowView: FrameLayout
@@ -317,15 +314,8 @@
                 it.marginEnd = marginEnd
             }
 
-    private fun initializeAnimRect() = if (featureFlags.isEnabled(Flags.PLUG_IN_STATUS_BAR_CHIP)) {
-        animRect.set(chipBounds)
-    } else {
-        animRect.set(
-                chipLeft,
-                currentAnimatedView!!.view.top,
-                chipRight,
-                currentAnimatedView!!.view.bottom)
-    }
+    private fun initializeAnimRect() = animRect.set(chipBounds)
+
 
     /**
      * To be called during an animation, sets the width and updates the current animated chip view
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt
index e9d5dec..a73d517 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt
@@ -24,8 +24,7 @@
 import com.android.systemui.dagger.SysUISingleton
 import com.android.systemui.dagger.qualifiers.Application
 import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags
+import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor.State
 import com.android.systemui.privacy.PrivacyChipBuilder
 import com.android.systemui.privacy.PrivacyItem
 import com.android.systemui.privacy.PrivacyItemController
@@ -49,7 +48,6 @@
     private val batteryController: BatteryController,
     private val privacyController: PrivacyItemController,
     private val context: Context,
-    private val featureFlags: FeatureFlags,
     @Application private val appScope: CoroutineScope,
     connectedDisplayInteractor: ConnectedDisplayInteractor
 ) {
@@ -76,9 +74,7 @@
     }
 
     fun notifyPluggedIn(@IntRange(from = 0, to = 100) batteryLevel: Int) {
-        if (featureFlags.isEnabled(Flags.PLUG_IN_STATUS_BAR_CHIP)) {
-            scheduler.onStatusEvent(BatteryEvent(batteryLevel))
-        }
+        scheduler.onStatusEvent(BatteryEvent(batteryLevel))
     }
 
     fun notifyPrivacyItemsEmpty() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerLegacyImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerLegacyImpl.kt
deleted file mode 100644
index 6b5a548..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerLegacyImpl.kt
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.events
-
-import android.os.Process
-import android.provider.DeviceConfig
-import android.util.Log
-import androidx.core.animation.Animator
-import androidx.core.animation.AnimatorListenerAdapter
-import androidx.core.animation.AnimatorSet
-import com.android.systemui.dagger.qualifiers.Main
-import com.android.systemui.dump.DumpManager
-import com.android.systemui.statusbar.window.StatusBarWindowController
-import com.android.systemui.util.Assert
-import com.android.systemui.util.concurrency.DelayableExecutor
-import com.android.systemui.util.time.SystemClock
-import java.io.PrintWriter
-import javax.inject.Inject
-
-/**
- * Dead-simple scheduler for system status events. Obeys the following principles (all values TBD):
- * ```
- *      - Avoiding log spam by only allowing 12 events per minute (1event/5s)
- *      - Waits 100ms to schedule any event for debouncing/prioritization
- *      - Simple prioritization: Privacy > Battery > connectivity (encoded in [StatusEvent])
- *      - Only schedules a single event, and throws away lowest priority events
- * ```
- *
- * There are 4 basic stages of animation at play here:
- * ```
- *      1. System chrome animation OUT
- *      2. Chip animation IN
- *      3. Chip animation OUT; potentially into a dot
- *      4. System chrome animation IN
- * ```
- *
- * Thus we can keep all animations synchronized with two separate ValueAnimators, one for system
- * chrome and the other for the chip. These can animate from 0,1 and listeners can parameterize
- * their respective views based on the progress of the animator. Interpolation differences TBD
- */
-open class SystemStatusAnimationSchedulerLegacyImpl
-@Inject
-constructor(
-    private val coordinator: SystemEventCoordinator,
-    private val chipAnimationController: SystemEventChipAnimationController,
-    private val statusBarWindowController: StatusBarWindowController,
-    private val dumpManager: DumpManager,
-    private val systemClock: SystemClock,
-    @Main private val executor: DelayableExecutor
-) : SystemStatusAnimationScheduler {
-
-    companion object {
-        private const val PROPERTY_ENABLE_IMMERSIVE_INDICATOR = "enable_immersive_indicator"
-    }
-
-    fun isImmersiveIndicatorEnabled(): Boolean {
-        return DeviceConfig.getBoolean(
-            DeviceConfig.NAMESPACE_PRIVACY,
-            PROPERTY_ENABLE_IMMERSIVE_INDICATOR,
-            true
-        )
-    }
-
-    @SystemAnimationState private var animationState: Int = IDLE
-
-    /** True if the persistent privacy dot should be active */
-    var hasPersistentDot = false
-        protected set
-
-    private var scheduledEvent: StatusEvent? = null
-
-    val listeners = mutableSetOf<SystemStatusAnimationCallback>()
-
-    init {
-        coordinator.attachScheduler(this)
-        dumpManager.registerDumpable(TAG, this)
-    }
-
-    @SystemAnimationState override fun getAnimationState() = animationState
-
-    override fun onStatusEvent(event: StatusEvent) {
-        // Ignore any updates until the system is up and running. However, for important events that
-        // request to be force visible (like privacy), ignore whether it's too early.
-        if ((isTooEarly() && !event.forceVisible) || !isImmersiveIndicatorEnabled()) {
-            return
-        }
-
-        // Don't deal with threading for now (no need let's be honest)
-        Assert.isMainThread()
-        if (
-            (event.priority > (scheduledEvent?.priority ?: -1)) &&
-                animationState != ANIMATING_OUT &&
-                animationState != SHOWING_PERSISTENT_DOT
-        ) {
-            // events can only be scheduled if a higher priority or no other event is in progress
-            if (DEBUG) {
-                Log.d(TAG, "scheduling event $event")
-            }
-
-            scheduleEvent(event)
-        } else if (scheduledEvent?.shouldUpdateFromEvent(event) == true) {
-            if (DEBUG) {
-                Log.d(TAG, "updating current event from: $event. animationState=$animationState")
-            }
-            scheduledEvent?.updateFromEvent(event)
-            if (event.forceVisible) {
-                hasPersistentDot = true
-                // If we missed the chance to show the persistent dot, do it now
-                if (animationState == IDLE) {
-                    notifyTransitionToPersistentDot()
-                }
-            }
-        } else {
-            if (DEBUG) {
-                Log.d(TAG, "ignoring event $event")
-            }
-        }
-    }
-
-    override fun removePersistentDot() {
-        if (!hasPersistentDot || !isImmersiveIndicatorEnabled()) {
-            return
-        }
-
-        hasPersistentDot = false
-        notifyHidePersistentDot()
-        return
-    }
-
-    fun isTooEarly(): Boolean {
-        return systemClock.uptimeMillis() - Process.getStartUptimeMillis() < MIN_UPTIME
-    }
-
-    /** Clear the scheduled event (if any) and schedule a new one */
-    private fun scheduleEvent(event: StatusEvent) {
-        scheduledEvent = event
-
-        if (event.forceVisible) {
-            hasPersistentDot = true
-        }
-
-        // If animations are turned off, we'll transition directly to the dot
-        if (!event.showAnimation && event.forceVisible) {
-            notifyTransitionToPersistentDot()
-            scheduledEvent = null
-            return
-        }
-
-        chipAnimationController.prepareChipAnimation(scheduledEvent!!.viewCreator)
-        animationState = ANIMATION_QUEUED
-        executor.executeDelayed({ runChipAnimation() }, DEBOUNCE_DELAY)
-    }
-
-    /**
-     * 1. Define a total budget for the chip animation (1500ms)
-     * 2. Send out callbacks to listeners so that they can generate animations locally
-     * 3. Update the scheduler state so that clients know where we are
-     * 4. Maybe: provide scaffolding such as: dot location, margins, etc
-     * 5. Maybe: define a maximum animation length and enforce it. Probably only doable if we
-     *    collect all of the animators and run them together.
-     */
-    private fun runChipAnimation() {
-        statusBarWindowController.setForceStatusBarVisible(true)
-        animationState = ANIMATING_IN
-
-        val animSet = collectStartAnimations()
-        if (animSet.totalDuration > 500) {
-            throw IllegalStateException(
-                "System animation total length exceeds budget. " +
-                    "Expected: 500, actual: ${animSet.totalDuration}"
-            )
-        }
-        animSet.addListener(
-            object : AnimatorListenerAdapter() {
-                override fun onAnimationEnd(animation: Animator) {
-                    animationState = RUNNING_CHIP_ANIM
-                }
-            }
-        )
-        animSet.start()
-
-        executor.executeDelayed(
-            {
-                val animSet2 = collectFinishAnimations()
-                animationState = ANIMATING_OUT
-                animSet2.addListener(
-                    object : AnimatorListenerAdapter() {
-                        override fun onAnimationEnd(animation: Animator) {
-                            animationState =
-                                if (hasPersistentDot) {
-                                    SHOWING_PERSISTENT_DOT
-                                } else {
-                                    IDLE
-                                }
-
-                            statusBarWindowController.setForceStatusBarVisible(false)
-                        }
-                    }
-                )
-                animSet2.start()
-                scheduledEvent = null
-            },
-            DISPLAY_LENGTH
-        )
-    }
-
-    private fun collectStartAnimations(): AnimatorSet {
-        val animators = mutableListOf<Animator>()
-        listeners.forEach { listener ->
-            listener.onSystemEventAnimationBegin()?.let { anim -> animators.add(anim) }
-        }
-        animators.add(chipAnimationController.onSystemEventAnimationBegin())
-        val animSet = AnimatorSet().also { it.playTogether(animators) }
-
-        return animSet
-    }
-
-    private fun collectFinishAnimations(): AnimatorSet {
-        val animators = mutableListOf<Animator>()
-        listeners.forEach { listener ->
-            listener.onSystemEventAnimationFinish(hasPersistentDot)?.let { anim ->
-                animators.add(anim)
-            }
-        }
-        animators.add(chipAnimationController.onSystemEventAnimationFinish(hasPersistentDot))
-        if (hasPersistentDot) {
-            val dotAnim = notifyTransitionToPersistentDot()
-            if (dotAnim != null) {
-                animators.add(dotAnim)
-            }
-        }
-        val animSet = AnimatorSet().also { it.playTogether(animators) }
-
-        return animSet
-    }
-
-    private fun notifyTransitionToPersistentDot(): Animator? {
-        val anims: List<Animator> =
-            listeners.mapNotNull {
-                it.onSystemStatusAnimationTransitionToPersistentDot(
-                    scheduledEvent?.contentDescription
-                )
-            }
-        if (anims.isNotEmpty()) {
-            val aSet = AnimatorSet()
-            aSet.playTogether(anims)
-            return aSet
-        }
-
-        return null
-    }
-
-    private fun notifyHidePersistentDot(): Animator? {
-        val anims: List<Animator> = listeners.mapNotNull { it.onHidePersistentDot() }
-
-        if (animationState == SHOWING_PERSISTENT_DOT) {
-            animationState = IDLE
-        }
-
-        if (anims.isNotEmpty()) {
-            val aSet = AnimatorSet()
-            aSet.playTogether(anims)
-            return aSet
-        }
-
-        return null
-    }
-
-    override fun addCallback(listener: SystemStatusAnimationCallback) {
-        Assert.isMainThread()
-
-        if (listeners.isEmpty()) {
-            coordinator.startObserving()
-        }
-        listeners.add(listener)
-    }
-
-    override fun removeCallback(listener: SystemStatusAnimationCallback) {
-        Assert.isMainThread()
-
-        listeners.remove(listener)
-        if (listeners.isEmpty()) {
-            coordinator.stopObserving()
-        }
-    }
-
-    override fun dump(pw: PrintWriter, args: Array<out String>) {
-        pw.println("Scheduled event: $scheduledEvent")
-        pw.println("Has persistent privacy dot: $hasPersistentDot")
-        pw.println("Animation state: $animationState")
-        pw.println("Listeners:")
-        if (listeners.isEmpty()) {
-            pw.println("(none)")
-        } else {
-            listeners.forEach { pw.println("  $it") }
-        }
-    }
-}
-
-private const val DEBUG = false
-private const val TAG = "SystemStatusAnimationSchedulerLegacyImpl"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
index 301ddbf..f2ade34 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
@@ -16,6 +16,9 @@
 
 package com.android.systemui.statusbar.notification.interruption;
 
+import static android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED;
+import static android.provider.Settings.Global.HEADS_UP_OFF;
+
 import static com.android.systemui.statusbar.StatusBarState.SHADE;
 import static com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_NO_HUN_OR_KEYGUARD;
 import static com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_SUPPRESSIVE_BUBBLE_METADATA;
@@ -24,12 +27,10 @@
 
 import android.app.Notification;
 import android.app.NotificationManager;
-import android.content.ContentResolver;
 import android.database.ContentObserver;
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.os.Handler;
 import android.os.PowerManager;
-import android.provider.Settings;
 import android.service.notification.StatusBarNotification;
 
 import androidx.annotation.NonNull;
@@ -48,6 +49,8 @@
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.util.settings.GlobalSettings;
+import com.android.systemui.util.time.SystemClock;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -66,7 +69,6 @@
     private final List<NotificationInterruptSuppressor> mSuppressors = new ArrayList<>();
     private final StatusBarStateController mStatusBarStateController;
     private final KeyguardStateController mKeyguardStateController;
-    private final ContentResolver mContentResolver;
     private final PowerManager mPowerManager;
     private final AmbientDisplayConfiguration mAmbientDisplayConfiguration;
     private final BatteryController mBatteryController;
@@ -77,6 +79,8 @@
     private final UiEventLogger mUiEventLogger;
     private final UserTracker mUserTracker;
     private final DeviceProvisionedController mDeviceProvisionedController;
+    private final SystemClock mSystemClock;
+    private final GlobalSettings mGlobalSettings;
 
     @VisibleForTesting
     protected boolean mUseHeadsUp = false;
@@ -111,7 +115,6 @@
 
     @Inject
     public NotificationInterruptStateProviderImpl(
-            ContentResolver contentResolver,
             PowerManager powerManager,
             AmbientDisplayConfiguration ambientDisplayConfiguration,
             BatteryController batteryController,
@@ -124,8 +127,9 @@
             KeyguardNotificationVisibilityProvider keyguardNotificationVisibilityProvider,
             UiEventLogger uiEventLogger,
             UserTracker userTracker,
-            DeviceProvisionedController deviceProvisionedController) {
-        mContentResolver = contentResolver;
+            DeviceProvisionedController deviceProvisionedController,
+            SystemClock systemClock,
+            GlobalSettings globalSettings) {
         mPowerManager = powerManager;
         mBatteryController = batteryController;
         mAmbientDisplayConfiguration = ambientDisplayConfiguration;
@@ -137,15 +141,16 @@
         mKeyguardNotificationVisibilityProvider = keyguardNotificationVisibilityProvider;
         mUiEventLogger = uiEventLogger;
         mUserTracker = userTracker;
+        mDeviceProvisionedController = deviceProvisionedController;
+        mSystemClock = systemClock;
+        mGlobalSettings = globalSettings;
         ContentObserver headsUpObserver = new ContentObserver(mainHandler) {
             @Override
             public void onChange(boolean selfChange) {
-                boolean wasUsing = mUseHeadsUp;
-                mUseHeadsUp = ENABLE_HEADS_UP
-                        && Settings.Global.HEADS_UP_OFF != Settings.Global.getInt(
-                        mContentResolver,
-                        Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
-                        Settings.Global.HEADS_UP_OFF);
+                final boolean wasUsing = mUseHeadsUp;
+                final boolean settingEnabled = HEADS_UP_OFF
+                        != mGlobalSettings.getInt(HEADS_UP_NOTIFICATIONS_ENABLED, HEADS_UP_OFF);
+                mUseHeadsUp = ENABLE_HEADS_UP && settingEnabled;
                 mLogger.logHeadsUpFeatureChanged(mUseHeadsUp);
                 if (wasUsing != mUseHeadsUp) {
                     if (!mUseHeadsUp) {
@@ -157,16 +162,15 @@
         };
 
         if (ENABLE_HEADS_UP) {
-            mContentResolver.registerContentObserver(
-                    Settings.Global.getUriFor(Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED),
+            mGlobalSettings.registerContentObserver(
+                    mGlobalSettings.getUriFor(HEADS_UP_NOTIFICATIONS_ENABLED),
                     true,
                     headsUpObserver);
-            mContentResolver.registerContentObserver(
-                    Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true,
+            mGlobalSettings.registerContentObserver(
+                    mGlobalSettings.getUriFor(SETTING_HEADS_UP_TICKER), true,
                     headsUpObserver);
         }
         headsUpObserver.onChange(true); // set up
-        mDeviceProvisionedController = deviceProvisionedController;
     }
 
     @Override
@@ -603,7 +607,7 @@
         }
 
         final long when = notification.when;
-        final long now = System.currentTimeMillis();
+        final long now = mSystemClock.currentTimeMillis();
         final long age = now - when;
 
         if (age < MAX_HUN_WHEN_AGE_MS) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProvider.kt
index 920bbe9..7ead4bf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProvider.kt
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.systemui.statusbar.notification.interruption
 
 import com.android.systemui.statusbar.notification.collection.NotificationEntry
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionRefactor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionRefactor.kt
new file mode 100644
index 0000000..2624363
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionRefactor.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2023 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.interruption
+
+import com.android.systemui.Flags
+import com.android.systemui.flags.RefactorFlagUtils
+
+/** Helper for reading or using the visual interruptions refactor flag state. */
+object VisualInterruptionRefactor {
+    const val FLAG_NAME = Flags.FLAG_VISUAL_INTERRUPTIONS_REFACTOR
+
+    /** Whether the refactor is enabled */
+    @JvmStatic
+    inline val isEnabled
+        get() = Flags.visualInterruptionsRefactor()
+
+    /**
+     * Called to ensure code is only run when the flag is enabled. This protects users from the
+     * unintended behaviors caused by accidentally running new logic, while also crashing on an eng
+     * build to ensure that the refactor author catches issues in testing.
+     */
+    @JvmStatic
+    inline fun isUnexpectedlyInLegacyMode() =
+        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)
+
+    /**
+     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
+     * the flag is enabled to ensure that the refactor author catches issues in testing.
+     */
+    @JvmStatic
+    inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME)
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt
index 4ef80e3..d524637 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.systemui.statusbar.notification.interruption
 
 import com.android.internal.logging.UiEventLogger.UiEventEnum
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
index f899e2f..5e7b857 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt
@@ -505,7 +505,6 @@
                 this.authenticators = authenticators
             }
         },
-        featureFlags,
         testScope.backgroundScope,
         fingerprintProps,
         faceProps,
@@ -519,9 +518,7 @@
         PromptViewModel(
             displayStateInteractor,
             promptSelectorInteractor,
-            vibrator,
             context,
-            featureFlags
         ),
         { credentialViewModel },
         Handler(TestableLooper.get(this).looper),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
index 885abcb..11c5d3b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
@@ -88,7 +88,6 @@
 import com.android.systemui.biometrics.domain.interactor.PromptSelectorInteractor;
 import com.android.systemui.biometrics.ui.viewmodel.CredentialViewModel;
 import com.android.systemui.biometrics.ui.viewmodel.PromptViewModel;
-import com.android.systemui.flags.FakeFeatureFlags;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.VibratorHelper;
@@ -195,7 +194,6 @@
     private Handler mHandler;
     private DelayableExecutor mBackgroundExecutor;
     private TestableAuthController mAuthController;
-    private FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();
 
     @Before
     public void setup() throws RemoteException {
@@ -1023,7 +1021,7 @@
         private PromptInfo mLastBiometricPromptInfo;
 
         TestableAuthController(Context context) {
-            super(context, mFeatureFlags, null /* applicationCoroutineScope */,
+            super(context, null /* applicationCoroutineScope */,
                     mExecution, mCommandQueue, mActivityTaskManager, mWindowManager,
                     mFingerprintManager, mFaceManager, () -> mUdfpsController,
                     () -> mSideFpsController, mDisplayManager, mWakefulnessLifecycle,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
index b695a0e..d06cbbb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt
@@ -44,18 +44,16 @@
 import com.android.systemui.coroutines.collectLastValue
 import com.android.systemui.coroutines.collectValues
 import com.android.systemui.display.data.repository.FakeDisplayRepository
-import com.android.systemui.flags.FakeFeatureFlags
-import com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION
 import com.android.systemui.res.R
 import com.android.systemui.statusbar.VibratorHelper
 import com.android.systemui.util.concurrency.FakeExecutor
-import com.android.systemui.util.mockito.any
 import com.android.systemui.util.time.FakeSystemClock
 import com.google.common.truth.Truth.assertThat
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.flow.first
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.advanceUntilIdle
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
 import org.junit.Before
@@ -64,9 +62,7 @@
 import org.junit.runner.RunWith
 import org.junit.runners.Parameterized
 import org.mockito.Mock
-import org.mockito.Mockito.never
 import org.mockito.Mockito.times
-import org.mockito.Mockito.verify
 import org.mockito.junit.MockitoJUnit
 
 private const val USER_ID = 4
@@ -95,7 +91,6 @@
     private lateinit var selector: PromptSelectorInteractor
     private lateinit var viewModel: PromptViewModel
     private lateinit var iconViewModel: PromptIconViewModel
-    private val featureFlags = FakeFeatureFlags()
 
     @Before
     fun setup() {
@@ -125,10 +120,8 @@
             PromptSelectorInteractorImpl(fingerprintRepository, promptRepository, lockPatternUtils)
         selector.resetPrompt()
 
-        viewModel =
-            PromptViewModel(displayStateInteractor, selector, vibrator, mContext, featureFlags)
+        viewModel = PromptViewModel(displayStateInteractor, selector, mContext)
         iconViewModel = viewModel.iconViewModel
-        featureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false)
     }
 
     @Test
@@ -180,26 +173,29 @@
     }
 
     @Test
-    fun play_haptic_on_confirm_when_confirmation_required_otherwise_on_authenticated() =
+    fun set_haptic_on_confirm_when_confirmation_required_otherwise_on_authenticated() =
         runGenericTest {
             val expectConfirmation = testCase.expectConfirmation(atLeastOneFailure = false)
 
             viewModel.showAuthenticated(testCase.authenticatedModality, 1_000L)
 
-            verify(vibrator, if (expectConfirmation) never() else times(1))
-                .vibrateAuthSuccess(any())
+            val confirmConstant by collectLastValue(viewModel.hapticsToPlay)
+            assertThat(confirmConstant)
+                .isEqualTo(
+                    if (expectConfirmation) HapticFeedbackConstants.NO_HAPTICS
+                    else HapticFeedbackConstants.CONFIRM
+                )
 
             if (expectConfirmation) {
                 viewModel.confirmAuthenticated()
             }
 
-            verify(vibrator).vibrateAuthSuccess(any())
-            verify(vibrator, never()).vibrateAuthError(any())
+            val confirmedConstant by collectLastValue(viewModel.hapticsToPlay)
+            assertThat(confirmedConstant).isEqualTo(HapticFeedbackConstants.CONFIRM)
         }
 
     @Test
-    fun playSuccessHaptic_onwayHapticsEnabled_SetsConfirmConstant() = runGenericTest {
-        featureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true)
+    fun playSuccessHaptic_SetsConfirmConstant() = runGenericTest {
         val expectConfirmation = testCase.expectConfirmation(atLeastOneFailure = false)
         viewModel.showAuthenticated(testCase.authenticatedModality, 1_000L)
 
@@ -212,8 +208,7 @@
     }
 
     @Test
-    fun playErrorHaptic_onwayHapticsEnabled_SetsRejectConstant() = runGenericTest {
-        featureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true)
+    fun playErrorHaptic_SetsRejectConstant() = runGenericTest {
         viewModel.showTemporaryError("test", "messageAfterError", false)
 
         val currentConstant by collectLastValue(viewModel.hapticsToPlay)
@@ -251,7 +246,8 @@
                             DisplayRotation.ROTATION_180 ->
                                 R.raw.biometricprompt_fingerprint_to_error_landscape
                             DisplayRotation.ROTATION_270 ->
-                                R.raw.biometricprompt_symbol_fingerprint_to_error_portrait_bottomright
+                                R.raw
+                                    .biometricprompt_symbol_fingerprint_to_error_portrait_bottomright
                             else -> throw Exception("invalid rotation")
                         }
                     assertThat(iconOverlayAsset).isEqualTo(expectedOverlayAsset)
@@ -496,7 +492,8 @@
                             DisplayRotation.ROTATION_180 ->
                                 R.raw.biometricprompt_symbol_fingerprint_to_success_landscape
                             DisplayRotation.ROTATION_270 ->
-                                R.raw.biometricprompt_symbol_fingerprint_to_success_portrait_bottomright
+                                R.raw
+                                    .biometricprompt_symbol_fingerprint_to_success_portrait_bottomright
                             else -> throw Exception("invalid rotation")
                         }
                     assertThat(iconOverlayAsset).isEqualTo(expectedOverlayAsset)
@@ -733,7 +730,7 @@
     }
 
     @Test
-    fun plays_haptic_on_errors() = runGenericTest {
+    fun set_haptic_on_errors() = runGenericTest {
         viewModel.showTemporaryError(
             "so sad",
             messageAfterError = "",
@@ -741,8 +738,8 @@
             hapticFeedback = true,
         )
 
-        verify(vibrator).vibrateAuthError(any())
-        verify(vibrator, never()).vibrateAuthSuccess(any())
+        val constant by collectLastValue(viewModel.hapticsToPlay)
+        assertThat(constant).isEqualTo(HapticFeedbackConstants.REJECT)
     }
 
     @Test
@@ -754,8 +751,8 @@
             hapticFeedback = false,
         )
 
-        verify(vibrator, never()).vibrateAuthError(any())
-        verify(vibrator, never()).vibrateAuthSuccess(any())
+        val constant by collectLastValue(viewModel.hapticsToPlay)
+        assertThat(constant).isEqualTo(HapticFeedbackConstants.NO_HAPTICS)
     }
 
     private suspend fun TestScope.showTemporaryErrors(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt
index 2e223f6..df257ab 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventChipAnimationControllerTest.kt
@@ -27,7 +27,6 @@
 import androidx.test.filters.SmallTest
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.animation.AnimatorTestRule
-import com.android.systemui.flags.FakeFeatureFlags
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsChangedListener
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
 import com.android.systemui.statusbar.window.StatusBarWindowController
@@ -88,8 +87,7 @@
             SystemEventChipAnimationController(
                 context = mContext,
                 statusBarWindowController = sbWindowController,
-                contentInsetsProvider = insetsProvider,
-                featureFlags = FakeFeatureFlags(),
+                contentInsetsProvider = insetsProvider
             )
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt
index c289ff3..bbc63f2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemEventCoordinatorTest.kt
@@ -21,7 +21,7 @@
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor
 import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor.PendingDisplay
-import com.android.systemui.flags.FakeFeatureFlags
+import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor.State.CONNECTED
 import com.android.systemui.privacy.PrivacyItemController
 import com.android.systemui.statusbar.policy.BatteryController
 import com.android.systemui.util.mockito.any
@@ -48,7 +48,6 @@
 class SystemEventCoordinatorTest : SysuiTestCase() {
 
     private val fakeSystemClock = FakeSystemClock()
-    private val featureFlags = FakeFeatureFlags()
     private val testScope = TestScope(UnconfinedTestDispatcher())
     private val connectedDisplayInteractor = FakeConnectedDisplayInteractor()
 
@@ -66,7 +65,6 @@
                     batteryController,
                     privacyController,
                     context,
-                    featureFlags,
                     TestScope(UnconfinedTestDispatcher()),
                     connectedDisplayInteractor
                 )
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt
index fee8b82..5f01b5a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt
@@ -26,8 +26,6 @@
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.animation.AnimatorTestRule
 import com.android.systemui.dump.DumpManager
-import com.android.systemui.flags.FakeFeatureFlags
-import com.android.systemui.flags.Flags
 import com.android.systemui.privacy.OngoingPrivacyChip
 import com.android.systemui.statusbar.BatteryStatusChip
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
@@ -76,7 +74,6 @@
     private lateinit var systemClock: FakeSystemClock
     private lateinit var chipAnimationController: SystemEventChipAnimationController
     private lateinit var systemStatusAnimationScheduler: SystemStatusAnimationScheduler
-    private val fakeFeatureFlags = FakeFeatureFlags()
 
     @get:Rule val animatorTestRule = AnimatorTestRule()
 
@@ -84,15 +81,12 @@
     fun setup() {
         MockitoAnnotations.initMocks(this)
 
-        fakeFeatureFlags.set(Flags.PLUG_IN_STATUS_BAR_CHIP, true)
-
         systemClock = FakeSystemClock()
         chipAnimationController =
             SystemEventChipAnimationController(
                 mContext,
                 statusBarWindowController,
-                statusBarContentInsetProvider,
-                fakeFeatureFlags
+                statusBarContentInsetProvider
             )
 
         // StatusBarContentInsetProvider is mocked. Ensure that it returns some mocked values.
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java
index 50ce265..1c62161 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java
@@ -13,8 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.systemui.statusbar.notification.interruption;
 
+package com.android.systemui.statusbar.notification.interruption;
 
 import static android.app.Notification.FLAG_BUBBLE;
 import static android.app.Notification.FLAG_FOREGROUND_SERVICE;
@@ -27,6 +27,8 @@
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
 import static android.app.NotificationManager.VISIBILITY_NO_OVERRIDE;
+import static android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED;
+import static android.provider.Settings.Global.HEADS_UP_ON;
 
 import static com.android.systemui.statusbar.NotificationEntryHelper.modifyRanking;
 import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
@@ -61,9 +63,9 @@
 import androidx.test.filters.SmallTest;
 
 import com.android.internal.logging.testing.UiEventLoggerFake;
-import com.android.systemui.res.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.res.R;
 import com.android.systemui.settings.UserTracker;
 import com.android.systemui.statusbar.notification.NotifPipelineFlags;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -74,6 +76,8 @@
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.util.settings.FakeGlobalSettings;
+import com.android.systemui.util.time.FakeSystemClock;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -120,6 +124,8 @@
     UserTracker mUserTracker;
     @Mock
     DeviceProvisionedController mDeviceProvisionedController;
+    FakeSystemClock mSystemClock;
+    FakeGlobalSettings mGlobalSettings;
 
     private NotificationInterruptStateProviderImpl mNotifInterruptionStateProvider;
 
@@ -129,10 +135,12 @@
         when(mUserTracker.getUserId()).thenReturn(ActivityManager.getCurrentUser());
 
         mUiEventLoggerFake = new UiEventLoggerFake();
+        mSystemClock = new FakeSystemClock();
+        mGlobalSettings = new FakeGlobalSettings();
+        mGlobalSettings.putInt(HEADS_UP_NOTIFICATIONS_ENABLED, HEADS_UP_ON);
 
         mNotifInterruptionStateProvider =
                 new NotificationInterruptStateProviderImpl(
-                        mContext.getContentResolver(),
                         mPowerManager,
                         mAmbientDisplayConfiguration,
                         mBatteryController,
@@ -145,7 +153,9 @@
                         mKeyguardNotificationVisibilityProvider,
                         mUiEventLoggerFake,
                         mUserTracker,
-                        mDeviceProvisionedController);
+                        mDeviceProvisionedController,
+                        mSystemClock,
+                        mGlobalSettings);
         mNotifInterruptionStateProvider.mUseHeadsUp = true;
     }
 
@@ -426,7 +436,7 @@
     }
 
     private long makeWhenHoursAgo(long hoursAgo) {
-        return System.currentTimeMillis() - (1000 * 60 * 60 * hoursAgo);
+        return mSystemClock.currentTimeMillis() - (1000 * 60 * 60 * hoursAgo);
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapperTest.kt
index 947bcfb..21de73a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapperTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapperTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2023 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.interruption
 
 import android.testing.AndroidTestingRunner
@@ -19,27 +35,28 @@
 @SmallTest
 @RunWith(AndroidTestingRunner::class)
 class NotificationInterruptStateProviderWrapperTest : VisualInterruptionDecisionProviderTestBase() {
-    override val provider: VisualInterruptionDecisionProvider
-        get() =
-            NotificationInterruptStateProviderWrapper(
-                NotificationInterruptStateProviderImpl(
-                        context.contentResolver,
-                        powerManager,
-                        ambientDisplayConfiguration,
-                        batteryController,
-                        statusBarStateController,
-                        keyguardStateController,
-                        headsUpManager,
-                        logger,
-                        mainHandler,
-                        flags,
-                        keyguardNotificationVisibilityProvider,
-                        uiEventLogger,
-                        userTracker,
-                        deviceProvisionedController
-                    )
-                    .also { it.mUseHeadsUp = true }
-            )
+    override val provider by lazy {
+        NotificationInterruptStateProviderWrapper(
+            NotificationInterruptStateProviderImpl(
+                    powerManager,
+                    ambientDisplayConfiguration,
+                    batteryController,
+                    statusBarStateController,
+                    keyguardStateController,
+                    headsUpManager,
+                    logger,
+                    mainHandler,
+                    flags,
+                    keyguardNotificationVisibilityProvider,
+                    uiEventLogger,
+                    userTracker,
+                    deviceProvisionedController,
+                    systemClock,
+                    globalSettings,
+                )
+                .also { it.mUseHeadsUp = true }
+        )
+    }
 
     // Tests of internals of the wrapper:
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
index 6f4bbd5..c0aaa36 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2023 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.interruption
 
 import android.app.ActivityManager
@@ -9,12 +25,15 @@
 import android.app.NotificationManager.VISIBILITY_NO_OVERRIDE
 import android.app.PendingIntent
 import android.app.PendingIntent.FLAG_MUTABLE
+import android.content.Context
 import android.content.Intent
 import android.content.pm.UserInfo
 import android.graphics.drawable.Icon
 import android.hardware.display.FakeAmbientDisplayConfiguration
 import android.os.Handler
 import android.os.PowerManager
+import android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED
+import android.provider.Settings.Global.HEADS_UP_ON
 import com.android.internal.logging.testing.UiEventLoggerFake
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.res.R
@@ -31,8 +50,11 @@
 import com.android.systemui.statusbar.policy.KeyguardStateController
 import com.android.systemui.util.mockito.any
 import com.android.systemui.util.mockito.mock
+import com.android.systemui.util.settings.FakeGlobalSettings
+import com.android.systemui.util.time.FakeSystemClock
 import com.android.systemui.utils.leaks.FakeBatteryController
 import com.android.systemui.utils.leaks.LeakCheckedTest
+import junit.framework.Assert.assertFalse
 import junit.framework.Assert.assertTrue
 import org.junit.Before
 import org.junit.Test
@@ -45,6 +67,7 @@
     protected val batteryController = FakeBatteryController(leakCheck)
     protected val deviceProvisionedController: DeviceProvisionedController = mock()
     protected val flags: NotifPipelineFlags = mock()
+    protected val globalSettings = FakeGlobalSettings()
     protected val headsUpManager: HeadsUpManager = mock()
     protected val keyguardNotificationVisibilityProvider: KeyguardNotificationVisibilityProvider =
         mock()
@@ -53,164 +76,363 @@
     protected val mainHandler: Handler = mock()
     protected val powerManager: PowerManager = mock()
     protected val statusBarStateController = FakeStatusBarStateController()
+    protected val systemClock = FakeSystemClock()
     protected val uiEventLogger = UiEventLoggerFake()
     protected val userTracker = FakeUserTracker()
 
     protected abstract val provider: VisualInterruptionDecisionProvider
 
+    private val neverSuppresses = object : NotificationInterruptSuppressor {}
+
+    private val alwaysSuppressesInterruptions =
+        object : NotificationInterruptSuppressor {
+            override fun suppressInterruptions(entry: NotificationEntry?) = true
+        }
+
+    private val alwaysSuppressesAwakeInterruptions =
+        object : NotificationInterruptSuppressor {
+            override fun suppressAwakeInterruptions(entry: NotificationEntry?) = true
+        }
+
+    private val alwaysSuppressesAwakeHeadsUp =
+        object : NotificationInterruptSuppressor {
+            override fun suppressAwakeHeadsUp(entry: NotificationEntry?) = true
+        }
+
     @Before
     fun setUp() {
+        globalSettings.putInt(HEADS_UP_NOTIFICATIONS_ENABLED, HEADS_UP_ON)
+
         val user = UserInfo(ActivityManager.getCurrentUser(), "Current user", /* flags = */ 0)
         userTracker.set(listOf(user), /* currentUserIndex = */ 0)
 
-        whenever(headsUpManager.isSnoozed(any())).thenReturn(false)
         whenever(keyguardNotificationVisibilityProvider.shouldHideNotification(any()))
             .thenReturn(false)
     }
 
     @Test
     fun testShouldPeek() {
-        ensureStateForPeek()
+        ensurePeekState()
+        assertShouldHeadsUp(buildPeekEntry())
+    }
 
-        assertTrue(provider.makeUnloggedHeadsUpDecision(createPeekEntry()).shouldInterrupt)
+    @Test
+    fun testShouldPeek_defaultLegacySuppressor() {
+        ensurePeekState()
+        provider.addLegacySuppressor(neverSuppresses)
+        assertShouldHeadsUp(buildPeekEntry())
+    }
+
+    @Test
+    fun testShouldNotPeek_legacySuppressInterruptions() {
+        ensurePeekState()
+        provider.addLegacySuppressor(alwaysSuppressesInterruptions)
+        assertShouldNotHeadsUp(buildPeekEntry())
+    }
+
+    @Test
+    fun testShouldNotPeek_legacySuppressAwakeInterruptions() {
+        ensurePeekState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions)
+        assertShouldNotHeadsUp(buildPeekEntry())
+    }
+
+    @Test
+    fun testShouldNotPeek_legacySuppressAwakeHeadsUp() {
+        ensurePeekState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp)
+        assertShouldNotHeadsUp(buildPeekEntry())
     }
 
     @Test
     fun testShouldPulse() {
-        ensureStateForPulse()
-
-        assertTrue(provider.makeUnloggedHeadsUpDecision(createPulseEntry()).shouldInterrupt)
+        ensurePulseState()
+        assertShouldHeadsUp(buildPulseEntry())
     }
 
     @Test
-    fun testShouldFsi_awake() {
-        ensureStateForAwakeFsi()
-
-        assertTrue(provider.makeUnloggedFullScreenIntentDecision(createFsiEntry()).shouldInterrupt)
+    fun testShouldPulse_defaultLegacySuppressor() {
+        ensurePulseState()
+        provider.addLegacySuppressor(neverSuppresses)
+        assertShouldHeadsUp(buildPulseEntry())
     }
 
     @Test
-    fun testShouldFsi_dreaming() {
-        ensureStateForDreamingFsi()
-
-        assertTrue(provider.makeUnloggedFullScreenIntentDecision(createFsiEntry()).shouldInterrupt)
+    fun testShouldNotPulse_legacySuppressInterruptions() {
+        ensurePulseState()
+        provider.addLegacySuppressor(alwaysSuppressesInterruptions)
+        assertShouldNotHeadsUp(buildPulseEntry())
     }
 
     @Test
-    fun testShouldFsi_keyguard() {
-        ensureStateForKeyguardFsi()
+    fun testShouldPulse_legacySuppressAwakeInterruptions() {
+        ensurePulseState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions)
+        assertShouldHeadsUp(buildPulseEntry())
+    }
 
-        assertTrue(provider.makeUnloggedFullScreenIntentDecision(createFsiEntry()).shouldInterrupt)
+    @Test
+    fun testShouldPulse_legacySuppressAwakeHeadsUp() {
+        ensurePulseState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp)
+        assertShouldHeadsUp(buildPulseEntry())
     }
 
     @Test
     fun testShouldBubble() {
-        assertTrue(provider.makeAndLogBubbleDecision(createBubbleEntry()).shouldInterrupt)
+        ensureBubbleState()
+        assertShouldBubble(buildBubbleEntry())
     }
 
-    private fun ensureStateForPeek() {
-        whenever(powerManager.isScreenOn).thenReturn(true)
-        statusBarStateController.dozing = false
-        statusBarStateController.dreaming = false
+    @Test
+    fun testShouldBubble_defaultLegacySuppressor() {
+        ensureBubbleState()
+        provider.addLegacySuppressor(neverSuppresses)
+        assertShouldBubble(buildBubbleEntry())
     }
 
-    private fun ensureStateForPulse() {
-        ambientDisplayConfiguration.fakePulseOnNotificationEnabled = true
-        batteryController.setIsAodPowerSave(false)
-        statusBarStateController.dozing = true
+    @Test
+    fun testShouldNotBubble_legacySuppressInterruptions() {
+        ensureBubbleState()
+        provider.addLegacySuppressor(alwaysSuppressesInterruptions)
+        assertShouldNotBubble(buildBubbleEntry())
     }
 
-    private fun ensureStateForAwakeFsi() {
-        whenever(powerManager.isInteractive).thenReturn(false)
-        statusBarStateController.dreaming = false
-        statusBarStateController.state = SHADE
+    @Test
+    fun testShouldNotBubble_legacySuppressAwakeInterruptions() {
+        ensureBubbleState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions)
+        assertShouldNotBubble(buildBubbleEntry())
     }
 
-    private fun ensureStateForDreamingFsi() {
-        whenever(powerManager.isInteractive).thenReturn(true)
-        statusBarStateController.dreaming = true
-        statusBarStateController.state = SHADE
+    @Test
+    fun testShouldBubble_legacySuppressAwakeHeadsUp() {
+        ensureBubbleState()
+        provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp)
+        assertShouldBubble(buildBubbleEntry())
     }
 
-    private fun ensureStateForKeyguardFsi() {
-        whenever(powerManager.isInteractive).thenReturn(true)
-        statusBarStateController.dreaming = false
-        statusBarStateController.state = KEYGUARD
+    @Test
+    fun testShouldFsi_notInteractive() {
+        ensureNotInteractiveFsiState()
+        assertShouldFsi(buildFsiEntry())
     }
 
-    private fun createNotif(
-        hasFsi: Boolean = false,
-        bubbleMetadata: BubbleMetadata? = null
-    ): Notification {
-        return Notification.Builder(context, TEST_CHANNEL_ID)
-            .apply {
-                setContentTitle(TEST_CONTENT_TITLE)
-                setContentText(TEST_CONTENT_TEXT)
+    @Test
+    fun testShouldFsi_dreaming() {
+        ensureDreamingFsiState()
+        assertShouldFsi(buildFsiEntry())
+    }
 
-                if (hasFsi) {
-                    setFullScreenIntent(mock(), /* highPriority = */ true)
-                }
+    @Test
+    fun testShouldFsi_keyguard() {
+        ensureKeyguardFsiState()
+        assertShouldFsi(buildFsiEntry())
+    }
 
-                if (bubbleMetadata != null) {
-                    setBubbleMetadata(bubbleMetadata)
-                }
+    private data class State(
+        var hunSnoozed: Boolean? = null,
+        var isAodPowerSave: Boolean? = null,
+        var isDozing: Boolean? = null,
+        var isDreaming: Boolean? = null,
+        var isInteractive: Boolean? = null,
+        var isScreenOn: Boolean? = null,
+        var keyguardShouldHideNotification: Boolean? = null,
+        var pulseOnNotificationsEnabled: Boolean? = null,
+        var statusBarState: Int? = null,
+    )
+
+    private fun setState(state: State): Unit =
+        state.run {
+            hunSnoozed?.let { whenever(headsUpManager.isSnoozed(TEST_PACKAGE)).thenReturn(it) }
+
+            isAodPowerSave?.let { batteryController.setIsAodPowerSave(it) }
+
+            isDozing?.let { statusBarStateController.dozing = it }
+
+            isDreaming?.let { statusBarStateController.dreaming = it }
+
+            isInteractive?.let { whenever(powerManager.isInteractive).thenReturn(it) }
+
+            isScreenOn?.let { whenever(powerManager.isScreenOn).thenReturn(it) }
+
+            keyguardShouldHideNotification?.let {
+                whenever(keyguardNotificationVisibilityProvider.shouldHideNotification(any()))
+                    .thenReturn(it)
             }
-            .setContentTitle(TEST_CONTENT_TITLE)
-            .setContentText(TEST_CONTENT_TEXT)
-            .build()
-    }
 
-    private fun createBubbleMetadata(): BubbleMetadata {
-        val pendingIntent =
-            PendingIntent.getActivity(
-                context,
-                /* requestCode = */ 0,
-                Intent().setPackage(context.packageName),
-                FLAG_MUTABLE
-            )
-
-        val icon = Icon.createWithResource(context.resources, R.drawable.android)
-
-        return BubbleMetadata.Builder(pendingIntent, icon).build()
-    }
-
-    private fun createEntry(
-        notif: Notification,
-        importance: Int = IMPORTANCE_DEFAULT,
-        canBubble: Boolean? = null
-    ): NotificationEntry {
-        return NotificationEntryBuilder()
-            .apply {
-                setPkg(TEST_PACKAGE)
-                setOpPkg(TEST_PACKAGE)
-                setTag(TEST_TAG)
-                setChannel(NotificationChannel(TEST_CHANNEL_ID, TEST_CHANNEL_NAME, importance))
-                setNotification(notif)
-                setImportance(importance)
-
-                if (canBubble != null) {
-                    setCanBubble(canBubble)
-                }
+            pulseOnNotificationsEnabled?.let {
+                ambientDisplayConfiguration.fakePulseOnNotificationEnabled = it
             }
-            .build()
-    }
 
-    private fun createPeekEntry() = createEntry(notif = createNotif(), importance = IMPORTANCE_HIGH)
-
-    private fun createPulseEntry() =
-        createEntry(notif = createNotif(), importance = IMPORTANCE_HIGH).also {
-            modifyRanking(it).setVisibilityOverride(VISIBILITY_NO_OVERRIDE).build()
+            statusBarState?.let { statusBarStateController.state = it }
         }
 
-    private fun createFsiEntry() =
-        createEntry(notif = createNotif(hasFsi = true), importance = IMPORTANCE_HIGH)
+    private fun ensureState(block: State.() -> Unit) =
+        State()
+            .apply {
+                keyguardShouldHideNotification = false
+                apply(block)
+            }
+            .run(this::setState)
 
-    private fun createBubbleEntry() =
-        createEntry(
-            notif = createNotif(bubbleMetadata = createBubbleMetadata()),
-            importance = IMPORTANCE_HIGH,
-            canBubble = true
-        )
+    private fun ensurePeekState(block: State.() -> Unit = {}) = ensureState {
+        hunSnoozed = false
+        isDozing = false
+        isDreaming = false
+        isScreenOn = true
+        run(block)
+    }
+
+    private fun ensurePulseState(block: State.() -> Unit = {}) = ensureState {
+        isAodPowerSave = false
+        isDozing = true
+        pulseOnNotificationsEnabled = true
+        run(block)
+    }
+
+    private fun ensureBubbleState(block: State.() -> Unit = {}) = ensureState(block)
+
+    private fun ensureNotInteractiveFsiState(block: State.() -> Unit = {}) = ensureState {
+        isDreaming = false
+        isInteractive = false
+        statusBarState = SHADE
+        run(block)
+    }
+
+    private fun ensureDreamingFsiState(block: State.() -> Unit = {}) = ensureState {
+        isDreaming = true
+        isInteractive = true
+        statusBarState = SHADE
+        run(block)
+    }
+
+    private fun ensureKeyguardFsiState(block: State.() -> Unit = {}) = ensureState {
+        isDreaming = false
+        isInteractive = true
+        statusBarState = KEYGUARD
+        run(block)
+    }
+
+    private fun assertShouldHeadsUp(entry: NotificationEntry) =
+        provider.makeUnloggedHeadsUpDecision(entry).let {
+            assertTrue("unexpected suppressed HUN: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private fun assertShouldNotHeadsUp(entry: NotificationEntry) =
+        provider.makeUnloggedHeadsUpDecision(entry).let {
+            assertFalse("unexpected unsuppressed HUN: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private fun assertShouldBubble(entry: NotificationEntry) =
+        provider.makeAndLogBubbleDecision(entry).let {
+            assertTrue("unexpected suppressed bubble: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private fun assertShouldNotBubble(entry: NotificationEntry) =
+        provider.makeAndLogBubbleDecision(entry).let {
+            assertFalse("unexpected unsuppressed bubble: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private fun assertShouldFsi(entry: NotificationEntry) =
+        provider.makeUnloggedFullScreenIntentDecision(entry).let {
+            assertTrue("unexpected suppressed FSI: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private fun assertShouldNotFsi(entry: NotificationEntry) =
+        provider.makeUnloggedFullScreenIntentDecision(entry).let {
+            assertFalse("unexpected unsuppressed FSI: ${it.logReason}", it.shouldInterrupt)
+        }
+
+    private class EntryBuilder(val context: Context) {
+        var importance = IMPORTANCE_DEFAULT
+        var suppressedVisualEffects: Int? = null
+        var whenMs: Long? = null
+        var visibilityOverride: Int? = null
+        var hasFsi = false
+        var canBubble: Boolean? = null
+        var hasBubbleMetadata = false
+        var bubbleSuppressNotification: Boolean? = null
+
+        private fun buildBubbleMetadata() =
+            BubbleMetadata.Builder(
+                    PendingIntent.getActivity(
+                        context,
+                        /* requestCode = */ 0,
+                        Intent().setPackage(context.packageName),
+                        FLAG_MUTABLE
+                    ),
+                    Icon.createWithResource(context.resources, R.drawable.android)
+                )
+                .apply { bubbleSuppressNotification?.let { setSuppressNotification(it) } }
+                .build()
+
+        fun build() =
+            Notification.Builder(context, TEST_CHANNEL_ID)
+                .apply {
+                    setContentTitle(TEST_CONTENT_TITLE)
+                    setContentText(TEST_CONTENT_TEXT)
+
+                    if (hasFsi) {
+                        setFullScreenIntent(mock(), /* highPriority = */ true)
+                    }
+
+                    whenMs?.let { setWhen(it) }
+
+                    if (hasBubbleMetadata) {
+                        setBubbleMetadata(buildBubbleMetadata())
+                    }
+                }
+                .build()
+                .let { NotificationEntryBuilder().setNotification(it) }
+                .apply {
+                    setPkg(TEST_PACKAGE)
+                    setOpPkg(TEST_PACKAGE)
+                    setTag(TEST_TAG)
+
+                    setImportance(importance)
+                    setChannel(NotificationChannel(TEST_CHANNEL_ID, TEST_CHANNEL_NAME, importance))
+
+                    canBubble?.let { setCanBubble(it) }
+                }
+                .build()!!
+                .also {
+                    modifyRanking(it)
+                        .apply {
+                            suppressedVisualEffects?.let { setSuppressedVisualEffects(it) }
+                            visibilityOverride?.let { setVisibilityOverride(it) }
+                        }
+                        .build()
+                }
+    }
+
+    private fun buildEntry(block: EntryBuilder.() -> Unit) =
+        EntryBuilder(context).also(block).build()
+
+    private fun buildPeekEntry(block: EntryBuilder.() -> Unit = {}) = buildEntry {
+        importance = IMPORTANCE_HIGH
+        run(block)
+    }
+
+    private fun buildPulseEntry(block: EntryBuilder.() -> Unit = {}) = buildEntry {
+        importance = IMPORTANCE_DEFAULT
+        visibilityOverride = VISIBILITY_NO_OVERRIDE
+        run(block)
+    }
+
+    private fun buildFsiEntry(block: EntryBuilder.() -> Unit = {}) = buildEntry {
+        importance = IMPORTANCE_HIGH
+        hasFsi = true
+        run(block)
+    }
+
+    private fun buildBubbleEntry(block: EntryBuilder.() -> Unit = {}) = buildEntry {
+        canBubble = true
+        hasBubbleMetadata = true
+        run(block)
+    }
+
+    private fun whenAgo(whenAgeMs: Long) = systemClock.currentTimeMillis() - whenAgeMs
 }
 
 private const val TEST_CONTENT_TITLE = "Test Content Title"
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 05fd6d2..4a20f83 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -20,6 +20,8 @@
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
 import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
 import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
+import static android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED;
+import static android.provider.Settings.Global.HEADS_UP_ON;
 
 import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
 import static com.android.systemui.statusbar.StatusBarState.SHADE;
@@ -51,7 +53,6 @@
 import android.app.WallpaperManager;
 import android.app.trust.TrustManager;
 import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
 import android.content.IntentFilter;
 import android.hardware.devicestate.DeviceStateManager;
 import android.hardware.display.AmbientDisplayConfiguration;
@@ -180,11 +181,16 @@
 import com.android.systemui.util.concurrency.FakeExecutor;
 import com.android.systemui.util.concurrency.MessageRouterImpl;
 import com.android.systemui.util.kotlin.JavaAdapter;
+import com.android.systemui.util.settings.FakeGlobalSettings;
+import com.android.systemui.util.settings.GlobalSettings;
 import com.android.systemui.util.time.FakeSystemClock;
+import com.android.systemui.util.time.SystemClock;
 import com.android.systemui.volume.VolumeComponent;
 import com.android.wm.shell.bubbles.Bubbles;
 import com.android.wm.shell.startingsurface.StartingSurface;
 
+import dagger.Lazy;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -198,8 +204,6 @@
 
 import javax.inject.Provider;
 
-import dagger.Lazy;
-
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper(setAsMainLooper = true)
@@ -319,6 +323,7 @@
 
     private ShadeController mShadeController;
     private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
+    private final FakeGlobalSettings mFakeGlobalSettings = new FakeGlobalSettings();
     private final FakeExecutor mMainExecutor = new FakeExecutor(mFakeSystemClock);
     private final FakeExecutor mUiBgExecutor = new FakeExecutor(mFakeSystemClock);
     private final FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();
@@ -349,8 +354,10 @@
         mPowerManager = new PowerManager(mContext, mPowerManagerService, thermalService,
                 Handler.createAsync(Looper.myLooper()));
 
+        mFakeGlobalSettings.putInt(HEADS_UP_NOTIFICATIONS_ENABLED, HEADS_UP_ON);
+
         mNotificationInterruptStateProvider =
-                new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
+                new TestableNotificationInterruptStateProviderImpl(
                         mPowerManager,
                         mAmbientDisplayConfiguration,
                         mStatusBarStateController,
@@ -363,7 +370,9 @@
                         mock(KeyguardNotificationVisibilityProvider.class),
                         mock(UiEventLogger.class),
                         mUserTracker,
-                        mDeviceProvisionedController);
+                        mDeviceProvisionedController,
+                        mFakeSystemClock,
+                        mFakeGlobalSettings);
 
         mContext.addMockSystemService(TrustManager.class, mock(TrustManager.class));
         mContext.addMockSystemService(FingerprintManager.class, mock(FingerprintManager.class));
@@ -1162,7 +1171,6 @@
             NotificationInterruptStateProviderImpl {
 
         TestableNotificationInterruptStateProviderImpl(
-                ContentResolver contentResolver,
                 PowerManager powerManager,
                 AmbientDisplayConfiguration ambientDisplayConfiguration,
                 StatusBarStateController controller,
@@ -1175,9 +1183,10 @@
                 KeyguardNotificationVisibilityProvider keyguardNotificationVisibilityProvider,
                 UiEventLogger uiEventLogger,
                 UserTracker userTracker,
-                DeviceProvisionedController deviceProvisionedController) {
+                DeviceProvisionedController deviceProvisionedController,
+                SystemClock systemClock,
+                GlobalSettings globalSettings) {
             super(
-                    contentResolver,
                     powerManager,
                     ambientDisplayConfiguration,
                     batteryController,
@@ -1190,7 +1199,9 @@
                     keyguardNotificationVisibilityProvider,
                     uiEventLogger,
                     userTracker,
-                    deviceProvisionedController
+                    deviceProvisionedController,
+                    systemClock,
+                    globalSettings
             );
             mUseHeadsUp = true;
         }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
index 41e78bb..8309b85 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
@@ -18,6 +18,8 @@
 
 import static android.app.Notification.FLAG_BUBBLE;
 import static android.app.PendingIntent.FLAG_MUTABLE;
+import static android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED;
+import static android.provider.Settings.Global.HEADS_UP_ON;
 import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_DELETED;
 import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_UPDATED;
 import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL;
@@ -157,6 +159,8 @@
 import com.android.systemui.statusbar.policy.data.repository.FakeDeviceProvisioningRepository;
 import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
 import com.android.systemui.user.domain.interactor.UserSwitcherInteractor;
+import com.android.systemui.util.settings.FakeGlobalSettings;
+import com.android.systemui.util.time.SystemClock;
 import com.android.wm.shell.ShellTaskOrganizer;
 import com.android.wm.shell.WindowManagerShellWrapper;
 import com.android.wm.shell.bubbles.Bubble;
@@ -506,8 +510,11 @@
         when(mUserManager.getProfiles(ActivityManager.getCurrentUser())).thenReturn(
                 Collections.singletonList(mock(UserInfo.class)));
 
+        final FakeGlobalSettings fakeGlobalSettings = new FakeGlobalSettings();
+        fakeGlobalSettings.putInt(HEADS_UP_NOTIFICATIONS_ENABLED, HEADS_UP_ON);
+
         TestableNotificationInterruptStateProviderImpl interruptionStateProvider =
-                new TestableNotificationInterruptStateProviderImpl(mContext.getContentResolver(),
+                new TestableNotificationInterruptStateProviderImpl(
                         mock(PowerManager.class),
                         mock(AmbientDisplayConfiguration.class),
                         mock(StatusBarStateController.class),
@@ -520,7 +527,9 @@
                         mock(KeyguardNotificationVisibilityProvider.class),
                         mock(UiEventLogger.class),
                         mock(UserTracker.class),
-                        mock(DeviceProvisionedController.class)
+                        mock(DeviceProvisionedController.class),
+                        mock(SystemClock.class),
+                        fakeGlobalSettings
                 );
 
         mShellTaskOrganizer = new ShellTaskOrganizer(mock(ShellInit.class),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableNotificationInterruptStateProviderImpl.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableNotificationInterruptStateProviderImpl.java
index 0df235d..975555c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableNotificationInterruptStateProviderImpl.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/TestableNotificationInterruptStateProviderImpl.java
@@ -16,7 +16,6 @@
 
 package com.android.systemui.wmshell;
 
-import android.content.ContentResolver;
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.os.Handler;
 import android.os.PowerManager;
@@ -32,12 +31,13 @@
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.util.settings.GlobalSettings;
+import com.android.systemui.util.time.SystemClock;
 
 public class TestableNotificationInterruptStateProviderImpl
         extends NotificationInterruptStateProviderImpl {
 
     TestableNotificationInterruptStateProviderImpl(
-            ContentResolver contentResolver,
             PowerManager powerManager,
             AmbientDisplayConfiguration ambientDisplayConfiguration,
             StatusBarStateController statusBarStateController,
@@ -50,8 +50,10 @@
             KeyguardNotificationVisibilityProvider keyguardNotificationVisibilityProvider,
             UiEventLogger uiEventLogger,
             UserTracker userTracker,
-            DeviceProvisionedController deviceProvisionedController) {
-        super(contentResolver,
+            DeviceProvisionedController deviceProvisionedController,
+            SystemClock systemClock,
+            GlobalSettings globalSettings) {
+        super(
                 powerManager,
                 ambientDisplayConfiguration,
                 batteryController,
@@ -64,7 +66,9 @@
                 keyguardNotificationVisibilityProvider,
                 uiEventLogger,
                 userTracker,
-                deviceProvisionedController);
+                deviceProvisionedController,
+                systemClock,
+                globalSettings);
         mUseHeadsUp = true;
     }
 }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/FakeStatusBarStateController.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/FakeStatusBarStateController.kt
index 19fdb6d..a65813a 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/FakeStatusBarStateController.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/FakeStatusBarStateController.kt
@@ -104,7 +104,7 @@
 
     override fun isDreaming() = dreaming
 
-    override fun setIsDreaming(drreaming: Boolean): Boolean {
+    override fun setIsDreaming(dreaming: Boolean): Boolean {
         dreaming != this.dreaming || return false
         this.dreaming = dreaming
         callbacks.forEach { it.onDreamingChanged(dreaming) }
diff --git a/packages/SystemUI/tools/lint/baseline.xml b/packages/SystemUI/tools/lint/baseline.xml
index 301c9b8..43f8300 100644
--- a/packages/SystemUI/tools/lint/baseline.xml
+++ b/packages/SystemUI/tools/lint/baseline.xml
@@ -1271,17 +1271,6 @@
     </issue>
 
     <issue
-        id="MergeRootFrame"
-        message="This `&lt;FrameLayout>` can be replaced with a `&lt;merge>` tag"
-        errorLine1="&lt;FrameLayout"
-        errorLine2="^">
-        <location
-            file="res/layout/volume_dnd_icon.xml"
-            line="16"
-            column="1"/>
-    </issue>
-
-    <issue
         id="InefficientWeight"
         message="Use a `layout_height` of `0dp` instead of `wrap_content` for better performance"
         errorLine1="                android:layout_height=&quot;wrap_content&quot;"
@@ -88853,17 +88842,6 @@
         errorLine1="    &lt;ImageView"
         errorLine2="    ^">
         <location
-            file="res/layout/volume_dnd_icon.xml"
-            line="23"
-            column="5"/>
-    </issue>
-
-    <issue
-        id="ContentDescription"
-        message="[Accessibility] Missing `contentDescription` attribute on image"
-        errorLine1="    &lt;ImageView"
-        errorLine2="    ^">
-        <location
             file="res/layout/wireless_charging_layout.xml"
             line="26"
             column="5"/>
@@ -89783,15 +89761,4 @@
             column="22"/>
     </issue>
 
-    <issue
-        id="RtlHardcoded"
-        message="Use &quot;`end`&quot; instead of &quot;`right`&quot; to ensure correct behavior in right-to-left locales"
-        errorLine1="        android:layout_gravity=&quot;right|top&quot;"
-        errorLine2="                                ~~~~~~~~~">
-        <location
-            file="res/layout/volume_dnd_icon.xml"
-            line="26"
-            column="33"/>
-    </issue>
-
 </issues>
diff --git a/services/Android.bp b/services/Android.bp
index aca8409..f1534b4 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -41,7 +41,10 @@
     name: "system_optimized_java_defaults",
     module_type: "java_defaults",
     config_namespace: "ANDROID",
-    bool_variables: ["SYSTEM_OPTIMIZE_JAVA"],
+    bool_variables: [
+        "SYSTEM_OPTIMIZE_JAVA",
+        "FULL_SYSTEM_OPTIMIZE_JAVA",
+    ],
     properties: [
         "optimize",
         "dxflags",
@@ -56,6 +59,7 @@
                 enabled: true,
                 // TODO(b/210510433): Enable optimizations after improving
                 // retracing infra.
+                // See also FULL_SYSTEM_OPTIMIZE_JAVA.
                 optimize: false,
                 shrink: true,
                 ignore_warnings: false,
@@ -81,6 +85,12 @@
                 dxflags: ["--debug"],
             },
         },
+        // Allow form factors to opt-in full system java optimization
+        FULL_SYSTEM_OPTIMIZE_JAVA: {
+            optimize: {
+                optimize: true,
+            },
+        },
     },
 }
 
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java
index 08503cb..3e46ee2 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java
@@ -50,6 +50,8 @@
     /**
      * Called by the power manager to tell the input method manager whether it
      * should start watching for wake events.
+     *
+     * @param interactive the interactive mode parameter
      */
     public abstract void setInteractive(boolean interactive);
 
@@ -61,16 +63,16 @@
     /**
      * Returns the list of installed input methods for the specified user.
      *
-     * @param userId The user ID to be queried.
-     * @return A list of {@link InputMethodInfo}.  VR-only IMEs are already excluded.
+     * @param userId the user ID to be queried
+     * @return a list of {@link InputMethodInfo}. VR-only IMEs are already excluded
      */
     public abstract List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId);
 
     /**
      * Returns the list of installed input methods that are enabled for the specified user.
      *
-     * @param userId The user ID to be queried.
-     * @return A list of {@link InputMethodInfo} that are enabled for {@code userId}.
+     * @param userId the user ID to be queried
+     * @return a list of {@link InputMethodInfo} that are enabled for {@code userId}
      */
     public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId);
 
@@ -78,8 +80,10 @@
      * Called by the Autofill Frameworks to request an {@link InlineSuggestionsRequest} from
      * the input method.
      *
+     * @param userId      the user ID to be queried
      * @param requestInfo information needed to create an {@link InlineSuggestionsRequest}.
-     * @param cb {@link IInlineSuggestionsRequestCallback} used to pass back the request object.
+     * @param cb          {@link IInlineSuggestionsRequestCallback} used to pass back the request
+     *                    object
      */
     public abstract void onCreateInlineSuggestionsRequest(@UserIdInt int userId,
             InlineSuggestionsRequestInfo requestInfo, IInlineSuggestionsRequestCallback cb);
@@ -88,8 +92,8 @@
      * Force switch to the enabled input method by {@code imeId} for current user. If the input
      * method with {@code imeId} is not enabled or not installed, do nothing.
      *
-     * @param imeId  The input method ID to be switched to.
-     * @param userId The user ID to be queried.
+     * @param imeId  the input method ID to be switched to
+     * @param userId the user ID to be queried
      * @return {@code true} if the current input method was successfully switched to the input
      * method by {@code imeId}; {@code false} the input method with {@code imeId} is not available
      * to be switched.
@@ -100,28 +104,30 @@
      * Force enable or disable the input method associated with {@code imeId} for given user. If
      * the input method associated with {@code imeId} is not installed, do nothing.
      *
-     * @param imeId  The input method ID to be enabled or disabled.
+     * @param imeId   the input method ID to be enabled or disabled
      * @param enabled {@code true} if the input method associated with {@code imeId} should be
-     *                enabled.
-     * @param userId The user ID to be queried.
+     *                enabled
+     * @param userId  the user ID to be queried
      * @return {@code true} if the input method associated with {@code imeId} was successfully
-     *         enabled or disabled, {@code false} if the input method specified is not installed
-     *         or was unable to be enabled/disabled for some other reason.
+     * enabled or disabled, {@code false} if the input method specified is not installed
+     * or was unable to be enabled/disabled for some other reason.
      */
     public abstract boolean setInputMethodEnabled(String imeId, boolean enabled,
             @UserIdInt int userId);
 
     /**
      * Registers a new {@link InputMethodListListener}.
+     *
+     * @param listener the listener to add
      */
     public abstract void registerInputMethodListListener(InputMethodListListener listener);
 
     /**
      * Transfers input focus from a given input token to that of the IME window.
      *
-     * @param sourceInputToken The source token.
-     * @param displayId The display hosting the IME window.
-     * @return {@code true} if the transfer is successful.
+     * @param sourceInputToken the source token.
+     * @param displayId        the display hosting the IME window
+     * @return {@code true} if the transfer is successful
      */
     public abstract boolean transferTouchFocusToImeWindow(@NonNull IBinder sourceInputToken,
             int displayId);
@@ -132,7 +138,7 @@
      * or SystemUI).
      *
      * @param windowToken the window token that is now in control, or {@code null} if no client
-     *                   window is in control of the IME.
+     *                    window is in control of the IME
      */
     public abstract void reportImeControl(@Nullable IBinder windowToken);
 
@@ -163,8 +169,8 @@
      * Callback when the IInputMethodSession from the accessibility service with the specified
      * accessibilityConnectionId is created.
      *
-     * @param accessibilityConnectionId The connection id of the accessibility service.
-     * @param session The session passed back from the accessibility service.
+     * @param accessibilityConnectionId the connection id of the accessibility service
+     * @param session                   the session passed back from the accessibility service
      */
     public abstract void onSessionForAccessibilityCreated(int accessibilityConnectionId,
             IAccessibilityInputMethodSession session);
@@ -173,7 +179,7 @@
      * Unbind the accessibility service with the specified accessibilityConnectionId from current
      * client.
      *
-     * @param accessibilityConnectionId The connection id of the accessibility service.
+     * @param accessibilityConnectionId the connection id of the accessibility service
      */
     public abstract void unbindAccessibilityFromCurrentClient(int accessibilityConnectionId);
 
@@ -181,7 +187,7 @@
      * Switch the keyboard layout in response to a keyboard shortcut.
      *
      * @param direction {@code 1} to switch to the next subtype, {@code -1} to switch to the
-     *                           previous subtype.
+     *                  previous subtype
      */
     public abstract void switchKeyboardLayout(int direction);
 
@@ -192,7 +198,7 @@
     public abstract boolean isAnyInputConnectionActive();
 
     /**
-     * Fake implementation of {@link InputMethodManagerInternal}.  All the methods do nothing.
+     * Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing.
      */
     private static final InputMethodManagerInternal NOP =
             new InputMethodManagerInternal() {
@@ -282,7 +288,7 @@
             };
 
     /**
-     * @return Global instance if exists.  Otherwise, a fallback no-op instance.
+     * @return Global instance if exists. Otherwise, a fallback no-op instance.
      */
     @NonNull
     public static InputMethodManagerInternal get() {
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 077812b..45ca690 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -19,6 +19,7 @@
 import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
 import static android.Manifest.permission.SYSTEM_ALERT_WINDOW;
 import static android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY;
+import static android.app.AppOpsManager.OP_CREATE_ACCESSIBILITY_OVERLAY;
 import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
 import static android.app.AppOpsManager.OP_TOAST_WINDOW;
 import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
@@ -31,6 +32,7 @@
 import static android.os.Build.VERSION_CODES.O;
 import static android.os.IInputConstants.INVALID_INPUT_DEVICE_ID;
 import static android.provider.Settings.Secure.VOLUME_HUSH_OFF;
+import static android.view.contentprotection.flags.Flags.createAccessibilityOverlayAppOpEnabled;
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.Display.INVALID_DISPLAY;
 import static android.view.Display.STATE_OFF;
@@ -2992,12 +2994,16 @@
                     // Window manager does the checking for this.
                     outAppOp[0] = OP_TOAST_WINDOW;
                     return ADD_OKAY;
+                case TYPE_ACCESSIBILITY_OVERLAY:
+                    if (createAccessibilityOverlayAppOpEnabled()) {
+                        outAppOp[0] = OP_CREATE_ACCESSIBILITY_OVERLAY;
+                        return ADD_OKAY;
+                    }
                 case TYPE_INPUT_METHOD:
                 case TYPE_WALLPAPER:
                 case TYPE_PRESENTATION:
                 case TYPE_PRIVATE_PRESENTATION:
                 case TYPE_VOICE_INTERACTION:
-                case TYPE_ACCESSIBILITY_OVERLAY:
                 case TYPE_QS_DIALOG:
                 case TYPE_NAVIGATION_BAR_PANEL:
                     // The window manager will check these.
diff --git a/services/proguard.flags b/services/proguard.flags
index e11e613..261bb7c 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -47,6 +47,11 @@
 -keep,allowoptimization,allowaccessmodification class com.android.net.module.util.* { *; }
 -keep,allowoptimization,allowaccessmodification public class com.android.server.net.IpConfigStore { *; }
 -keep,allowoptimization,allowaccessmodification public class com.android.server.net.BaseNetworkObserver { *; }
+-keep,allowoptimization,allowaccessmodification class com.android.server.display.feature.DisplayManagerFlags { *; }
+-keep,allowoptimization,allowaccessmodification class android.app.admin.flags.FeatureFlagsImpl { *; }
+-keep,allowoptimization,allowaccessmodification class com.android.server.input.NativeInputManagerService$NativeImpl { *; }
+-keep,allowoptimization,allowaccessmodification class com.android.server.ThreadPriorityBooster { *; }
+-keep,allowaccessmodification class android.app.admin.flags.Flags { *; }
 
 # Referenced via CarServiceHelperService in car-frameworks-service (avoid removing)
 -keep public class com.android.server.utils.Slogf { *; }
@@ -99,9 +104,6 @@
 -keep,allowoptimization,allowaccessmodification class com.android.server.input.InputManagerService {
   <methods>;
 }
--keep,allowoptimization,allowaccessmodification class com.android.server.input.NativeInputManagerService$NativeImpl {
-  <methods>;
-}
 -keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbHostManager {
   *** usbDeviceRemoved(...);
   *** usbDeviceAdded(...);
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 1f32c97..55fecfc 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -19,6 +19,7 @@
 
 import android.Manifest;
 import android.annotation.CallbackExecutor;
+import android.annotation.FlaggedApi;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
@@ -54,6 +55,7 @@
 import com.android.internal.telecom.ClientTransactionalServiceRepository;
 import com.android.internal.telecom.ClientTransactionalServiceWrapper;
 import com.android.internal.telecom.ITelecomService;
+import com.android.server.telecom.flags.Flags;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -412,6 +414,14 @@
             "android.telecom.extra.CALL_CREATED_TIME_MILLIS";
 
     /**
+     * The extra for call log uri that was used to mark missed calls as read when dialer gets the
+     * notification on reboot.
+     */
+    @FlaggedApi(Flags.FLAG_ADD_CALL_URI_FOR_MISSED_CALLS)
+    public static final String EXTRA_CALL_LOG_URI =
+            "android.telecom.extra.CALL_LOG_URI";
+
+    /**
      * Optional extra for incoming containing a long which specifies the time the
      * call was answered by user. This value is in milliseconds.
      * @hide
@@ -2361,6 +2371,11 @@
      * <p>
      * <b>Note</b>: {@link android.app.Notification.CallStyle} notifications should be posted after
      * the call is placed in order for the notification to be non-dismissible.
+     * <p><b>Note</b>: Call Forwarding MMI codes can only be dialed by applications that are
+     * configured as the user defined default dialer or system dialer role. If a call containing a
+     * call forwarding MMI code is placed by an application that is not in one of these roles, the
+     * dialer will be launched with a UI showing the MMI code already populated so that the user can
+     * confirm the action before the call is placed.
      * @param address The address to make the call to.
      * @param extras Bundle of extras to use with the call.
      */