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

Commit cc228067 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed issue with IME window not been added to its window token"

parents 5025bd3a b9a07c3e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1059,6 +1059,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        mService.mWindowsChanged = true;
    }

    void addToWindowList(WindowState win, int index) {
        mWindows.add(index, win);
    }

    void addChildWindowToWindowList(WindowState win) {
        final WindowState parentWindow = win.getParentWindow();

+3 −18
Original line number Diff line number Diff line
@@ -1276,21 +1276,6 @@ public class WindowManagerService extends IWindowManager.Stub
        return -1;
    }

    private void addInputMethodWindowToListLocked(WindowState win) {
        int pos = findDesiredInputMethodWindowIndexLocked(true);
        if (pos >= 0) {
            if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(
                    TAG_WM, "Adding input method window " + win + " at " + pos);
            // TODO(multidisplay): IMEs are only supported on the default display.
            getDefaultWindowListLocked().add(pos, win);
            mWindowsChanged = true;
            moveInputMethodDialogsLocked(pos + 1);
            return;
        }
        win.mToken.addWindow(win);
        moveInputMethodDialogsLocked(pos);
    }

    private void reAddWindowToListInOrderLocked(WindowState win) {
        win.mToken.addWindow(win);
        // This is a hack to get all of the child windows added as well at the right position. Child
@@ -1305,7 +1290,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    void logWindowList(final WindowList windows, String prefix) {
    private void logWindowList(final WindowList windows, String prefix) {
        int N = windows.size();
        while (N > 0) {
            N--;
@@ -1746,7 +1731,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (type == TYPE_INPUT_METHOD) {
                win.mGivenInsetsPending = true;
                mInputMethodWindow = win;
                addInputMethodWindowToListLocked(win);
                win.mToken.addImeWindow(win);
                imMayMove = false;
            } else if (type == TYPE_INPUT_METHOD_DIALOG) {
                mInputMethodDialogs.add(win);
@@ -1980,7 +1965,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    public void removeWindow(Session session, IWindow client) {
    void removeWindow(Session session, IWindow client) {
        synchronized(mWindowMap) {
            WindowState win = windowForClientLocked(session, client, false);
            if (win == null) {
+19 −0
Original line number Diff line number Diff line
@@ -193,6 +193,25 @@ class WindowToken extends WindowContainer<WindowState> {
        }
    }

    void addImeWindow(WindowState win) {
        int pos = mService.findDesiredInputMethodWindowIndexLocked(true);

        if (pos < 0) {
            addWindow(win);
            mService.moveInputMethodDialogsLocked(pos);
            return;
        }

        if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG_WM,
                "Adding input method window " + win + " at " + pos);
        mDisplayContent.addToWindowList(win, pos);
        if (!mChildren.contains(win)) {
            addChild(win, null);
        }
        mService.mWindowsChanged = true;
        mService.moveInputMethodDialogsLocked(pos + 1);
    }

    /** Return the first window in the token window list that isn't a starting window or null. */
    WindowState getFirstNonStartingWindow() {
        final int count = mChildren.size();