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

Commit b3847d8e authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Fixed indexOutOfBoundsException in WindowManager

Problem was introduced in ag/1395371 where we were looking through the
wrong list for the wallpaper. We need to look through the DisplayContent
window list which is windowList and not the WindowToken list which is windows.

Bug: 31234488
Change-Id: If8b3d4c00f268525132a0c452a0225c90c9f02b1
parent 5426dc13
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -631,8 +631,8 @@ class WindowToken {
                final int privateFlags = wallpaperTarget.mAttrs.privateFlags;
                if (((privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || type == TYPE_KEYGUARD_SCRIM)
                        && !mService.isKeyguardAnimatingIn()) {
                    insertionIndex = Math.min(windows.indexOf(wallpaperTarget),
                            findLowestWindowOnScreen(windows));
                    insertionIndex = Math.min(windowList.indexOf(wallpaperTarget),
                            findLowestWindowOnScreen(windowList));
                }
            }
            if (DEBUG_WALLPAPER_LIGHT || DEBUG_WINDOW_MOVEMENT
@@ -651,10 +651,10 @@ class WindowToken {
     * @return The index in {@param windows} of the lowest window that is currently on screen and
     *         not hidden by the policy.
     */
    private int findLowestWindowOnScreen(WindowList windows) {
        final int size = windows.size();
    private int findLowestWindowOnScreen(WindowList windowList) {
        final int size = windowList.size();
        for (int index = 0; index < size; index++) {
            final WindowState win = windows.get(index);
            final WindowState win = windowList.get(index);
            if (win.isOnScreen()) {
                return index;
            }