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

Commit d7e4acba authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Ensure Surface matrix set even when size unchanged."

parents d1a668fd e1034cc3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1225,10 +1225,11 @@ class WindowStateAnimator {
        calculateSurfaceBounds(w, w.getAttrs());

        mSurfaceController.setPositionInTransaction(mTmpSize.left, mTmpSize.top, recoveringMemory);

        mSurfaceController.setMatrixInTransaction(mDsDx * w.mHScale, mDtDx * w.mVScale,
                mDsDy * w.mHScale, mDtDy * w.mVScale, recoveringMemory);
        mSurfaceResized = mSurfaceController.setSizeInTransaction(
                mTmpSize.width(), mTmpSize.height(),
                mDsDx * w.mHScale, mDtDx * w.mVScale,
                mDsDy * w.mHScale, mDtDy * w.mVScale,
                recoveringMemory);

        if (mSurfaceResized) {
+20 −3
Original line number Diff line number Diff line
@@ -190,8 +190,27 @@ class WindowSurfaceController {
        }
    }

    boolean setSizeInTransaction(int width, int height, float dsdx, float dtdx, float dsdy, float dtdy,
    void setMatrixInTransaction(float dsdx, float dtdx, float dsdy, float dtdy,
            boolean recoveringMemory) {
        try {
            if (SHOW_TRANSACTIONS) logSurface(
                    "MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
            mSurfaceControl.setMatrix(
                    dsdx, dtdx, dsdy, dtdy);
        } catch (RuntimeException e) {
            // If something goes wrong with the surface (such
            // as running out of memory), don't take down the
            // entire system.
            Slog.e(TAG, "Error setting matrix on surface surface" + title
                    + " MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
            if (!recoveringMemory) {
                mAnimator.reclaimSomeSurfaceMemory("matrix", true);
            }
        }
        return;
    }

    boolean setSizeInTransaction(int width, int height, boolean recoveringMemory) {
        final boolean surfaceResized = mSurfaceW != width || mSurfaceH != height;
        if (surfaceResized) {
            mSurfaceW = width;
@@ -201,8 +220,6 @@ class WindowSurfaceController {
                if (SHOW_TRANSACTIONS) logSurface(
                        "SIZE " + width + "x" + height, null);
                mSurfaceControl.setSize(width, height);
                mSurfaceControl.setMatrix(
                        dsdx, dtdx, dsdy, dtdy);
            } catch (RuntimeException e) {
                // If something goes wrong with the surface (such
                // as running out of memory), don't take down the