From 258e4526b74daede125d18994d601675f98e776c Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Fri, 4 Jun 2021 09:25:37 -0700 Subject: [PATCH] Remove blur from launcher when in overview The App window will be under Launcher, so we can't actually blur launcher at that time, otherwise the live window will also be blurred. Test: manual Bug: 189207458 Change-Id: Ie07449d29d3b0dc60d3787b6d32aa9e46e0bb613 --- .../statehandlers/DepthController.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 46ef6982ff..5b4e5f24d5 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -161,7 +161,7 @@ public class DepthController implements StateHandler, if (mSurface != surface) { mSurface = surface; if (surface != null) { - setDepth(mDepth); + dispatchTransactionSurface(mDepth); } } } @@ -175,6 +175,8 @@ public class DepthController implements StateHandler, float toDepth = toState.getDepth(mLauncher); if (Float.compare(mDepth, toDepth) != 0) { setDepth(toDepth); + } else if (toState == LauncherState.OVERVIEW) { + dispatchTransactionSurface(mDepth); } } @@ -200,26 +202,35 @@ public class DepthController implements StateHandler, if (Float.compare(mDepth, depthF) == 0) { return; } + if (dispatchTransactionSurface(depthF)) { + mDepth = depthF; + } + } + private boolean dispatchTransactionSurface(float depth) { boolean supportsBlur = BlurUtils.supportsBlursOnWindows(); if (supportsBlur && (mSurface == null || !mSurface.isValid())) { - return; + return false; } - mDepth = depthF; ensureDependencies(); IBinder windowToken = mLauncher.getRootView().getWindowToken(); if (windowToken != null) { - mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth); + mWallpaperManager.setWallpaperZoomOut(windowToken, depth); } if (supportsBlur) { - boolean isOpaque = mLauncher.getScrimView().isFullyOpaque(); - int blur = isOpaque ? 0 : (int) (mDepth * mMaxBlurRadius); + // We cannot mark the window as opaque in overview because there will be an app window + // below the launcher layer, and we need to draw it -- without blurs. + boolean isOverview = mLauncher.isInState(LauncherState.OVERVIEW); + boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview; + + int blur = opaque || isOverview ? 0 : (int) (depth * mMaxBlurRadius); new SurfaceControl.Transaction() .setBackgroundBlurRadius(mSurface, blur) - .setOpaque(mSurface, isOpaque) + .setOpaque(mSurface, opaque) .apply(); } + return true; } @Override