From 72a6f058cfcb72cad4da5ec8c84bc0a2b0d533a0 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 5 May 2016 16:25:43 -0700 Subject: [PATCH] Fix delayed light status bar animation Make sure to do another layout when we show the dim layer so PWM can pick up the change and send it to SysUI. Bug: 28434629 Change-Id: I877669ede8534601933043f60c8cef8502918c7b --- .../com/android/server/policy/PhoneWindowManager.java | 2 +- .../java/com/android/server/wm/DimLayerController.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index c1040c9636a7d..5920b2f845f45 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5004,7 +5004,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Keep track of the window if it's dimming but not necessarily fullscreen. final boolean reallyVisible = win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw(); - if (mTopFullscreenOpaqueOrDimmingWindowState == null && reallyVisible + if (mTopFullscreenOpaqueOrDimmingWindowState == null && reallyVisible && win.isDimming() && StackId.normallyFullscreenWindows(stackId)) { mTopFullscreenOpaqueOrDimmingWindowState = win; } diff --git a/services/core/java/com/android/server/wm/DimLayerController.java b/services/core/java/com/android/server/wm/DimLayerController.java index 2b9879e92fcb0..7f97c463774e2 100644 --- a/services/core/java/com/android/server/wm/DimLayerController.java +++ b/services/core/java/com/android/server/wm/DimLayerController.java @@ -1,5 +1,6 @@ package com.android.server.wm; +import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DIM_LAYER; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; @@ -250,6 +251,13 @@ class DimLayerController { duration = getDimLayerFadeDuration(duration); } state.dimLayer.show(dimLayer, dimAmount, duration); + + // If we showed a dim layer, make sure to redo the layout because some things depend + // on whether a dim layer is showing or not. + if (targetAlpha == 0) { + mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_LAYOUT; + mDisplayContent.layoutNeeded = true; + } } } else if (state.dimLayer.getLayer() != dimLayer) { state.dimLayer.setLayer(dimLayer);