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

Commit 1c13ad3d authored by chaviw's avatar chaviw
Browse files

Don't keep current IME target if it's being removed.

There's logic in place to continue using the old IME target if it's in
the process of animating tot exit and the next IME target is going to the
launcher. This is to prevent the IME from flickering by jumping to the
launcher in the middle of closing.

However, the IME target also gets recalculated when the old IME target
window is removed. If the new target ends up being the launcher, then
the old logic would prevent the IME target from getting updated since it
still considers the window being removed as animating to exit. This
change adds another check to make sure that we don't consider removed
windows when deciding if the IME target should stay the same.

Change-Id: I3722c2ff22865f408a5dc5872a36002a5991ff1c
Fixes: 109875368
Test: Repro steps from bug
parent 79e27cd2
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -2507,11 +2507,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        if (DEBUG_INPUT_METHOD && updateImeTarget) Slog.v(TAG_WM,
                "Proposed new IME target: " + target);

        // Now, a special case -- if the last target's window is in the process of exiting, and the
        // new target is home, keep on the last target to avoid flicker. Home is a special case
        // since its above other stacks in the ordering list, but layed out below the others.
        if (curTarget != null && curTarget.isDisplayedLw() && curTarget.isClosing()
                && (target == null || target.isActivityTypeHome())) {
        // Now, a special case -- if the last target's window is in the process of exiting, but
        // not removed, and the new target is home, keep on the last target to avoid flicker.
        // Home is a special case since its above other stacks in the ordering list, but layed
        // out below the others.
        if (curTarget != null && !curTarget.mRemoved && curTarget.isDisplayedLw()
                && curTarget.isClosing() && (target == null || target.isActivityTypeHome())) {
            if (DEBUG_INPUT_METHOD) Slog.v(TAG_WM, "New target is home while current target is "
                    + "closing, not changing");
            return curTarget;