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

Commit 80fd2c2d authored by Craig Mautner's avatar Craig Mautner Committed by The Android Automerger
Browse files

Do not assign InputMethod to non-input windows.

The InputMethod window was being assigned to the bottommost
window as a fall-through situation when no window could receive
input. This fix changes that so that if the bottommost window
cannot receive IME input then the InputMethod will be unassigned.

In most ANRs associated with bug 10689184 mInputMethodTarget
was assigned to the Wallpaper window and the InputMethod was
placed directly above it. When the ANR occurred the window that
was awaiting focused was then always placed immediately above the
InputMethod. This fix will keep that situation from happening.

Change-Id: Ic247e8132a907f2712a9f8a89e43c099142ec851
parent 56a28f70
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -1185,16 +1185,15 @@ public class WindowManagerService extends IWindowManager.Stub
        // same display. Or even when the current IME/target are not on the same screen as the next
        // same display. Or even when the current IME/target are not on the same screen as the next
        // IME/target. For now only look for input windows on the main screen.
        // IME/target. For now only look for input windows on the main screen.
        WindowList windows = getDefaultWindowListLocked();
        WindowList windows = getDefaultWindowListLocked();
        final int N = windows.size();
        WindowState w = null;
        WindowState w = null;
        int i = N;
        int i;
        while (i > 0) {
        for (i = windows.size() - 1; i >= 0; --i) {
            i--;
            WindowState win = windows.get(i);
            w = windows.get(i);


            if (DEBUG_INPUT_METHOD && willMove) Slog.i(TAG, "Checking window @" + i
            if (DEBUG_INPUT_METHOD && willMove) Slog.i(TAG, "Checking window @" + i
                    + " " + w + " fl=0x" + Integer.toHexString(w.mAttrs.flags));
                    + " " + win + " fl=0x" + Integer.toHexString(win.mAttrs.flags));
            if (canBeImeTarget(w)) {
            if (canBeImeTarget(win)) {
                w = win;
                //Slog.i(TAG, "Putting input method here!");
                //Slog.i(TAG, "Putting input method here!");


                // Yet more tricksyness!  If this window is a "starting"
                // Yet more tricksyness!  If this window is a "starting"