From 0a2076e8d37cdc33ebfa0c3654ba433707d2db10 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 24 Aug 2021 13:36:41 -0700 Subject: [PATCH] Synchronize surface transaction Until now the SurfaceControl transaction was being applied asynchronously, which could lead to it being executed out of sync with launcher drawing. This became an issue at higher refresh rates, where frames are produced at a much faster pace. In order to fix this issue, we can use BLAST transactions, which are annotated with a frame number. Test: record video, go through it manually Fixes: 194320152 Change-Id: I1636a1ded4f9dd84c54ba12239e3549b92ed7567 Merged-In: I1636a1ded4f9dd84c54ba12239e3549b92ed7567 --- .../launcher3/statehandlers/DepthController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 000d69d400..8c9ac12bd4 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -26,6 +26,7 @@ import android.animation.ObjectAnimator; import android.os.IBinder; import android.os.SystemProperties; import android.util.FloatProperty; +import android.view.AttachedSurfaceControl; import android.view.CrossWindowBlurListeners; import android.view.SurfaceControl; import android.view.View; @@ -282,10 +283,15 @@ public class DepthController implements StateHandler, int blur = opaque || isOverview || !mCrossWindowBlursEnabled || mBlurDisabledForAppLaunch ? 0 : (int) (depth * mMaxBlurRadius); - new SurfaceControl.Transaction() + SurfaceControl.Transaction transaction = new SurfaceControl.Transaction() .setBackgroundBlurRadius(mSurface, blur) - .setOpaque(mSurface, opaque) - .apply(); + .setOpaque(mSurface, opaque); + + AttachedSurfaceControl rootSurfaceControl = + mLauncher.getRootView().getRootSurfaceControl(); + if (rootSurfaceControl != null) { + rootSurfaceControl.applyTransactionOnDraw(transaction); + } } return true; }