/** {@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.