From cdc111a158c089a6a8e4dd9c9e961c77b91d684d Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 24 May 2022 17:09:25 -0700 Subject: 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 --- .../android/quickstep/util/SurfaceTransactionApplier.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'quickstep/src') diff --git a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java index 4757d4bc7d..1200208e30 100644 --- a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java +++ b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java @@ -75,6 +75,13 @@ public class SurfaceTransactionApplier extends ReleaseCheck { 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 @@ public class SurfaceTransactionApplier extends ReleaseCheck { .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(); -- cgit v1.2.3