From 7e1cb5c6b6c1b3bca7c6068671599de836b39bad Mon Sep 17 00:00:00 2001 From: Garfield Tan Date: Fri, 10 Apr 2020 15:21:23 -0700 Subject: [PATCH] Enable compositor shadow for freeform windows. It was disabled because root task didn't have bounds for freeform windows, but now it does so let's enable it. Bug: 149585281 Test: Smoke tests on crosshatch with freeform developer option on. Change-Id: Ie8a40ad20c028919c8959a1df291dee408b49c39 --- core/java/com/android/internal/policy/DecorView.java | 7 ++----- services/core/java/com/android/server/wm/Task.java | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index b6c58e16b51c3..f5d38ca37bb7b 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -1631,9 +1631,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind int opacity = PixelFormat.OPAQUE; final WindowConfiguration winConfig = getResources().getConfiguration().windowConfiguration; - // TODO(b/149585281) remove when root task has the correct bounds for freeform - final boolean renderShadowsInCompositor = mWindow.mRenderShadowsInCompositor - && winConfig.getWindowingMode() != WINDOWING_MODE_FREEFORM; + final boolean renderShadowsInCompositor = mWindow.mRenderShadowsInCompositor; // If we draw shadows in the compositor we don't need to force the surface to be // translucent. if (winConfig.hasWindowShadow() && !renderShadowsInCompositor) { @@ -2427,8 +2425,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private void updateElevation() { final int windowingMode = getResources().getConfiguration().windowConfiguration.getWindowingMode(); - final boolean renderShadowsInCompositor = mWindow.mRenderShadowsInCompositor - && windowingMode != WINDOWING_MODE_FREEFORM; + final boolean renderShadowsInCompositor = mWindow.mRenderShadowsInCompositor; // If rendering shadows in the compositor, don't set an elevation on the view if (renderShadowsInCompositor) { return; diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index f8ee09b7a1420..9eea94206c67a 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -212,7 +212,6 @@ class Task extends WindowContainer { static final int INVALID_MIN_SIZE = -1; private float mShadowRadius = 0; private final Rect mLastSurfaceCrop = new Rect(); - private static final boolean ENABLE_FREEFORM_COMPOSITOR_SHADOWS = false; /** * The modes to control how the stack is moved to the front when calling {@link Task#reparent}. @@ -2729,10 +2728,8 @@ class Task extends WindowContainer { } private void updateSurfaceCrop() { - // TODO(b/149585281) remove when root task has the correct bounds for freeform // Only update the crop if we are drawing shadows on the task. - if (mSurfaceControl == null || !mWmService.mRenderShadowsInCompositor - || !isRootTask() || !ENABLE_FREEFORM_COMPOSITOR_SHADOWS) { + if (mSurfaceControl == null || !mWmService.mRenderShadowsInCompositor || !isRootTask()) { return; } @@ -4272,8 +4269,7 @@ class Task extends WindowContainer { // Get elevation for a specific windowing mode. if (inPinnedWindowingMode()) { elevation = PINNED_WINDOWING_MODE_ELEVATION_IN_DIP; - } else if (ENABLE_FREEFORM_COMPOSITOR_SHADOWS && inFreeformWindowingMode()) { - // TODO(b/149585281) remove when root task has the correct bounds for freeform + } else if (inFreeformWindowingMode()) { elevation = taskIsFocused ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP; } else {