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

Commit 3ae0d315 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Fixed constant window switching on lock screen with Swype KB.

We allow TYPE_INPUT_METHOD windows to show on the lock screen.
These windows can attached other types of windows (For this
case the Swype KB was attaching a PopupWinow which will be
of TYPE_APPLICATION). This causes the popup window app token
to be added to the list of apps to be hidden on the lock
screen, thereby preventing the lock screen from been hidden,
which then causes a layout cycle(s). Now, we remove app
tokens for non-app windows from the hidden list in case it
was added by any attached widow they migth have.

Also, when we are updating window animations, set the
hideWhenLocked flag for windows that are IME tragets so
they don't go through unneeded cycles of having their
visibility policy set to hide/show/hide/show/...

Bug: 18021493
Change-Id: I3680256d41793f62def42fda00e26db1dcc990cc
parent 89444a38
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -904,9 +904,10 @@ public interface WindowManagerPolicy {
     *
     * @param win The window being positioned.
     * @param attrs The LayoutParams of the window.
     * @param attached For sub-windows, the window it is attached to. Otherwise null.
     */
    public void applyPostLayoutPolicyLw(WindowState win,
            WindowManager.LayoutParams attrs);
            WindowManager.LayoutParams attrs, WindowState attached);

    /**
     * Called following layout of all windows and after policy has been applied
+9 −3
Original line number Diff line number Diff line
@@ -3985,7 +3985,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    /** {@inheritDoc} */
    @Override
    public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs) {
    public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs,
            WindowState attached) {

        if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw="
                + win.isVisibleOrBehindKeyguardLw());
        final int fl = PolicyControl.getWindowFlags(win, attrs);
@@ -4024,8 +4026,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            final boolean showWhenLocked = (fl & FLAG_SHOW_WHEN_LOCKED) != 0;
            final boolean dismissKeyguard = (fl & FLAG_DISMISS_KEYGUARD) != 0;
            final boolean secureKeyguard = isKeyguardSecure();
            if (appWindow) {
            final IApplicationToken appToken = win.getAppToken();

            // For app windows that are not attached, we decide if all windows in the app they
            // represent should be hidden or if we should hide the lockscreen. For attached app
            // windows we defer the decision to the window it is attached to.
            if (appWindow && attached == null) {
                if (showWhenLocked) {
                    // Remove any previous windows with the same appToken.
                    mAppsToBeHidden.remove(appToken);
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ public class WindowAnimator {
                            + " hidden=" + win.mRootToken.hidden
                            + " anim=" + win.mWinAnimator.mAnimation);
                } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) {
                    final boolean hideWhenLocked = !((win.mIsImWindow && showImeOverKeyguard) ||
                    final boolean hideWhenLocked = !((win.mIsImWindow || imeTarget == win) && showImeOverKeyguard) ||
                            (appShowWhenLocked != null && (appShowWhenLocked == win.mAppToken ||
                                    // Show error dialogs over apps that dismiss keyguard.
                                    (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0)));
+1 −1
Original line number Diff line number Diff line
@@ -9687,7 +9687,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        for (i = windows.size() - 1; i >= 0; i--) {
                            WindowState w = windows.get(i);
                            if (w.mHasSurface) {
                                mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs);
                                mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs, w.mAttachedWindow);
                            }
                        }
                        displayContent.pendingLayoutChanges |= mPolicy.finishPostLayoutPolicyLw();