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

Commit 635b58bc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix IME window can't show on keyguard with setShowWhenLocked."

parents 481a984a 31e4f8ec
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2295,9 +2295,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }

        final LayoutParams attrs = win.getAttrs();
        final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleLw() &&
                ((imeTarget.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0
                        || !canBeHiddenByKeyguardLw(imeTarget));
        final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleLw()
                && (imeTarget.canShowWhenLocked() || !canBeHiddenByKeyguardLw(imeTarget));

        // Show IME over the keyguard if the target allows it
        boolean allowWhenLocked = (win.isInputMethodWindow() || imeTarget == this)
@@ -2305,7 +2304,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        if (isKeyguardLocked() && isKeyguardOccluded()) {
            // Show SHOW_WHEN_LOCKED windows if Keyguard is occluded.
            allowWhenLocked |= (attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0
            allowWhenLocked |= win.canShowWhenLocked()
                    // Show error dialogs over apps that are shown on lockscreen
                    || (attrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
        }
+3 −0
Original line number Diff line number Diff line
@@ -468,6 +468,9 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
        /** @return true if this window desires key events. */
        boolean canReceiveKeys();

        /** @return true if the window can show over keyguard. */
        boolean canShowWhenLocked();

        /**
         * Writes {@link com.android.server.wm.IdentifierProto} to stream.
         */
+8 −0
Original line number Diff line number Diff line
@@ -2405,6 +2405,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                && !cantReceiveTouchInput();
    }

    @Override
    public boolean canShowWhenLocked() {
        final boolean showBecauseOfActivity =
                mAppToken != null && mAppToken.mActivityRecord.canShowWhenLocked();
        final boolean showBecauseOfWindow = (getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0;
        return showBecauseOfActivity || showBecauseOfWindow;
    }

    /** @return false if this window desires touch events. */
    boolean cantReceiveTouchInput() {
        return mAppToken != null && mAppToken.getTask() != null