From a6c38be150681f537ef316a56867387309861768 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 21 Jun 2021 16:27:11 -0700 Subject: [PATCH] Apply depth even when surface is null We need to update mDepth even when the surface is null, otherwise events will be ignored and mDepth will have the wrong value when waking up from screen-off. Test: pull up app drawer, screen off, unlock Test: go to overview, screen off, unlock Test: launch app, observe blurs and zoom Fixes: 191153501 Change-Id: I33f5d84a50e24f05a09769b1f7f3c27969f847cd --- .../statehandlers/DepthController.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 5b4e5f24d5..e6333d196b 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -161,14 +161,14 @@ public class DepthController implements StateHandler, if (mSurface != surface) { mSurface = surface; if (surface != null) { - dispatchTransactionSurface(mDepth); + dispatchTransactionSurface(); } } } @Override public void setState(LauncherState toState) { - if (mSurface == null || mIgnoreStateChangesDuringMultiWindowAnimation) { + if (mIgnoreStateChangesDuringMultiWindowAnimation) { return; } @@ -176,7 +176,7 @@ public class DepthController implements StateHandler, if (Float.compare(mDepth, toDepth) != 0) { setDepth(toDepth); } else if (toState == LauncherState.OVERVIEW) { - dispatchTransactionSurface(mDepth); + dispatchTransactionSurface(); } } @@ -202,35 +202,30 @@ public class DepthController implements StateHandler, if (Float.compare(mDepth, depthF) == 0) { return; } - if (dispatchTransactionSurface(depthF)) { - mDepth = depthF; - } + mDepth = depthF; + dispatchTransactionSurface(); } - private boolean dispatchTransactionSurface(float depth) { + private void dispatchTransactionSurface() { boolean supportsBlur = BlurUtils.supportsBlursOnWindows(); - if (supportsBlur && (mSurface == null || !mSurface.isValid())) { - return false; - } ensureDependencies(); IBinder windowToken = mLauncher.getRootView().getWindowToken(); if (windowToken != null) { - mWallpaperManager.setWallpaperZoomOut(windowToken, depth); + mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth); } - if (supportsBlur) { + if (supportsBlur && (mSurface != null && mSurface.isValid())) { // 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); + int blur = opaque || isOverview ? 0 : (int) (mDepth * mMaxBlurRadius); new SurfaceControl.Transaction() .setBackgroundBlurRadius(mSurface, blur) .setOpaque(mSurface, opaque) .apply(); } - return true; } @Override