Creating the transaction on the UI thread

This avoids the error when the transaction is created after
the surface is released. In case the surface is released after
transaction object is created, the apply() call simply ignores
that error, whereas previously the transactionCreation will throw
an error

Bug: 231889963
Test: Verified by manually releasing the surface that there is no crash
Change-Id: I9a4b9ca0be2ed687b2fc692570415256e3e479f7
diff --git a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
index 4757d4b..1200208 100644
--- a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
+++ b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
@@ -75,6 +75,13 @@
         if (view == null) {
             return;
         }
+        Transaction t = new Transaction();
+        for (int i = params.length - 1; i >= 0; i--) {
+            SurfaceParams surfaceParams = params[i];
+            if (surfaceParams.surface.isValid()) {
+                surfaceParams.applyTo(t);
+            }
+        }
 
         mLastSequenceNumber++;
         final int toApplySeqNo = mLastSequenceNumber;
@@ -85,13 +92,6 @@
                         .sendToTarget();
                 return;
             }
-            Transaction t = new Transaction();
-            for (int i = params.length - 1; i >= 0; i--) {
-                SurfaceParams surfaceParams = params[i];
-                if (surfaceParams.surface.isValid()) {
-                      surfaceParams.applyTo(t);
-                }
-            }
             mTargetViewRootImpl.mergeWithNextTransaction(t, frame);
             Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
                     .sendToTarget();