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

Commit df4a94e2 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Fix incorrect indexing calculation." into jb-mr1-dev

parents cd664f0f efb735db
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -887,6 +887,12 @@ public class WindowManagerService extends IWindowManager.Stub
        return -1;
    }

    /**
     * Return the list of Windows from the passed token on the given Display.
     * @param token The token with all the windows.
     * @param displayContent The display we are interested in.
     * @return List of windows from token that are on displayContent.
     */
    WindowList getTokenWindowsOnDisplay(WindowToken token, DisplayContent displayContent) {
        final WindowList windowList = new WindowList();
        final int count = token.windows.size();
@@ -928,7 +934,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        WindowState lastWindow = tokenWindowList.get(index);
                        if (atoken != null && lastWindow == atoken.startingWindow) {
                            placeWindowBefore(lastWindow, win);
                            tokenWindowsPos = token.windows.indexOf(lastWindow) - 1;
                            tokenWindowsPos = token.windows.indexOf(lastWindow);
                        } else {
                            int newIdx = findIdxBasedOnAppTokens(win);
                            //there is a window above this one associated with the same
@@ -940,7 +946,12 @@ public class WindowManagerService extends IWindowManager.Stub
                                        + (newIdx + 1) + " of " + N);
                            }
                            windows.add(newIdx + 1, win);
                            if (newIdx < 0) {
                                // No window from token found on win's display.
                                tokenWindowsPos = 0;
                            } else {
                                tokenWindowsPos = token.windows.indexOf(windows.get(newIdx)) + 1;
                            }
                            mWindowsChanged = true;
                        }
                    }