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

Commit 81e9aedb authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Merge WindowSurfaceController to WindowStateAnimator

The class is only an additional wrapper that is simple enough to
be merged into WindowStateAnimator.

This is a less aggressive removal which keeps original code shape
if possible. There is no behavior change.

Bug: 308662081
Flag: EXEMPT move code
Test: atest WmTests

Change-Id: I8f9319b905d9ce2c9a4a9f7c04eb37547ce252f3
parent 9a70da4e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7187,7 +7187,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawn()
                        + ", isAnimationSet=" + isAnimationSet);
                if (!w.isDrawn()) {
                    Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController
                    Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceControl
                            + " pv=" + w.isVisibleByPolicy()
                            + " mDrawState=" + winAnimator.drawStateToString()
                            + " ph=" + w.isParentWindowHidden() + " th=" + mVisibleRequested
+3 −3
Original line number Diff line number Diff line
@@ -4082,12 +4082,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        final Transaction t = mWmService.mTransactionFactory.get();
        forAllWindows(w -> {
            final WindowStateAnimator wsa = w.mWinAnimator;
            if (wsa.mSurfaceController == null) {
            if (wsa.mSurfaceControl == null) {
                return;
            }
            if (!mWmService.mSessions.contains(wsa.mSession)) {
                Slog.w(TAG_WM, "LEAKED SURFACE (session doesn't exist): "
                        + w + " surface=" + wsa.mSurfaceController
                        + w + " surface=" + wsa.mSurfaceControl
                        + " token=" + w.mToken
                        + " pid=" + w.mSession.mPid
                        + " uid=" + w.mSession.mUid);
@@ -4096,7 +4096,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                mTmpWindow = w;
            } else if (w.mActivityRecord != null && !w.mActivityRecord.isClientVisible()) {
                Slog.w(TAG_WM, "LEAKED SURFACE (app token hidden): "
                        + w + " surface=" + wsa.mSurfaceController
                        + w + " surface=" + wsa.mSurfaceControl
                        + " token=" + w.mActivityRecord);
                ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE LEAK DESTROY: %s", w);
                wsa.destroySurface(t);
+2 −2
Original line number Diff line number Diff line
@@ -623,7 +623,7 @@ final class InputMonitor {
                    // occlusion detection depending on the type or if it's a trusted overlay.
                    populateOverlayInputInfo(inputWindowHandle, w);
                    setInputWindowInfoIfNeeded(mInputTransaction,
                            w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle);
                            w.mWinAnimator.mSurfaceControl, inputWindowHandle);
                    return;
                }
                // Skip this window because it cannot possibly receive input.
@@ -687,7 +687,7 @@ final class InputMonitor {
            if (w.mWinAnimator.hasSurface()) {
                populateInputWindowHandle(inputWindowHandle, w);
                setInputWindowInfoIfNeeded(mInputTransaction,
                        w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle);
                        w.mWinAnimator.mSurfaceControl, inputWindowHandle);
            }
        }
    }
+3 −3
Original line number Diff line number Diff line
@@ -667,7 +667,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

    boolean reclaimSomeSurfaceMemory(WindowStateAnimator winAnimator, String operation,
            boolean secure) {
        final WindowSurfaceController surfaceController = winAnimator.mSurfaceController;
        final SurfaceControl surfaceControl = winAnimator.mSurfaceControl;
        boolean leakedSurface = false;
        boolean killedApps = false;
        EventLogTags.writeWmNoSurfaceMemory(winAnimator.mWin.toString(),
@@ -692,7 +692,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                            return;
                        }
                        final WindowStateAnimator wsa = w.mWinAnimator;
                        if (wsa.mSurfaceController != null) {
                        if (wsa.mSurfaceControl != null) {
                            pidCandidates.append(wsa.mSession.mPid, wsa.mSession.mPid);
                        }
                    }, false /* traverseTopToBottom */);
@@ -717,7 +717,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                // app to request another one.
                Slog.w(TAG_WM,
                        "Looks like we have reclaimed some memory, clearing surface for retry.");
                if (surfaceController != null) {
                if (surfaceControl != null) {
                    ProtoLog.i(WM_SHOW_SURFACE_ALLOC,
                            "SURFACE RECOVER DESTROY: %s", winAnimator.mWin);
                    SurfaceControl.Transaction t = mWmService.mTransactionFactory.get();
+1 −1
Original line number Diff line number Diff line
@@ -324,7 +324,7 @@ class ScreenRotationAnimation {
            if (!w.mToken.mRoundedCornerOverlay || !w.isVisible() || !w.mWinAnimator.hasSurface()) {
                return;
            }
            t.setSkipScreenshot(w.mWinAnimator.mSurfaceController.mSurfaceControl, skipScreenshot);
            t.setSkipScreenshot(w.mWinAnimator.mSurfaceControl, skipScreenshot);
        }, false);
        if (!skipScreenshot) {
            // Use sync apply to apply the change immediately, so that the next
Loading