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

Commit 9af095b6 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Winson Chung
Browse files

Fix minor issues with new window animations.

- Fix screen rotation anim by pulling it back to DC.
- Fix surface insets by correcting at WindowState.prepareSurfaces,
and then going into the other direction in the WSA.

Test: Open PopupWindow, observe shadow is not clipping
Test: Rotate screen, ensure the animation is correct
Test: go/wm-smoke
Bug: 64674361
Change-Id: I0e0910a72aa5f06b86d4e90061e4f807fb164316
parent 6c7e5619
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -381,6 +381,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     */
    private final ArrayList<SurfaceControl> mPendingDestroyingSurfaces = new ArrayList<>();

    /** Temporary float array to retrieve 3x3 matrix values. */
    private final float[] mTmpFloats = new float[9];

    private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
        WindowStateAnimator winAnimator = w.mWinAnimator;
        final AppWindowToken atoken = w.mAppToken;
@@ -3777,4 +3780,21 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        }
        mPendingDestroyingSurfaces.clear();
    }

    @Override
    void prepareSurfaces() {
        final ScreenRotationAnimation screenRotationAnimation =
                mService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
        if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
            screenRotationAnimation.getEnterTransformation().getMatrix().getValues(mTmpFloats);
            mPendingTransaction.setMatrix(mWindowingLayer,
                    mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
                    mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
            mPendingTransaction.setPosition(mWindowingLayer,
                    mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
            mPendingTransaction.setAlpha(mWindowingLayer,
                    screenRotationAnimation.getEnterTransformation().getAlpha());
        }
        super.prepareSurfaces();
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -4444,6 +4444,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            left -= parent.mFrame.left;
            top -= parent.mFrame.top;
        }

        // Expand for surface insets. See WindowState.expandForSurfaceInsets.
        left -= mAttrs.surfaceInsets.left;
        top -= mAttrs.surfaceInsets.top;
        mSurfacePosition.set(left, top);
        if (!mSurfaceAnimator.hasLeash()) {
            t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y);
+9 −7
Original line number Diff line number Diff line
@@ -704,16 +704,15 @@ class WindowStateAnimator {
            }
            tmpMatrix.postScale(mWin.mGlobalScale, mWin.mGlobalScale);

            // WindowState.prepareSurfaces expands for surface insets (in order they don't get
            // clipped by the WindowState surface), so we need to go into the other direction here.
            tmpMatrix.postTranslate(mWin.mXOffset + mWin.mAttrs.surfaceInsets.left,
                    mWin.mYOffset + mWin.mAttrs.surfaceInsets.top);

            if (appTransformation != null) {
                tmpMatrix.postConcat(appTransformation.getMatrix());
            }

            tmpMatrix.postTranslate(mWin.mXOffset, mWin.mYOffset);

            if (screenAnimation) {
                tmpMatrix.postConcat(screenRotationAnimation.getEnterTransformation().getMatrix());
            }

            // "convert" it into SurfaceFlinger's format
            // (a 2x2 matrix + an offset)
            // Here we must not transform the position of the surface
@@ -788,7 +787,10 @@ class WindowStateAnimator {
                TAG, "computeShownFrameLocked: " + this +
                " not attached, mAlpha=" + mAlpha);

        mWin.mShownPosition.set(mWin.mXOffset, mWin.mYOffset);
        // WindowState.prepareSurfaces expands for surface insets (in order they don't get
        // clipped by the WindowState surface), so we need to go into the other direction here.
        mWin.mShownPosition.set(mWin.mXOffset + mWin.mAttrs.surfaceInsets.left,
                mWin.mYOffset + mWin.mAttrs.surfaceInsets.top);
        mShownAlpha = mAlpha;
        mHaveMatrix = false;
        mDsDx = mWin.mGlobalScale;