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

Commit 52a839de authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am 3351ab27: am f967500e: am 46732445: Merge "Include child windows when...

am 3351ab27: am f967500e: am 46732445: Merge "Include child windows when looking for insertion point." into jb-mr1.1-dev

* commit '3351ab27':
  Include child windows when looking for insertion point.
parents 77c67665 3351ab27
Loading
Loading
Loading
Loading
+25 −3
Original line number Original line Diff line number Diff line
@@ -894,6 +894,27 @@ public class WindowManagerService extends IWindowManager.Stub
        return windowList;
        return windowList;
    }
    }


    /**
     * Recursive search through a WindowList and all of its windows' children.
     * @param targetWin The window to search for.
     * @param windows The list to search.
     * @return The index of win in windows or of the window that is an ancestor of win.
     */
    private int indexOfWinInWindowList(WindowState targetWin, WindowList windows) {
        for (int i = windows.size() - 1; i >= 0; i--) {
            final WindowState w = windows.get(i);
            if (w == targetWin) {
                return i;
            }
            if (!w.mChildWindows.isEmpty()) {
                if (indexOfWinInWindowList(targetWin, w.mChildWindows) >= 0) {
                    return i;
                }
            }
        }
        return -1;
    }

    private void addWindowToListInOrderLocked(WindowState win, boolean addToToken) {
    private void addWindowToListInOrderLocked(WindowState win, boolean addToToken) {
        final IWindow client = win.mClient;
        final IWindow client = win.mClient;
        final WindowToken token = win.mToken;
        final WindowToken token = win.mToken;
@@ -917,13 +938,13 @@ public class WindowManagerService extends IWindowManager.Stub
                        // Base windows go behind everything else.
                        // Base windows go behind everything else.
                        WindowState lowestWindow = tokenWindowList.get(0);
                        WindowState lowestWindow = tokenWindowList.get(0);
                        placeWindowBefore(lowestWindow, win);
                        placeWindowBefore(lowestWindow, win);
                        tokenWindowsPos = token.windows.indexOf(lowestWindow);
                        tokenWindowsPos = indexOfWinInWindowList(lowestWindow, token.windows);
                    } else {
                    } else {
                        AppWindowToken atoken = win.mAppToken;
                        AppWindowToken atoken = win.mAppToken;
                        WindowState lastWindow = tokenWindowList.get(index);
                        WindowState lastWindow = tokenWindowList.get(index);
                        if (atoken != null && lastWindow == atoken.startingWindow) {
                        if (atoken != null && lastWindow == atoken.startingWindow) {
                            placeWindowBefore(lastWindow, win);
                            placeWindowBefore(lastWindow, win);
                            tokenWindowsPos = token.windows.indexOf(lastWindow);
                            tokenWindowsPos = indexOfWinInWindowList(lastWindow, token.windows);
                        } else {
                        } else {
                            int newIdx = findIdxBasedOnAppTokens(win);
                            int newIdx = findIdxBasedOnAppTokens(win);
                            //there is a window above this one associated with the same
                            //there is a window above this one associated with the same
@@ -939,7 +960,8 @@ public class WindowManagerService extends IWindowManager.Stub
                                // No window from token found on win's display.
                                // No window from token found on win's display.
                                tokenWindowsPos = 0;
                                tokenWindowsPos = 0;
                            } else {
                            } else {
                                tokenWindowsPos = token.windows.indexOf(windows.get(newIdx)) + 1;
                                tokenWindowsPos = indexOfWinInWindowList(
                                        windows.get(newIdx), token.windows) + 1;
                            }
                            }
                            mWindowsChanged = true;
                            mWindowsChanged = true;
                        }
                        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    final WindowManager.LayoutParams mAttrs = new WindowManager.LayoutParams();
    final WindowManager.LayoutParams mAttrs = new WindowManager.LayoutParams();
    final DeathRecipient mDeathRecipient;
    final DeathRecipient mDeathRecipient;
    final WindowState mAttachedWindow;
    final WindowState mAttachedWindow;
    final ArrayList<WindowState> mChildWindows = new ArrayList<WindowState>();
    final WindowList mChildWindows = new WindowList();
    final int mBaseLayer;
    final int mBaseLayer;
    final int mSubLayer;
    final int mSubLayer;
    final boolean mLayoutAttached;
    final boolean mLayoutAttached;
+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ class WindowToken {
    AppWindowToken appWindowToken;
    AppWindowToken appWindowToken;


    // All of the windows associated with this token.
    // All of the windows associated with this token.
    final ArrayList<WindowState> windows = new ArrayList<WindowState>();
    final WindowList windows = new WindowList();


    // Is key dispatching paused for this token?
    // Is key dispatching paused for this token?
    boolean paused = false;
    boolean paused = false;