From cec6bd9c7464eae1081123f73a14fc0d770b5f7b Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 2 Feb 2021 15:55:58 -0800 Subject: [PATCH] ViewRootImpl: Use mergeWithNextTransaction for updating bounds layer Continuing the general trend of deprecating deferTransactionUntil. Bug: 168505645 Test: Existing tests pass Change-Id: I72e1f4e2eec369ecdbd3723d9af3f9f2e8f71c36 --- core/java/android/view/ViewRootImpl.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 036a703f178c8..8f5717d909d25 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1912,25 +1912,18 @@ public final class ViewRootImpl implements ViewParent, private boolean updateBoundsLayer(SurfaceControl.Transaction t) { if (mBoundsLayer != null) { setBoundsLayerCrop(t); - t.deferTransactionUntil(mBoundsLayer, getSurfaceControl(), - mSurface.getNextFrameNumber()); return true; } return false; } - private void prepareSurfaces(boolean sizeChanged) { + private void prepareSurfaces() { final SurfaceControl.Transaction t = mTransaction; final SurfaceControl sc = getSurfaceControl(); if (!sc.isValid()) return; - boolean applyTransaction = updateBoundsLayer(t); - if (sizeChanged) { - applyTransaction = true; - t.setBufferSize(sc, mSurfaceSize.x, mSurfaceSize.y); - } - if (applyTransaction) { - t.apply(); + if (updateBoundsLayer(t)) { + mergeWithNextTransaction(t, mSurface.getNextFrameNumber()); } } @@ -3035,7 +3028,7 @@ public final class ViewRootImpl implements ViewParent, // stopping, but on the client side it doesn't get stopped since it's restarted quick // enough. WMS doesn't want to keep around old children since they will leak when the // client creates new children. - prepareSurfaces(surfaceSizeChanged); + prepareSurfaces(); } final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);