Follow up to Ia7900e753b29187a7a7b81f393666687e8b8e04b

Test: Open notification
Bug: 78611607
Change-Id: I608d4b619d5e236c1c874c8c7613f35574d45fd4
Merged-In: I608d4b619d5e236c1c874c8c7613f35574d45fd4
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
index b08d4d4..1c2831b 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
@@ -30,7 +30,6 @@
  */
 public class SyncRtSurfaceTransactionApplier {
 
-    private final Object mLock = new Object();
     private final Surface mTargetSurface;
     private final ViewRootImpl mTargetViewRootImpl;
     private final float[] mTmpFloat9 = new float[9];
@@ -46,48 +45,31 @@
     /**
      * Schedules applying surface parameters on the next frame.
      *
-     * @param params The parameters for the surface to apply.
-     */
-    public void scheduleApply(SurfaceParams params) {
-        ArrayList<SurfaceParams> list = new ArrayList<>(1);
-        list.add(params);
-        scheduleApply(list);
-    }
-
-    /**
-     * Schedules applying surface parameters on the next frame.
-     *
      * @param params The surface parameters to apply. DO NOT MODIFY the list after passing into
      *               this method to avoid synchronization issues.
      */
-    public void scheduleApply(ArrayList<SurfaceParams> params) {
-        if (mTargetViewRootImpl != null) {
-
-            // Acquire mLock to establish a happens-before relationship to ensure the other thread
-            // sees the surface parameters.
-            synchronized (mLock) {
-                mTargetViewRootImpl.registerRtFrameCallback(frame -> {
-                    synchronized (mLock) {
-                        if (mTargetSurface == null || !mTargetSurface.isValid()) {
-                            return;
-                        }
-                        SurfaceControl.Transaction t = new SurfaceControl.Transaction();
-                        for (int i = params.size() - 1; i >= 0; i--) {
-                            SurfaceParams surfaceParams = params.get(i);
-                            SurfaceControl surface = surfaceParams.surface;
-                            t.deferTransactionUntilSurface(surface, mTargetSurface, frame);
-                            t.setMatrix(surface, surfaceParams.matrix, mTmpFloat9);
-                            t.setWindowCrop(surface, surfaceParams.windowCrop);
-                            t.setAlpha(surface, surfaceParams.alpha);
-                            t.setLayer(surface, surfaceParams.layer);
-                            t.show(surface);
-                        }
-                        t.setEarlyWakeup();
-                        t.apply();
-                    }
-                });
-            }
+    public void scheduleApply(SurfaceParams... params) {
+        if (mTargetViewRootImpl == null) {
+            return;
         }
+        mTargetViewRootImpl.registerRtFrameCallback(frame -> {
+                if (mTargetSurface == null || !mTargetSurface.isValid()) {
+                    return;
+                }
+                SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+                for (int i = params.length - 1; i >= 0; i--) {
+                    SurfaceParams surfaceParams = params[i];
+                    SurfaceControl surface = surfaceParams.surface;
+                    t.deferTransactionUntilSurface(surface, mTargetSurface, frame);
+                    t.setMatrix(surface, surfaceParams.matrix, mTmpFloat9);
+                    t.setWindowCrop(surface, surfaceParams.windowCrop);
+                    t.setAlpha(surface, surfaceParams.alpha);
+                    t.setLayer(surface, surfaceParams.layer);
+                    t.show(surface);
+                }
+                t.setEarlyWakeup();
+                t.apply();
+        });
     }
 
     public static class SurfaceParams {