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

Commit 73abde9d authored by chaviw's avatar chaviw
Browse files

Force reportResized when useBlastSync enabled

We need to always reportResized if using blastSync since the window
waiting on a finishDrawing from the client. Therefore, always add the
window to the resizing list even if bounds have not changed.

Test: WindowStateTests#testRequestResizeForBlastSync
Bug: 153579514
Change-Id: I87b459d95fac315b9a25f2d8e989fe3aaf0c0c85
parent 20467761
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -334,6 +334,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    private boolean mDragResizing;
    private boolean mDragResizingChangeReported = true;
    private int mResizeMode;
    private boolean mResizeForBlastSyncReported;

    /**
     * Special mode that is intended only for the rounded corner overlay: during rotation
     * transition, we un-rotate the window token such that the window appears as it did before the
@@ -1370,11 +1372,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // variables, because mFrameSizeChanged only tracks the width and height changing.
        updateLastFrames();

        // Add a window that is using blastSync to the resizing list if it hasn't been reported
        // already. This because the window is waiting on a finishDrawing from the client.
        if (didFrameInsetsChange
                || winAnimator.mSurfaceResized
                || configChanged
                || dragResizingChanged
                || mReportOrientationChanged) {
                || mReportOrientationChanged
                || requestResizeForBlastSync()) {
            ProtoLog.v(WM_DEBUG_RESIZE,
                        "Resize reasons for w=%s:  %s surfaceResized=%b configChanged=%b "
                                + "dragResizingChanged=%b reportOrientationChanged=%b",
@@ -3483,6 +3488,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mReportOrientationChanged = false;
        mDragResizingChangeReported = true;
        mWinAnimator.mSurfaceResized = false;
        mResizeForBlastSyncReported = true;
        mWindowFrames.resetInsetsChanged();

        final Rect frame = mWindowFrames.mCompatFrame;
@@ -5733,6 +5739,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (!willSync) {
            return false;
        }
        mResizeForBlastSyncReported = false;

        mLocalSyncId = mBLASTSyncEngine.startSyncSet(this);
        addChildrenToSyncSet(mLocalSyncId);
@@ -5777,4 +5784,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mWaitingListener = null;
        return mWinAnimator.finishDrawingLocked(null);
    }

    private boolean requestResizeForBlastSync() {
        return useBLASTSync() && !mResizeForBlastSyncReported;
    }
}
+23 −0
Original line number Diff line number Diff line
@@ -602,6 +602,29 @@ public class WindowStateTests extends WindowTestsBase {
        assertFalse(win.getOrientationChanging());
    }

    @Test
    public void testRequestResizeForBlastSync() {
        final WindowState win = mChildAppWindowAbove;
        makeWindowVisible(win, win.getParentWindow());
        win.mLayoutSeq = win.getDisplayContent().mLayoutSeq;
        win.reportResized();
        win.updateResizingWindowIfNeeded();
        assertThat(mWm.mResizingWindows).doesNotContain(win);

        // Check that the window is in resizing if using blast sync.
        win.reportResized();
        win.prepareForSync(mock(BLASTSyncEngine.TransactionReadyListener.class), 1);
        win.updateResizingWindowIfNeeded();
        assertThat(mWm.mResizingWindows).contains(win);

        // Don't re-add the window again if it's been reported to the client and still waiting on
        // the client draw for blast sync.
        win.reportResized();
        mWm.mResizingWindows.remove(win);
        win.updateResizingWindowIfNeeded();
        assertThat(mWm.mResizingWindows).doesNotContain(win);
    }

    @Test
    public void testGetTransformationMatrix() {
        final int PARENT_WINDOW_OFFSET = 1;