summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/ViewRootImpl.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index d1f9fbded003..152fa08d2a9d 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -11365,9 +11365,13 @@ public final class ViewRootImpl implements ViewParent,
if (mRemoved || !isHardwareEnabled()) {
t.apply();
} else {
+ // Copy and clear the passed in transaction for thread safety. The new transaction is
+ // accessed on the render thread.
+ var localTransaction = new Transaction();
+ localTransaction.merge(t);
mHasPendingTransactions = true;
registerRtFrameCallback(frame -> {
- mergeWithNextTransaction(t, frame);
+ mergeWithNextTransaction(localTransaction, frame);
});
}
return true;