diff options
| author | 2020-09-21 16:46:49 -0700 | |
|---|---|---|
| committer | 2020-09-21 16:46:49 -0700 | |
| commit | 207a1f1bf4f896a5d03df480d2c5ccfe9edcd9dc (patch) | |
| tree | e5d54c4c15a5ddb69fa102461d749769ebdf8fc0 | |
| parent | 02a5b039099d2339eadf1943a995dc64408880d7 (diff) | |
Reset Task surface to no-crop after pip expand when fullscreen
Previously, pip expand was hard-coding the fullscreen surface
to the bounds-at-the-time. It's supposed to be null when in
fullscreen otherwise it won't properly adapt to display changes
like rotation.
Bug: 168495984
Test: Open app in fullscreen portrait, go to pip, expand the pip,
rotate device and see that it works (no half-black screen)
Change-Id: Ic39cf484438c379009eaf463b22a04f7a86497a3
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java index fd8ca8044acf..8baa66de7f97 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java +++ b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java @@ -217,7 +217,7 @@ public class PipAnimationController { public void onAnimationEnd(Animator animation) { mCurrentValue = mEndValue; final SurfaceControl.Transaction tx = newSurfaceControlTransaction(); - onEndTransaction(mLeash, tx); + onEndTransaction(mLeash, tx, mTransitionDirection); if (mPipAnimationCallback != null) { mPipAnimationCallback.onPipAnimationEnd(tx, this); } @@ -316,7 +316,8 @@ public class PipAnimationController { void onStartTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) {} - void onEndTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) {} + void onEndTransaction(SurfaceControl leash, SurfaceControl.Transaction tx, + @TransitionDirection int transitionDirection) {} abstract void applySurfaceControlTransaction(SurfaceControl leash, SurfaceControl.Transaction tx, float fraction); @@ -411,13 +412,20 @@ public class PipAnimationController { } @Override - void onEndTransaction(SurfaceControl leash, SurfaceControl.Transaction tx) { + void onEndTransaction(SurfaceControl leash, SurfaceControl.Transaction tx, + int transitionDirection) { // NOTE: intentionally does not apply the transaction here. // this end transaction should get executed synchronously with the final // WindowContainerTransaction in task organizer - getSurfaceTransactionHelper() - .resetScale(tx, leash, getDestinationBounds()) - .crop(tx, leash, getDestinationBounds()); + final Rect destBounds = getDestinationBounds(); + getSurfaceTransactionHelper().resetScale(tx, leash, destBounds); + if (transitionDirection == TRANSITION_DIRECTION_LEAVE_PIP) { + // Leaving to fullscreen, reset crop to null. + tx.setPosition(leash, destBounds.left, destBounds.top); + tx.setWindowCrop(leash, 0, 0); + } else { + getSurfaceTransactionHelper().crop(tx, leash, destBounds); + } } @Override |