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

Commit e6f7d505 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fix problems with IME layers.

The query WindowState.isDisplayed did not take into account being
displayed due to app animations.

When an existing input method target was animating away the logic
for detecting if it was still on screen was faulty. This led to
assigning the input method to a layer below its target and obscuring
the input method until the animation was complete.

Bug: 7296703 fixed.
Change-Id: Ib00db4f21b726ed57d25d6a1e796b65a7d45ee97
parent 138f272b
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -1210,12 +1210,9 @@ public class WindowManagerService extends IWindowManager.Stub
        final WindowState curTarget = mInputMethodTarget;
        if (curTarget != null && w != null
                && curTarget.isDisplayedLw()
                && curTarget.mExiting) {
            if (curTarget.mWinAnimator.mAnimLayer > w.mWinAnimator.mAnimLayer) {
                w = curTarget;
                i = windows.indexOf(w);
                if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Current target higher, switching to: " + w);
            }
                && (curTarget.mWinAnimator.mAnimLayer > w.mWinAnimator.mAnimLayer)) {
            if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Current target higher, not changing");
            return windows.indexOf(curTarget) + 1;
        }

        if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Desired input method target="
@@ -4184,6 +4181,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    @Override
    public void setAppStartingWindow(IBinder token, String pkg,
            int theme, CompatibilityInfo compatInfo,
            CharSequence nonLocalizedLabel, int labelRes, int icon,
+4 −1
Original line number Diff line number Diff line
@@ -788,18 +788,21 @@ final class WindowState implements WindowManagerPolicy.WindowState {
     * Like isOnScreen, but returns false if the surface hasn't yet
     * been drawn.
     */
    @Override
    public boolean isDisplayedLw() {
        final AppWindowToken atoken = mAppToken;
        return isDrawnLw() && mPolicyVisibility
            && ((!mAttachedHidden &&
                    (atoken == null || !atoken.hiddenRequested))
                    || mWinAnimator.mAnimating);
                        || mWinAnimator.mAnimating
                        || (atoken != null && atoken.mAppAnimator.animation != null));
    }

    /**
     * Return true if this window (or a window it is attached to, but not
     * considering its app token) is currently animating.
     */
    @Override
    public boolean isAnimatingLw() {
        return mWinAnimator.mAnimation != null;
    }