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

Commit e1ea5db7 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Crop windowing layer for shell rotation animation" into tm-qpr-dev

parents 62c25380 b1a7a586
Loading
Loading
Loading
Loading
+8 −19
Original line number Diff line number Diff line
@@ -86,8 +86,6 @@ class ScreenRotationAnimation {
    private final float[] mTmpFloats = new float[9];
    /** The leash of the changing window container. */
    private final SurfaceControl mSurfaceControl;
    private final Rect mStartBounds = new Rect();
    private final Rect mEndBounds = new Rect();

    private final int mAnimHint;
    private final int mStartWidth;
@@ -105,8 +103,7 @@ class ScreenRotationAnimation {
     */
    private SurfaceControl mBackColorSurface;
    /** The leash using to animate screenshot layer. */
    private SurfaceControl mAnimLeash;
    private Transaction mTransaction;
    private final SurfaceControl mAnimLeash;

    // The current active animation to move from the old to the new rotated
    // state.  Which animation is run here will depend on the old and new
@@ -134,9 +131,6 @@ class ScreenRotationAnimation {
        mStartRotation = change.getStartRotation();
        mEndRotation = change.getEndRotation();

        mStartBounds.set(change.getStartAbsBounds());
        mEndBounds.set(change.getEndAbsBounds());

        mAnimLeash = new SurfaceControl.Builder(session)
                .setParent(rootLeash)
                .setEffectLayer()
@@ -169,6 +163,8 @@ class ScreenRotationAnimation {

            t.setLayer(mAnimLeash, SCREEN_FREEZE_LAYER_BASE);
            t.show(mAnimLeash);
            // Crop the real content in case it contains a larger child layer, e.g. wallpaper.
            t.setCrop(mSurfaceControl, new Rect(0, 0, mEndWidth, mEndHeight));

            final ColorSpace colorSpace = screenshotBuffer.getColorSpace();
            final HardwareBuffer hardwareBuffer = screenshotBuffer.getHardwareBuffer();
@@ -306,7 +302,6 @@ class ScreenRotationAnimation {
        mRotateEnterAnimation.restrictDuration(MAX_ANIMATION_DURATION);
        mRotateEnterAnimation.scaleCurrentDuration(animationScale);

        mTransaction = mTransactionPool.acquire();
        if (customRotate) {
            mRotateAlphaAnimation.initialize(mEndWidth, mEndHeight, mStartWidth, mStartHeight);
            mRotateAlphaAnimation.restrictDuration(MAX_ANIMATION_DURATION);
@@ -386,23 +381,17 @@ class ScreenRotationAnimation {
    }

    public void kill() {
        Transaction t = mTransaction != null ? mTransaction : mTransactionPool.acquire();
        final Transaction t = mTransactionPool.acquire();
        if (mAnimLeash.isValid()) {
            t.remove(mAnimLeash);
        }

        if (mScreenshotLayer != null) {
            if (mScreenshotLayer.isValid()) {
        if (mScreenshotLayer != null && mScreenshotLayer.isValid()) {
            t.remove(mScreenshotLayer);
        }
            mScreenshotLayer = null;
        }
        if (mBackColorSurface != null) {
            if (mBackColorSurface.isValid()) {
        if (mBackColorSurface != null && mBackColorSurface.isValid()) {
            t.remove(mBackColorSurface);
        }
            mBackColorSurface = null;
        }
        t.apply();
        mTransactionPool.release(t);
    }