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
This commit is contained in:
tiger_huang
2015-03-31 22:09:49 +08:00
parent 631565abd6
commit 517129cfa4

View File

@@ -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.