From 8f29707aeeb3e0209700b805c35a22ba0a9375d5 Mon Sep 17 00:00:00 2001 From: Vinay Joglekar Date: Thu, 5 Jun 2025 13:20:56 +0100 Subject: [PATCH] Fix app tile blur when clicked on recents button rapidly. When we tap on recents, setActivityStarted set to true where setBaseSurface is called with launcher surface. When app is opened setActivityStarted is false and setBaseSurface is set to null. In subsequent calls, between where call to setBaseSurface with launcher is skipped. This causes due to race condition between removeOnDrawListener which is "asynchronously" posted from onLauncherDraw and addOnDrawListener. This makes addOnDrawListener not to get properly added. Hence mBaseSurface remains null and we do not get chance to set the blur to launcher layer to 0 and then reparent/relayer blur behind live tile. Hence blur is still over launcher layer which makes live tile blur. Added boolean that makes async removeOnDrawListener in onLauncherDraw cancellable. Fix: 387428198 Test: Rapidly tap on recents button Flag: com.android.launcher3.enable_overview_background_wallpaper_blur Change-Id: I5ed2ec198563d9edb181a723c9db47ecfe500c5d --- .../launcher3/statehandlers/DepthController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 160344e172..8a2eb3aa05 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -63,6 +63,7 @@ public class DepthController extends BaseDepthController implements StateHandler // Ensure {@link mOnDrawListener} is added only once to avoid spamming DragLayer's mRunQueue // via {@link View#post(Runnable)} private boolean mIsOnDrawListenerAdded = false; + private boolean mRemoveOnDrawListenerCancelled = false; public DepthController(QuickstepLauncher launcher) { super(launcher); @@ -72,7 +73,12 @@ public class DepthController extends BaseDepthController implements StateHandler View view = mLauncher.getDragLayer(); ViewRootImpl viewRootImpl = view.getViewRootImpl(); setBaseSurface(viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null); - view.post(this::removeOnDrawListener); + mRemoveOnDrawListenerCancelled = false; + view.post(() -> { + if (!mRemoveOnDrawListenerCancelled) { + removeOnDrawListener(); + } + }); } private void ensureDependencies() { @@ -178,6 +184,7 @@ public class DepthController extends BaseDepthController implements StateHandler } private void addOnDrawListener() { + mRemoveOnDrawListenerCancelled = true; if (mIsOnDrawListenerAdded) { return; } @@ -186,6 +193,7 @@ public class DepthController extends BaseDepthController implements StateHandler } private void removeOnDrawListener() { + mRemoveOnDrawListenerCancelled = true; if (!mIsOnDrawListenerAdded) { return; }