Loading packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java +8 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.animation.Animator; import android.animation.RectEvaluator; import android.animation.ValueAnimator; import android.annotation.IntDef; import android.content.Context; import android.graphics.Rect; import android.view.SurfaceControl; Loading Loading @@ -56,13 +55,15 @@ public class PipAnimationController { public static final int TRANSITION_DIRECTION_TO_PIP = 2; public static final int TRANSITION_DIRECTION_TO_FULLSCREEN = 3; public static final int TRANSITION_DIRECTION_TO_SPLIT_SCREEN = 4; public static final int TRANSITION_DIRECTION_REMOVE_STACK = 5; @IntDef(prefix = { "TRANSITION_DIRECTION_" }, value = { TRANSITION_DIRECTION_NONE, TRANSITION_DIRECTION_SAME, TRANSITION_DIRECTION_TO_PIP, TRANSITION_DIRECTION_TO_FULLSCREEN, TRANSITION_DIRECTION_TO_SPLIT_SCREEN TRANSITION_DIRECTION_TO_SPLIT_SCREEN, TRANSITION_DIRECTION_REMOVE_STACK }) @Retention(RetentionPolicy.SOURCE) public @interface TransitionDirection {} Loading @@ -88,7 +89,7 @@ public class PipAnimationController { }); @Inject PipAnimationController(Context context, PipSurfaceTransactionHelper helper) { PipAnimationController(PipSurfaceTransactionHelper helper) { mSurfaceTransactionHelper = helper; } Loading Loading @@ -338,6 +339,10 @@ public class PipAnimationController { @Override void onStartTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) { if (getTransitionDirection() == TRANSITION_DIRECTION_REMOVE_STACK) { // while removing the pip stack, no extra work needs to be done here. return; } getSurfaceTransactionHelper() .resetScale(tx, leash, getDestinationBounds()) .crop(tx, leash, getDestinationBounds()) Loading packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +27 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_ALPHA; import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_BOUNDS; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_NONE; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_SAME; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_FULLSCREEN; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP; Loading Loading @@ -337,7 +338,19 @@ public class PipTaskOrganizer extends TaskOrganizer implements + " mInPip=" + mInPip + " mExitingPip=" + mExitingPip + " mToken=" + mToken); return; } getUpdateHandler().post(() -> { // removePipImmediately is expected when the following animation finishes. mUpdateHandler.post(() -> mPipAnimationController .getAnimator(mLeash, mLastReportedBounds, 1f, 0f) .setTransitionDirection(TRANSITION_DIRECTION_REMOVE_STACK) .setPipAnimationCallback(mPipAnimationCallback) .setDuration(mEnterExitAnimationDuration) .start()); mInitialState.remove(mToken.asBinder()); mExitingPip = true; } private void removePipImmediately() { try { // Reset the task bounds first to ensure the activity configuration is reset as well final WindowContainerTransaction wct = new WindowContainerTransaction(); Loading @@ -349,9 +362,6 @@ public class PipTaskOrganizer extends TaskOrganizer implements } catch (RemoteException e) { Log.e(TAG, "Failed to remove PiP", e); } }); mInitialState.remove(mToken.asBinder()); mExitingPip = true; } @Override Loading Loading @@ -803,7 +813,10 @@ public class PipTaskOrganizer extends TaskOrganizer implements + "directly"); } mLastReportedBounds.set(destinationBounds); if (isInPipDirection(direction) && type == ANIM_TYPE_ALPHA) { if (direction == TRANSITION_DIRECTION_REMOVE_STACK) { removePipImmediately(); return; } else if (isInPipDirection(direction) && type == ANIM_TYPE_ALPHA) { return; } Loading packages/SystemUI/tests/src/com/android/systemui/pip/PipAnimationControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,7 @@ public class PipAnimationControllerTest extends SysuiTestCase { @Before public void setUp() throws Exception { mPipAnimationController = new PipAnimationController( mContext, new PipSurfaceTransactionHelper(mContext, mock(ConfigurationController.class))); new PipSurfaceTransactionHelper(mContext, mock(ConfigurationController.class))); mLeash = new SurfaceControl.Builder() .setContainerLayer() .setName("FakeLeash") Loading Loading
packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java +8 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.animation.Animator; import android.animation.RectEvaluator; import android.animation.ValueAnimator; import android.annotation.IntDef; import android.content.Context; import android.graphics.Rect; import android.view.SurfaceControl; Loading Loading @@ -56,13 +55,15 @@ public class PipAnimationController { public static final int TRANSITION_DIRECTION_TO_PIP = 2; public static final int TRANSITION_DIRECTION_TO_FULLSCREEN = 3; public static final int TRANSITION_DIRECTION_TO_SPLIT_SCREEN = 4; public static final int TRANSITION_DIRECTION_REMOVE_STACK = 5; @IntDef(prefix = { "TRANSITION_DIRECTION_" }, value = { TRANSITION_DIRECTION_NONE, TRANSITION_DIRECTION_SAME, TRANSITION_DIRECTION_TO_PIP, TRANSITION_DIRECTION_TO_FULLSCREEN, TRANSITION_DIRECTION_TO_SPLIT_SCREEN TRANSITION_DIRECTION_TO_SPLIT_SCREEN, TRANSITION_DIRECTION_REMOVE_STACK }) @Retention(RetentionPolicy.SOURCE) public @interface TransitionDirection {} Loading @@ -88,7 +89,7 @@ public class PipAnimationController { }); @Inject PipAnimationController(Context context, PipSurfaceTransactionHelper helper) { PipAnimationController(PipSurfaceTransactionHelper helper) { mSurfaceTransactionHelper = helper; } Loading Loading @@ -338,6 +339,10 @@ public class PipAnimationController { @Override void onStartTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) { if (getTransitionDirection() == TRANSITION_DIRECTION_REMOVE_STACK) { // while removing the pip stack, no extra work needs to be done here. return; } getSurfaceTransactionHelper() .resetScale(tx, leash, getDestinationBounds()) .crop(tx, leash, getDestinationBounds()) Loading
packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +27 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_ALPHA; import static com.android.systemui.pip.PipAnimationController.ANIM_TYPE_BOUNDS; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_NONE; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_SAME; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_FULLSCREEN; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP; Loading Loading @@ -337,7 +338,19 @@ public class PipTaskOrganizer extends TaskOrganizer implements + " mInPip=" + mInPip + " mExitingPip=" + mExitingPip + " mToken=" + mToken); return; } getUpdateHandler().post(() -> { // removePipImmediately is expected when the following animation finishes. mUpdateHandler.post(() -> mPipAnimationController .getAnimator(mLeash, mLastReportedBounds, 1f, 0f) .setTransitionDirection(TRANSITION_DIRECTION_REMOVE_STACK) .setPipAnimationCallback(mPipAnimationCallback) .setDuration(mEnterExitAnimationDuration) .start()); mInitialState.remove(mToken.asBinder()); mExitingPip = true; } private void removePipImmediately() { try { // Reset the task bounds first to ensure the activity configuration is reset as well final WindowContainerTransaction wct = new WindowContainerTransaction(); Loading @@ -349,9 +362,6 @@ public class PipTaskOrganizer extends TaskOrganizer implements } catch (RemoteException e) { Log.e(TAG, "Failed to remove PiP", e); } }); mInitialState.remove(mToken.asBinder()); mExitingPip = true; } @Override Loading Loading @@ -803,7 +813,10 @@ public class PipTaskOrganizer extends TaskOrganizer implements + "directly"); } mLastReportedBounds.set(destinationBounds); if (isInPipDirection(direction) && type == ANIM_TYPE_ALPHA) { if (direction == TRANSITION_DIRECTION_REMOVE_STACK) { removePipImmediately(); return; } else if (isInPipDirection(direction) && type == ANIM_TYPE_ALPHA) { return; } Loading
packages/SystemUI/tests/src/com/android/systemui/pip/PipAnimationControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,7 @@ public class PipAnimationControllerTest extends SysuiTestCase { @Before public void setUp() throws Exception { mPipAnimationController = new PipAnimationController( mContext, new PipSurfaceTransactionHelper(mContext, mock(ConfigurationController.class))); new PipSurfaceTransactionHelper(mContext, mock(ConfigurationController.class))); mLeash = new SurfaceControl.Builder() .setContainerLayer() .setName("FakeLeash") Loading