Revert "Apply depth even when surface is null"

This reverts commit a6c38be150.

Fixes: 193333562
Test: manual
Change-Id: I4fae079e0cd056fc800e5a15389f4795c77e17fb
This commit is contained in:
Lucas Dupin 2021-07-20 14:13:50 -07:00
parent c3f56d7628
commit ee9099af7f
1 changed files with 20 additions and 12 deletions

View File

@ -100,9 +100,12 @@ public class DepthController implements StateHandler<LauncherState>,
} }
}; };
private final Consumer<Boolean> mCrossWindowBlurListener = (enabled) -> { private final Consumer<Boolean> mCrossWindowBlurListener = new Consumer<Boolean>() {
mCrossWindowBlursEnabled = enabled; @Override
dispatchTransactionSurface(); public void accept(Boolean enabled) {
mCrossWindowBlursEnabled = enabled;
dispatchTransactionSurface(mDepth);
}
}; };
private final Launcher mLauncher; private final Launcher mLauncher;
@ -189,14 +192,14 @@ public class DepthController implements StateHandler<LauncherState>,
if (mSurface != surface) { if (mSurface != surface) {
mSurface = surface; mSurface = surface;
if (surface != null) { if (surface != null) {
dispatchTransactionSurface(); dispatchTransactionSurface(mDepth);
} }
} }
} }
@Override @Override
public void setState(LauncherState toState) { public void setState(LauncherState toState) {
if (mIgnoreStateChangesDuringMultiWindowAnimation) { if (mSurface == null || mIgnoreStateChangesDuringMultiWindowAnimation) {
return; return;
} }
@ -204,7 +207,7 @@ public class DepthController implements StateHandler<LauncherState>,
if (Float.compare(mDepth, toDepth) != 0) { if (Float.compare(mDepth, toDepth) != 0) {
setDepth(toDepth); setDepth(toDepth);
} else if (toState == LauncherState.OVERVIEW) { } else if (toState == LauncherState.OVERVIEW) {
dispatchTransactionSurface(); dispatchTransactionSurface(mDepth);
} }
} }
@ -243,31 +246,36 @@ public class DepthController implements StateHandler<LauncherState>,
if (Float.compare(mDepth, depthF) == 0) { if (Float.compare(mDepth, depthF) == 0) {
return; return;
} }
mDepth = depthF; if (dispatchTransactionSurface(depthF)) {
dispatchTransactionSurface(); mDepth = depthF;
}
} }
private void dispatchTransactionSurface() { private boolean dispatchTransactionSurface(float depth) {
boolean supportsBlur = BlurUtils.supportsBlursOnWindows(); boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
return false;
}
ensureDependencies(); ensureDependencies();
IBinder windowToken = mLauncher.getRootView().getWindowToken(); IBinder windowToken = mLauncher.getRootView().getWindowToken();
if (windowToken != null) { if (windowToken != null) {
mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth); mWallpaperManager.setWallpaperZoomOut(windowToken, depth);
} }
if (supportsBlur && (mSurface != null && mSurface.isValid())) { if (supportsBlur) {
// We cannot mark the window as opaque in overview because there will be an app window // 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. // below the launcher layer, and we need to draw it -- without blurs.
boolean isOverview = mLauncher.isInState(LauncherState.OVERVIEW); boolean isOverview = mLauncher.isInState(LauncherState.OVERVIEW);
boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview; boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview;
int blur = opaque || isOverview || !mCrossWindowBlursEnabled int blur = opaque || isOverview || !mCrossWindowBlursEnabled
|| mBlurDisabledForAppLaunch ? 0 : (int) (mDepth * mMaxBlurRadius); || mBlurDisabledForAppLaunch ? 0 : (int) (depth * mMaxBlurRadius);
new SurfaceControl.Transaction() new SurfaceControl.Transaction()
.setBackgroundBlurRadius(mSurface, blur) .setBackgroundBlurRadius(mSurface, blur)
.setOpaque(mSurface, opaque) .setOpaque(mSurface, opaque)
.apply(); .apply();
} }
return true;
} }
@Override @Override