From 517129cfa4cbbe21c5b391520cbf24fd53044781 Mon Sep 17 00:00:00 2001 From: tiger_huang Date: Tue, 31 Mar 2015 22:09:49 +0800 Subject: Prevent infinite layout and wallpaper flashing The original logic would cause mTopFullscreenOpaqueWindowState to be hidden in PhoneWindowManager.finishPostLayoutPolicyLw(), and to be shown in WindowAnimator.updateWindowsLocked() continuously if there is a show-when-locked dialog. The wallpaper would be hidden after the original wallpaper target is hidden, before the new wallpaper target is shown. https://code.google.com/p/android/issues/detail?id=162495 Change-Id: I918e0fa03eec38d9f0c07150c17013c6c21683cb --- policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 69a4ac02a058..af5025b8d151 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -4120,8 +4120,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public int finishPostLayoutPolicyLw() { - if (mWinShowWhenLocked != null && - mWinShowWhenLocked != mTopFullscreenOpaqueWindowState) { + if (mWinShowWhenLocked != null && mTopFullscreenOpaqueWindowState != null && + mWinShowWhenLocked.getAppToken() != mTopFullscreenOpaqueWindowState.getAppToken() + && isKeyguardLocked()) { // A dialog is dismissing the keyguard. Put the wallpaper behind it and hide the // fullscreen window. // TODO: Make sure FLAG_SHOW_WALLPAPER is restored when dialog is dismissed. Or not. -- cgit v1.2.3-59-g8ed1b