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

Commit 862c4118 authored by Chris Li's avatar Chris Li
Browse files

Set PIP corner radius when enter

Before, it didn't set the corner radius on the finish transition, so the
corner radius is set to 0 when finished.

Bug: 210965679
Test: atest WMShellFlickerTests:PipRotationTest
Change-Id: I7a3c478ef36a4bb730f2153d6b2487a41a469545
parent 341df3e4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -307,9 +307,11 @@ public class WMShellModule {
            Transitions transitions, ShellTaskOrganizer shellTaskOrganizer,
            PipAnimationController pipAnimationController, PipBoundsAlgorithm pipBoundsAlgorithm,
            PipBoundsState pipBoundsState, PipTransitionState pipTransitionState,
            PhonePipMenuController pipMenuController) {
            PhonePipMenuController pipMenuController,
            PipSurfaceTransactionHelper pipSurfaceTransactionHelper) {
        return new PipTransition(context, pipBoundsState, pipTransitionState, pipMenuController,
                pipBoundsAlgorithm, pipAnimationController, transitions, shellTaskOrganizer);
                pipBoundsAlgorithm, pipAnimationController, transitions, shellTaskOrganizer,
                pipSurfaceTransactionHelper);
    }

    @WMSingleton
+8 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public class PipTransition extends PipTransitionController {

    private final PipTransitionState mPipTransitionState;
    private final int mEnterExitAnimationDuration;
    private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
    private @PipAnimationController.AnimationType int mOneShotAnimationType = ANIM_TYPE_BOUNDS;
    private Transitions.TransitionFinishCallback mFinishCallback;
    private Rect mExitDestinationBounds = new Rect();
@@ -74,12 +75,14 @@ public class PipTransition extends PipTransitionController {
            PipBoundsAlgorithm pipBoundsAlgorithm,
            PipAnimationController pipAnimationController,
            Transitions transitions,
            @NonNull ShellTaskOrganizer shellTaskOrganizer) {
            @NonNull ShellTaskOrganizer shellTaskOrganizer,
            PipSurfaceTransactionHelper pipSurfaceTransactionHelper) {
        super(pipBoundsState, pipMenuController, pipBoundsAlgorithm,
                pipAnimationController, transitions, shellTaskOrganizer);
        mPipTransitionState = pipTransitionState;
        mEnterExitAnimationDuration = context.getResources()
                .getInteger(R.integer.config_pipResizeAnimationDuration);
        mSurfaceTransactionHelper = pipSurfaceTransactionHelper;
    }

    @Override
@@ -286,7 +289,10 @@ public class PipTransition extends PipTransitionController {
        final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds();
        final Rect currentBounds = taskInfo.configuration.windowConfiguration.getBounds();
        PipAnimationController.PipTransitionAnimator animator;
        finishTransaction.setPosition(leash, destinationBounds.left, destinationBounds.top);
        // Set corner radius for entering pip.
        mSurfaceTransactionHelper
                .crop(finishTransaction, leash, destinationBounds)
                .round(finishTransaction, leash, true /* applyCornerRadius */);
        if (taskInfo.pictureInPictureParams != null
                && taskInfo.pictureInPictureParams.isAutoEnterEnabled()
                && mPipTransitionState.getInSwipePipToHomeTransition()) {
+2 −7
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -84,12 +83,6 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
            }
        }

    @Before
    fun onBefore() {
        // This CUJ don't work in shell transitions because of b/204570898 b/204562589 b/206753786
        assumeFalse(isShellTransitionsEnabled)
    }

    /**
     * Checks that all parts of the screen are covered at the start and end of the transition
     */
@@ -128,6 +121,8 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
    @Presubmit
    @Test
    fun appLayerRotates_EndingBounds() {
        // This CUJ don't work in shell transitions because of b/204570898 b/204562589 b/206753786
        assumeFalse(isShellTransitionsEnabled)
        testSpec.assertLayersEnd {
            visibleRegion(fixedApp.component).coversExactly(screenBoundsEnd)
        }
+1 −0
Original line number Diff line number Diff line
@@ -365,6 +365,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                t.setPosition(targetLeash, tmpPos.x, tmpPos.y);
                t.setCornerRadius(targetLeash, 0);
                t.setShadowRadius(targetLeash, 0);
                t.setMatrix(targetLeash, 1, 0, 0, 1);
                // The bounds sent to the transition is always a real bounds. This means we lose
                // information about "null" bounds (inheriting from parent). Core will fix-up
                // non-organized window surface bounds; however, since Core can't touch organized