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

Commit dae3d40c authored by Robert Carr's avatar Robert Carr Committed by Rob Carr
Browse files

WindowStateAnimator: Move HScale/VScale application to WindowState

We need to avoid calling setMatrix on WindowStateAnimator so we
don't fight with the BLASTBufferQueue.

Bug: 161937501
Test: Existing tests pass
Change-Id: I28ac9a2d1501caaea674fc31979b60b71486b602
parent a0a082b8
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -193,6 +193,12 @@
      "group": "WM_ERROR",
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    },
    "-1906387645": {
      "message": "SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s",
      "level": "INFO",
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowStateAnimator.java"
    },
    "-1905191109": {
    "-1905191109": {
      "message": "SyncGroup %d: Finished!",
      "message": "SyncGroup %d: Finished!",
      "level": "VERBOSE",
      "level": "VERBOSE",
@@ -3283,12 +3289,6 @@
      "group": "WM_DEBUG_ORIENTATION",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    },
    "1747941491": {
      "message": "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
      "level": "INFO",
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowStateAnimator.java"
    },
    "1756082882": {
    "1756082882": {
      "message": "Orientation change skips hidden %s",
      "message": "Orientation change skips hidden %s",
      "level": "VERBOSE",
      "level": "VERBOSE",
+7 −4
Original line number Original line Diff line number Diff line
@@ -5354,11 +5354,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
        }
    }
    }


    private void updateGlobalScaleIfNeeded() {
    private void updateScaleIfNeeded() {
        if (mLastGlobalScale != mGlobalScale) {
        if (mLastGlobalScale != mGlobalScale || mLastHScale != mHScale ||
            mLastVScale != mVScale ) {
            getPendingTransaction().setMatrix(getSurfaceControl(),
            getPendingTransaction().setMatrix(getSurfaceControl(),
                mGlobalScale, 0, 0, mGlobalScale);
                mGlobalScale*mHScale, 0, 0, mGlobalScale*mVScale);
            mLastGlobalScale = mGlobalScale;
            mLastGlobalScale = mGlobalScale;
            mLastHScale = mHScale;
            mLastVScale = mVScale;
        }
        }
    }
    }


@@ -5369,7 +5372,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        updateSurfacePositionNonOrganized();
        updateSurfacePositionNonOrganized();
        // Send information to SufaceFlinger about the priority of the current window.
        // Send information to SufaceFlinger about the priority of the current window.
        updateFrameRateSelectionPriorityIfNeeded();
        updateFrameRateSelectionPriorityIfNeeded();
        if (isVisibleRequested()) updateGlobalScaleIfNeeded();
        if (isVisibleRequested()) updateScaleIfNeeded();


        mWinAnimator.prepareSurfaceLocked(getSyncTransaction());
        mWinAnimator.prepareSurfaceLocked(getSyncTransaction());
        super.prepareSurfaces();
        super.prepareSurfaces();
+7 −25
Original line number Original line Diff line number Diff line
@@ -509,13 +509,6 @@ class WindowStateAnimator {
            int yOffset = mYOffset;
            int yOffset = mYOffset;
            if (!mIsWallpaper) {
            if (!mIsWallpaper) {
                mSurfaceController.setPosition(t, xOffset, yOffset);
                mSurfaceController.setPosition(t, xOffset, yOffset);
                // Wallpaper is already updated above when calling setWallpaperPositionAndScale so
                // we only need to consider the non-wallpaper case here.
                mSurfaceController.setMatrix(t,
                        w.mHScale,
                        w.mVScale,
                        w.mHScale,
                        w.mVScale);
            } else {
            } else {
                setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
                setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
            }
            }
@@ -575,17 +568,12 @@ class WindowStateAnimator {
                        "Orientation change skips hidden %s", w);
                        "Orientation change skips hidden %s", w);
            }
            }
        } else if (mLastAlpha != mShownAlpha
        } else if (mLastAlpha != mShownAlpha
                || w.mLastHScale != w.mHScale
                || w.mLastVScale != w.mVScale
                || mLastHidden) {
                || mLastHidden) {
            displayed = true;
            displayed = true;
            mLastAlpha = mShownAlpha;
            mLastAlpha = mShownAlpha;
            w.mLastHScale = w.mHScale;
            w.mLastVScale = w.mVScale;
            ProtoLog.i(WM_SHOW_TRANSACTIONS,
            ProtoLog.i(WM_SHOW_TRANSACTIONS,
                    "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
                    "SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s",
                            mSurfaceController, mShownAlpha, w.mHScale, w.mVScale,
                    mSurfaceController, mShownAlpha, w.mHScale, w.mVScale, w);
                            w.mHScale, w.mVScale, w);


            boolean prepared = true;
            boolean prepared = true;


@@ -593,12 +581,7 @@ class WindowStateAnimator {
                setWallpaperPositionAndScale(t, mXOffset, mYOffset, mWallpaperScale);
                setWallpaperPositionAndScale(t, mXOffset, mYOffset, mWallpaperScale);
            } else {
            } else {
                prepared =
                prepared =
                    mSurfaceController.prepareToShowInTransaction(t, mShownAlpha,
                    mSurfaceController.prepareToShowInTransaction(t, mShownAlpha);
                        w.mHScale,
                        w.mVScale,
                        w.mHScale,
                        w.mVScale
                    );
            }
            }


            if (prepared && mDrawState == HAS_DRAWN) {
            if (prepared && mDrawState == HAS_DRAWN) {
@@ -693,11 +676,10 @@ class WindowStateAnimator {


        mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
        mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
                mWin.mTmpMatrixArray[MTRANS_Y]);
                mWin.mTmpMatrixArray[MTRANS_Y]);
        mSurfaceController.setMatrix(t,
        mSurfaceController.setMatrix(t, mWin.mTmpMatrixArray[MSCALE_X],
                mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
            mWin.mTmpMatrixArray[MSKEW_Y],
                mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
            mWin.mTmpMatrixArray[MSKEW_X],
                mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
            mWin.mTmpMatrixArray[MSCALE_Y]);
                mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
    }
    }


    /**
    /**
+1 −7
Original line number Original line Diff line number Diff line
@@ -178,19 +178,13 @@ class WindowSurfaceController {
        t.setMatrix(mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
        t.setMatrix(mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
    }
    }


    boolean prepareToShowInTransaction(SurfaceControl.Transaction t, float alpha, float dsdx,
    boolean prepareToShowInTransaction(SurfaceControl.Transaction t, float alpha) {
            float dtdx, float dsdy, float dtdy) {
        if (mSurfaceControl == null) {
        if (mSurfaceControl == null) {
            return false;
            return false;
        }
        }


        mSurfaceAlpha = alpha;
        mSurfaceAlpha = alpha;
        t.setAlpha(mSurfaceControl, alpha);
        t.setAlpha(mSurfaceControl, alpha);
        mLastDsdx = dsdx;
        mLastDtdx = dtdx;
        mLastDsdy = dsdy;
        mLastDtdy = dtdy;
        t.setMatrix(mSurfaceControl, dsdx, dtdx, dsdy, dtdy);
        return true;
        return true;
    }
    }