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

Commit 4551c8bb authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

WindowList be gone!

The use of DisplayContent.mWindow list to track all windows is
no longer needed as we can now get windows through the window
container hierarchy with methods like forAllWindows. The window
list was also a very complicated logic to understand and maintain,
so it won't be missed :)

Bug: 30060889
Test: Existing tests pass
Change-Id: I590cb33aa0f42bcd4a26ddce102f05e657f54144
parent 6b18e8f5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -411,7 +411,7 @@ public class AppWindowAnimator {
        }
        }
        if (mService.mInputMethodTarget != null
        if (mService.mInputMethodTarget != null
                && mService.mInputMethodTarget.mAppToken == mAppToken) {
                && mService.mInputMethodTarget.mAppToken == mAppToken) {
            mAppToken.getDisplayContent().moveInputMethodWindowsIfNeeded(true);
            mAppToken.getDisplayContent().computeImeTarget(true /* updateImeTarget */);
        }
        }


        if (DEBUG_ANIM) Slog.v(TAG, "Animation done in " + mAppToken
        if (DEBUG_ANIM) Slog.v(TAG, "Animation done in " + mAppToken
+27 −16
Original line number Original line Diff line number Diff line
@@ -1006,10 +1006,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            tStartingWindow.mToken = this;
            tStartingWindow.mToken = this;
            tStartingWindow.mAppToken = this;
            tStartingWindow.mAppToken = this;


            if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,
            if (DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,
                    "Removing starting window: " + tStartingWindow);
            getDisplayContent().removeFromWindowList(tStartingWindow);
            if (DEBUG_ADD_REMOVE) Slog.v(TAG_WM,
                    "Removing starting " + tStartingWindow + " from " + fromToken);
                    "Removing starting " + tStartingWindow + " from " + fromToken);
            fromToken.removeChild(tStartingWindow);
            fromToken.removeChild(tStartingWindow);
            fromToken.postWindowRemoveStartingWindowCleanup(tStartingWindow);
            fromToken.postWindowRemoveStartingWindowCleanup(tStartingWindow);
@@ -1259,18 +1256,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        }
        }
    }
    }


    int rebuildWindowListUnchecked(int addIndex) {
        return super.rebuildWindowList(addIndex);
    }

    @Override
    int rebuildWindowList(int addIndex) {
        if (mIsExiting && !waitingForReplacement()) {
            return addIndex;
        }
        return rebuildWindowListUnchecked(addIndex);
    }

    @Override
    @Override
    boolean forAllWindows(ToBooleanFunction<WindowState> callback, boolean traverseTopToBottom) {
    boolean forAllWindows(ToBooleanFunction<WindowState> callback, boolean traverseTopToBottom) {
        // For legacy reasons we process the TaskStack.mExitingAppTokens first in DisplayContent
        // For legacy reasons we process the TaskStack.mExitingAppTokens first in DisplayContent
@@ -1332,6 +1317,32 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        mLastContainsShowWhenLockedWindow = containsShowWhenLocked;
        mLastContainsShowWhenLockedWindow = containsShowWhenLocked;
    }
    }


    WindowState getImeTargetBelowWindow(WindowState w) {
        final int index = mChildren.indexOf(w);
        if (index > 0) {
            final WindowState target = mChildren.get(index - 1);
            if (target.canBeImeTarget()) {
                return target;
            }
        }
        return null;
    }

    WindowState getHighestAnimLayerWindow(WindowState currentTarget) {
        WindowState candidate = null;
        for (int i = mChildren.indexOf(currentTarget); i >= 0; i--) {
            final WindowState w = mChildren.get(i);
            if (w.mRemoved) {
                continue;
            }
            if (candidate == null || w.mWinAnimator.mAnimLayer >
                    candidate.mWinAnimator.mAnimLayer) {
                candidate = w;
            }
        }
        return candidate;
    }

    @Override
    @Override
    void dump(PrintWriter pw, String prefix) {
    void dump(PrintWriter pw, String prefix) {
        super.dump(pw, prefix);
        super.dump(pw, prefix);
Loading