Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bee63000 authored by Adrian Roos's avatar Adrian Roos
Browse files

Fix bug that prevented waking from dream

If a device was securely locked, FLAG_TURN_SCREEN_ON failed to
wake the device from dreaming even if FLAG_SHOW_WHEN_LOCKED
was set. The fix allows SHOW_WHEN_LOCKED activities that are about
to turn the screen on to show even if they're not currently the top
most window with SHOW_WHEN_LOCKED set (which in this case would always
be the dream)

Bug: 21719374
Change-Id: I8d7bce05d95ed9de50b5a52b0973562b070aca5a
parent 53a6b06e
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -197,18 +197,25 @@ public class WindowAnimator {
        final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw();
        final AppWindowToken appShowWhenLocked = winShowWhenLocked == null ?
                null : winShowWhenLocked.mAppToken;
        final boolean hideWhenLocked =
                !(((win.mIsImWindow || imeTarget == win) && showImeOverKeyguard)
                        || (appShowWhenLocked != null && (appShowWhenLocked == win.mAppToken

        boolean allowWhenLocked = false;
        // Show IME over the keyguard if the target allows it
        allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard;
        // Show SHOW_WHEN_LOCKED windows that turn on the screen
        allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen;

        if (appShowWhenLocked != null) {
            allowWhenLocked |= appShowWhenLocked == win.mAppToken
                    // Show all SHOW_WHEN_LOCKED windows while they're animating
                    || (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.isAnimatingLw()
                    // Show error dialogs over apps that dismiss keyguard.
                        || (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0)));
                    || (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
        }

        // Only hide windows if the keyguard is active and not animating away.
        boolean keyguardOn = mPolicy.isKeyguardShowingOrOccluded()
                && mForceHiding != KEYGUARD_ANIMATING_OUT;
        return keyguardOn && hideWhenLocked && (win.getDisplayId() == Display.DEFAULT_DISPLAY);
        return keyguardOn && !allowWhenLocked && (win.getDisplayId() == Display.DEFAULT_DISPLAY);
    }

    private void updateWindowsLocked(final int displayId) {