Update config ordering when entering/leaving pip
- Always set the activity windowing mode to the previous windowing mode
prior to pip until SysUI has a chance to update
- When entering with bounds animation, do the bounds animation before
resetting the activity windowing mode and setting final bounds
- When entering with alpha animation, immediately reset the activity
windowing mode and final bounds
- When exiting, set the activity windowing mode to fullscreen along with
the task bounds and do an inverse scale animation from the previous
size up to fullscreen
- Skip the animation when exiting to fullscreen in another orientation
- Dumping pip task org state
Bug: 149946388
Test: Enter/exit pip
Test: atest PinnedStackTests
Change-Id: Ia5a50a5e2ce7621c2c678d0ded3d8c02b1932302
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
index f72de11..13516a9 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
@@ -65,6 +65,10 @@
@Retention(RetentionPolicy.SOURCE)
public @interface TransitionDirection {}
+ public static boolean isInPipDirection(@TransitionDirection int direction) {
+ return direction == TRANSITION_DIRECTION_TO_PIP;
+ }
+
public static boolean isOutPipDirection(@TransitionDirection int direction) {
return direction == TRANSITION_DIRECTION_TO_FULLSCREEN
|| direction == TRANSITION_DIRECTION_TO_SPLIT_SCREEN;
@@ -104,6 +108,12 @@
if (mCurrentAnimator == null) {
mCurrentAnimator = setupPipTransitionAnimator(
PipTransitionAnimator.ofBounds(leash, startBounds, endBounds));
+ } else if (mCurrentAnimator.getAnimationType() == ANIM_TYPE_ALPHA
+ && mCurrentAnimator.isRunning()) {
+ // If we are still animating the fade into pip, then just move the surface and ensure
+ // we update with the new destination bounds, but don't interrupt the existing animation
+ // with a new bounds
+ mCurrentAnimator.setDestinationBounds(endBounds);
} else if (mCurrentAnimator.getAnimationType() == ANIM_TYPE_BOUNDS
&& mCurrentAnimator.isRunning()) {
mCurrentAnimator.setDestinationBounds(endBounds);
@@ -265,8 +275,7 @@
boolean inScaleTransition() {
if (mAnimationType != ANIM_TYPE_BOUNDS) return false;
- final int direction = getTransitionDirection();
- return !isOutPipDirection(direction) && direction != TRANSITION_DIRECTION_TO_PIP;
+ return !isInPipDirection(getTransitionDirection());
}
/**
@@ -354,7 +363,11 @@
getCastedFractionValue(start.bottom, end.bottom, fraction));
setCurrentValue(mTmpRect);
if (inScaleTransition()) {
- getSurfaceTransactionHelper().scale(tx, leash, start, mTmpRect);
+ if (isOutPipDirection(getTransitionDirection())) {
+ getSurfaceTransactionHelper().scale(tx, leash, end, mTmpRect);
+ } else {
+ getSurfaceTransactionHelper().scale(tx, leash, start, mTmpRect);
+ }
} else {
getSurfaceTransactionHelper().crop(tx, leash, mTmpRect);
}