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

Commit 19cdd09a authored by Robert Carr's avatar Robert Carr
Browse files

WindowManager: Use WindowSurfaceController for seamless rotation

Otherwise we run in to the issues with the cache when exiting
seamless rotation.

Bug: 72038766
Test: Manual. go/wm-smoke
Change-Id: Ife50c3d3a77fbcfe9d8a7ef40c45444bbb8b4e93
parent efc7570b
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1457,11 +1457,9 @@ class WindowStateAnimator {
        float DsDy = mService.mTmpFloats[Matrix.MSCALE_Y];
        float nx = mService.mTmpFloats[Matrix.MTRANS_X];
        float ny = mService.mTmpFloats[Matrix.MTRANS_Y];
        t.setPosition(mSurfaceController.mSurfaceControl, nx, ny);
        t.setMatrix(mSurfaceController.mSurfaceControl, DsDx * w.mHScale,
                DtDx * w.mVScale,
                DtDy * w.mHScale,
                DsDy * w.mVScale);
        mSurfaceController.setPosition(t, nx, ny, false);
        mSurfaceController.setMatrix(t, DsDx * w.mHScale, DtDx * w.mVScale, DtDy
                * w.mHScale, DsDy * w.mVScale, false);
    }

    /** The force-scaled state for a given window can persist past
+20 −3
Original line number Diff line number Diff line
@@ -242,6 +242,11 @@ class WindowSurfaceController {
    }

    void setPositionInTransaction(float left, float top, boolean recoveringMemory) {
        setPosition(null, left, top, recoveringMemory);
    }

    void setPosition(SurfaceControl.Transaction t, float left, float top,
            boolean recoveringMemory) {
        final boolean surfaceMoved = mSurfaceX != left || mSurfaceY != top;
        if (surfaceMoved) {
            mSurfaceX = left;
@@ -251,7 +256,11 @@ class WindowSurfaceController {
                if (SHOW_TRANSACTIONS) logSurface(
                        "POS (setPositionInTransaction) @ (" + left + "," + top + ")", null);

                if (t == null) {
                    mSurfaceControl.setPosition(left, top);
                } else {
                    t.setPosition(mSurfaceControl, left, top);
                }
            } catch (RuntimeException e) {
                Slog.w(TAG, "Error positioning surface of " + this
                        + " pos=(" + left + "," + top + ")", e);
@@ -268,6 +277,11 @@ class WindowSurfaceController {

    void setMatrixInTransaction(float dsdx, float dtdx, float dtdy, float dsdy,
            boolean recoveringMemory) {
        setMatrix(null, dsdx, dtdx, dtdy, dsdy, false);
    }

    void setMatrix(SurfaceControl.Transaction t, float dsdx, float dtdx,
            float dtdy, float dsdy, boolean recoveringMemory) {
        final boolean matrixChanged = mLastDsdx != dsdx || mLastDtdx != dtdx ||
                                      mLastDtdy != dtdy || mLastDsdy != dsdy;
        if (!matrixChanged) {
@@ -282,8 +296,11 @@ class WindowSurfaceController {
        try {
            if (SHOW_TRANSACTIONS) logSurface(
                    "MATRIX [" + dsdx + "," + dtdx + "," + dtdy + "," + dsdy + "]", null);
            mSurfaceControl.setMatrix(
                    dsdx, dtdx, dtdy, dsdy);
            if (t == null) {
                mSurfaceControl.setMatrix(dsdx, dtdx, dtdy, dsdy);
            } else {
                t.setMatrix(mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
            }
        } catch (RuntimeException e) {
            // If something goes wrong with the surface (such
            // as running out of memory), don't take down the