WinodowStateAnimator: Remove mD(s|t)d(x|y)

They are always either 1 or 0 and so there is no use. We also fix a bug
in WindowState#getTransformationMatrix where the value should be equal
to mGlobalScale (or at least it was in previous releases).

Bug: 161937501
Test: Existing tests pass
Change-Id: I8ecc88b6be6b4d9b87bc43a1e0319f33b589b46e
This commit is contained in:
Robert Carr
2021-04-05 15:31:15 -07:00
committed by Rob Carr
parent 194d95b130
commit a0a082b8c9
2 changed files with 19 additions and 41 deletions

View File

@@ -5175,10 +5175,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* @param outMatrix Matrix to fill in the transformation.
*/
void getTransformationMatrix(float[] float9, Matrix outMatrix) {
float9[Matrix.MSCALE_X] = mWinAnimator.mDsDx;
float9[Matrix.MSKEW_Y] = mWinAnimator.mDtDx;
float9[Matrix.MSKEW_X] = mWinAnimator.mDtDy;
float9[Matrix.MSCALE_Y] = mWinAnimator.mDsDy;
float9[Matrix.MSCALE_X] = mGlobalScale;
float9[Matrix.MSKEW_Y] = 0;
float9[Matrix.MSKEW_X] = 0;
float9[Matrix.MSCALE_Y] = mGlobalScale;
transformSurfaceInsetsPosition(mTmpPoint, mAttrs.surfaceInsets);
int x = mSurfacePosition.x + mTmpPoint.x;
int y = mSurfacePosition.y + mTmpPoint.y;

View File

@@ -125,11 +125,6 @@ class WindowStateAnimator {
*/
private final Rect mSystemDecorRect = new Rect();
float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1;
private float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1;
boolean mHaveMatrix;
// Set to true if, when the window gets displayed, it should perform
// an enter animation.
boolean mEnterAnimationPending;
@@ -478,11 +473,6 @@ class WindowStateAnimator {
}
mShownAlpha = mAlpha;
mHaveMatrix = false;
mDsDx = 1;
mDtDx = 0;
mDtDy = 0;
mDsDy = 1;
}
private boolean isInBlastSync() {
@@ -522,10 +512,10 @@ class WindowStateAnimator {
// Wallpaper is already updated above when calling setWallpaperPositionAndScale so
// we only need to consider the non-wallpaper case here.
mSurfaceController.setMatrix(t,
mDsDx * w.mHScale,
mDtDx * w.mVScale,
mDtDy * w.mHScale,
mDsDy * w.mVScale);
w.mHScale,
w.mVScale,
w.mHScale,
w.mVScale);
} else {
setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
}
@@ -585,25 +575,17 @@ class WindowStateAnimator {
"Orientation change skips hidden %s", w);
}
} else if (mLastAlpha != mShownAlpha
|| mLastDsDx != mDsDx
|| mLastDtDx != mDtDx
|| mLastDsDy != mDsDy
|| mLastDtDy != mDtDy
|| w.mLastHScale != w.mHScale
|| w.mLastVScale != w.mVScale
|| mLastHidden) {
displayed = true;
mLastAlpha = mShownAlpha;
mLastDsDx = mDsDx;
mLastDtDx = mDtDx;
mLastDsDy = mDsDy;
mLastDtDy = mDtDy;
w.mLastHScale = w.mHScale;
w.mLastVScale = w.mVScale;
ProtoLog.i(WM_SHOW_TRANSACTIONS,
"SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
mSurfaceController, mShownAlpha, mDsDx, w.mHScale, mDtDx, w.mVScale,
mDtDy, w.mHScale, mDsDy, w.mVScale, w);
mSurfaceController, mShownAlpha, w.mHScale, w.mVScale,
w.mHScale, w.mVScale, w);
boolean prepared = true;
@@ -612,10 +594,10 @@ class WindowStateAnimator {
} else {
prepared =
mSurfaceController.prepareToShowInTransaction(t, mShownAlpha,
mDsDx * w.mHScale,
mDtDx * w.mVScale,
mDtDy * w.mHScale,
mDsDy * w.mVScale
w.mHScale,
w.mVScale,
w.mHScale,
w.mVScale
);
}
@@ -712,10 +694,10 @@ class WindowStateAnimator {
mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
mWin.mTmpMatrixArray[MTRANS_Y]);
mSurfaceController.setMatrix(t,
mDsDx * mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
mDtDx * mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
mDtDy * mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
mDsDy * mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
}
/**
@@ -917,12 +899,8 @@ class WindowStateAnimator {
pw.print(" mAlpha="); pw.print(mAlpha);
pw.print(" mLastAlpha="); pw.println(mLastAlpha);
}
if (mHaveMatrix || mWin.mGlobalScale != 1) {
if (mWin.mGlobalScale != 1) {
pw.print(prefix); pw.print("mGlobalScale="); pw.print(mWin.mGlobalScale);
pw.print(" mDsDx="); pw.print(mDsDx);
pw.print(" mDtDx="); pw.print(mDtDx);
pw.print(" mDtDy="); pw.print(mDtDy);
pw.print(" mDsDy="); pw.println(mDsDy);
}
}