Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipExpandAnimator.java +8 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,11 @@ public class PipExpandAnimator extends ValueAnimator { super.onAnimationEnd(animation); if (mFinishTransaction != null) { onExpandAnimationUpdate(mFinishTransaction, 1f); // Reset the corner radius at the end, if not in desktop windowing mode. if (!mIsPipInDesktopMode) { mPipSurfaceTransactionHelper.round(mFinishTransaction, mLeash, false /* applyCornerRadius */); } } if (mAnimationEndCallback != null) { mAnimationEndCallback.run(); Loading Loading @@ -183,7 +188,9 @@ public class PipExpandAnimator extends ValueAnimator { mAnimatedRect, insets, degrees, x, y, true /* isExpanding */, mRotation == ROTATION_90); } mPipSurfaceTransactionHelper.round(tx, mLeash, mIsPipInDesktopMode /* applyCornerRadius */) // Apply round corner during the animation, it will be reset at the end if not in desktop // windowing mode. mPipSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */) .shadow(tx, mLeash, false /* applyShadowRadius */); } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip2/animation/PipExpandAnimatorTest.java +31 −2 Original line number Diff line number Diff line Loading @@ -173,6 +173,31 @@ public class PipExpandAnimatorTest { verify(mMockEndCallback).run(); } @Test public void onAnimationUpdate_expand_setRoundCornersWithoutShadow() { mRotation = Surface.ROTATION_0; mBaseBounds = new Rect(0, 0, 1_000, 2_000); mStartBounds = new Rect(500, 1_000, 1_000, 2_000); mEndBounds = new Rect(mBaseBounds); mPipExpandAnimator = new PipExpandAnimator(mMockContext, new PipSurfaceTransactionHelper(mMockContext), mTestLeash, mMockStartTransaction, mMockFinishTransaction, mBaseBounds, mStartBounds, mEndBounds, mSourceRectHint, mRotation, false /* isPipInDesktopMode */); mPipExpandAnimator.setSurfaceControlTransactionFactory(mMockFactory); mPipExpandAnimator.setAnimationStartCallback(mMockStartCallback); mPipExpandAnimator.setAnimationEndCallback(mMockEndCallback); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); mPipExpandAnimator.setCurrentFraction(0.5f); }); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); } @Test public void onAnimationEnd_expand_leashIsFullscreen() { mRotation = Surface.ROTATION_0; Loading @@ -191,16 +216,18 @@ public class PipExpandAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); clearInvocations(mMockFinishTransaction); mPipExpandAnimator.end(); }); verify(mMockTransaction).setCrop(mTestLeash, mEndBounds); verify(mMockTransaction).setCornerRadius(mTestLeash, 0f); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); verify(mMockFinishTransaction).setCornerRadius(mTestLeash, 0f); } @Test public void onAnimationEnd_expand_isInDesktopMode_setRoundedCorners() { public void onAnimationEnd_expandInDesktopMode_setRoundedCorners() { mRotation = Surface.ROTATION_0; mBaseBounds = new Rect(0, 0, 1_000, 2_000); mStartBounds = new Rect(500, 1_000, 1_000, 2_000); Loading @@ -217,11 +244,13 @@ public class PipExpandAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); clearInvocations(mMockFinishTransaction); mPipExpandAnimator.end(); }); verify(mMockTransaction).setCrop(mTestLeash, mEndBounds); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); verify(mMockFinishTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipExpandAnimator.java +8 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,11 @@ public class PipExpandAnimator extends ValueAnimator { super.onAnimationEnd(animation); if (mFinishTransaction != null) { onExpandAnimationUpdate(mFinishTransaction, 1f); // Reset the corner radius at the end, if not in desktop windowing mode. if (!mIsPipInDesktopMode) { mPipSurfaceTransactionHelper.round(mFinishTransaction, mLeash, false /* applyCornerRadius */); } } if (mAnimationEndCallback != null) { mAnimationEndCallback.run(); Loading Loading @@ -183,7 +188,9 @@ public class PipExpandAnimator extends ValueAnimator { mAnimatedRect, insets, degrees, x, y, true /* isExpanding */, mRotation == ROTATION_90); } mPipSurfaceTransactionHelper.round(tx, mLeash, mIsPipInDesktopMode /* applyCornerRadius */) // Apply round corner during the animation, it will be reset at the end if not in desktop // windowing mode. mPipSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */) .shadow(tx, mLeash, false /* applyShadowRadius */); } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip2/animation/PipExpandAnimatorTest.java +31 −2 Original line number Diff line number Diff line Loading @@ -173,6 +173,31 @@ public class PipExpandAnimatorTest { verify(mMockEndCallback).run(); } @Test public void onAnimationUpdate_expand_setRoundCornersWithoutShadow() { mRotation = Surface.ROTATION_0; mBaseBounds = new Rect(0, 0, 1_000, 2_000); mStartBounds = new Rect(500, 1_000, 1_000, 2_000); mEndBounds = new Rect(mBaseBounds); mPipExpandAnimator = new PipExpandAnimator(mMockContext, new PipSurfaceTransactionHelper(mMockContext), mTestLeash, mMockStartTransaction, mMockFinishTransaction, mBaseBounds, mStartBounds, mEndBounds, mSourceRectHint, mRotation, false /* isPipInDesktopMode */); mPipExpandAnimator.setSurfaceControlTransactionFactory(mMockFactory); mPipExpandAnimator.setAnimationStartCallback(mMockStartCallback); mPipExpandAnimator.setAnimationEndCallback(mMockEndCallback); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); mPipExpandAnimator.setCurrentFraction(0.5f); }); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); } @Test public void onAnimationEnd_expand_leashIsFullscreen() { mRotation = Surface.ROTATION_0; Loading @@ -191,16 +216,18 @@ public class PipExpandAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); clearInvocations(mMockFinishTransaction); mPipExpandAnimator.end(); }); verify(mMockTransaction).setCrop(mTestLeash, mEndBounds); verify(mMockTransaction).setCornerRadius(mTestLeash, 0f); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); verify(mMockFinishTransaction).setCornerRadius(mTestLeash, 0f); } @Test public void onAnimationEnd_expand_isInDesktopMode_setRoundedCorners() { public void onAnimationEnd_expandInDesktopMode_setRoundedCorners() { mRotation = Surface.ROTATION_0; mBaseBounds = new Rect(0, 0, 1_000, 2_000); mStartBounds = new Rect(500, 1_000, 1_000, 2_000); Loading @@ -217,11 +244,13 @@ public class PipExpandAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { mPipExpandAnimator.start(); clearInvocations(mMockTransaction); clearInvocations(mMockFinishTransaction); mPipExpandAnimator.end(); }); verify(mMockTransaction).setCrop(mTestLeash, mEndBounds); verify(mMockTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); verify(mMockTransaction).setShadowRadius(mTestLeash, 0f); verify(mMockFinishTransaction).setCornerRadius(mTestLeash, CORNER_RADIUS); } }