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

Commit aa806144 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix status bar window IME flags & layout

When bouncer was showing, but keyguard was occluded, staus bar
window couldn't receive input, and thus the IME window was placed
below the status bar window. In addition to that, fix the layout when
IME is showing up on the bouncer screen.

Bug: 19969474
Change-Id: I38d21647801b57608d49c3f525d4840e6ba58296
parent 06302c22
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ public class StatusBarWindowManager {

    private void applyFocusableFlag(State state) {
        boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
        if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
                && state.bouncerShowing || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
        if (state.keyguardShowing && state.keyguardNeedsInput && state.bouncerShowing
                || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
        } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
+4 −1
Original line number Diff line number Diff line
@@ -67,8 +67,10 @@ public class StatusBarWindowView extends FrameLayout {
                    || insets.top != getPaddingTop()
                    || insets.right != getPaddingRight()
                    || insets.bottom != getPaddingBottom();

            // Drop top inset, apply right and left inset and pass through bottom inset.
            if (changed) {
                setPadding(insets.left, insets.top, insets.right, 0);
                setPadding(insets.left, 0, insets.right, 0);
            }
            insets.left = 0;
            insets.top = 0;
@@ -81,6 +83,7 @@ public class StatusBarWindowView extends FrameLayout {
            if (changed) {
                setPadding(0, 0, 0, 0);
            }
            insets.top = 0;
        }
        return false;
    }
+14 −5
Original line number Diff line number Diff line
@@ -3642,15 +3642,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private boolean canReceiveInput(WindowState win) {
        boolean notFocusable =
                (win.getAttrs().flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) != 0;
        boolean altFocusableIm =
                (win.getAttrs().flags & WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) != 0;
        boolean notFocusableForIm = notFocusable ^ altFocusableIm;
        return !notFocusableForIm;
    }

    /** {@inheritDoc} */
    @Override
    public void layoutWindowLw(WindowState win, WindowState attached) {
        // we've already done the status bar
        final WindowManager.LayoutParams attrs = win.getAttrs();
        if ((win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) == 0) ||
                win == mNavigationBar) {
        // We've already done the navigation bar and status bar. If the status bar can receive
        // input, we need to layout it again to accomodate for the IME window.
        if ((win == mStatusBar && !canReceiveInput(win)) || win == mNavigationBar) {
            return;
        }
        final WindowManager.LayoutParams attrs = win.getAttrs();
        final boolean isDefaultDisplay = win.isDefaultDisplay();
        final boolean needsToOffsetInputMethodTarget = isDefaultDisplay &&
                (win == mLastInputMethodTargetWindow && mLastInputMethodWindow != null);
@@ -3717,7 +3726,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    + mUnrestrictedScreenHeight;
            cf.bottom = vf.bottom = mStableBottom;
            cf.top = vf.top = mStableTop;
        } else if (win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
        } else if (win == mStatusBar) {
            pf.left = df.left = of.left = mUnrestrictedScreenLeft;
            pf.top = df.top = of.top = mUnrestrictedScreenTop;
            pf.right = df.right = of.right = mUnrestrictedScreenWidth + mUnrestrictedScreenLeft;