From b7202a8339652a721a285c37358e38b4926f8e25 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Mon, 11 Sep 2017 16:58:53 +0200 Subject: [PATCH] Fix light status bar when transitioning home -> recents In the home -> recents animation home is exiting but recents is still translucent because this is how the animation is designed. In that case, mWinAnimator.mShownAlpha is 0 such that mTopFullscreenOpaque becomes null, creating a flicker if both home and recents have light status bar flag set. We fix this by refining this condition: It was added such that a starting window for an activity that might never become visible does not affect the systemUI flags. Now, we only avoid affecting the flags if a dummy animation is set (a transition is about to start) and shown alpha is 0, which indicates that the window is entering. Test: go/wm-smoke Test: With light wallpaper, go home -> recents Test: All other common transitions with light status bar Test: Open camera, go to gallery, go home, double click power button to reopen camera (regression test) Change-Id: I6cddc3b8eb09c547618d7572195889de7766d838 Fixes: 65398267 --- .../core/java/com/android/server/wm/WindowState.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index df0dfcb053a36..28dba73db263b 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1484,7 +1484,7 @@ class WindowState extends WindowContainer implements WindowManagerP // TODO: Another visibility method that was added late in the release to minimize risk. @Override public boolean canAffectSystemUiFlags() { - final boolean shown = mWinAnimator.getShown() && mWinAnimator.mShownAlpha > 0f; + final boolean shown = mWinAnimator.getShown(); // We only consider the app to be exiting when the animation has started. After the app // transition is executed the windows are marked exiting before the new windows have been @@ -1498,7 +1498,12 @@ class WindowState extends WindowContainer implements WindowManagerP final boolean exiting = exitingSelf || mDestroying || appExiting; final boolean translucent = mAttrs.alpha == 0.0f; - return shown && !exiting && !translucent; + + // If we are entering with a dummy animation, avoid affecting SystemUI flags until the + // transition is starting. + final boolean enteringWithDummyAnimation = + mWinAnimator.isDummyAnimation() && mWinAnimator.mShownAlpha == 0f; + return shown && !exiting && !translucent && !enteringWithDummyAnimation; } /**