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

Commit 782d1037 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix IME target after rotation

When rotating the screen, and the top activity relaunches, it will
add a new window and make it visible. However, we never run an app
transition, so any of the calls to computeImeTarget in there don't
run. Initially, isVisibleOrAdding will return false because the
client adds it with INVISIBLE, and then relayouts it. However,
after adding it there will never be a call anymore to
computeImeTarget, so we add a separate call when a window becomes
visible.

This is a really targeted fix to a broken concept (the way how we
guess the IME target) that has to be revisited very soon.

Test: go/wm-smoke
Test: Open Gmail compose, open status bar, rotate screen, ensure
that IME ordering is correct in "dumpsys window visible".

Change-Id: I345b535cd531dbd8955e9a4cde2b87f0b7f41a88
Fixes: 75007549
parent 706fbe7e
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1899,7 +1899,15 @@ public class WindowManagerService extends IWindowManager.Stub
                winAnimator.setOpaqueLocked(false);
            }

            boolean imMayMove = (flagChanges & (FLAG_ALT_FOCUSABLE_IM | FLAG_NOT_FOCUSABLE)) != 0;
            final int oldVisibility = win.mViewVisibility;

            // If the window is becoming visible, visibleOrAdding may change which may in turn
            // change the IME target.
            final boolean becameVisible =
                    (oldVisibility == View.INVISIBLE || oldVisibility == View.GONE)
                            && viewVisibility == View.VISIBLE;
            boolean imMayMove = (flagChanges & (FLAG_ALT_FOCUSABLE_IM | FLAG_NOT_FOCUSABLE)) != 0
                    || becameVisible;
            final boolean isDefaultDisplay = win.isDefaultDisplay();
            boolean focusMayChange = isDefaultDisplay && (win.mViewVisibility != viewVisibility
                    || ((flagChanges & FLAG_NOT_FOCUSABLE) != 0)
@@ -1915,7 +1923,6 @@ public class WindowManagerService extends IWindowManager.Stub
            win.mRelayoutCalled = true;
            win.mInRelayout = true;

            final int oldVisibility = win.mViewVisibility;
            win.mViewVisibility = viewVisibility;
            if (DEBUG_SCREEN_ON) {
                RuntimeException stack = new RuntimeException();