summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2020-06-27 00:20:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-27 00:20:00 +0000
commit0edfd76f6f0743444d2f6f35fa80dce7ad5b2740 (patch)
tree0889c03680c8e7745d34e63e0deabd4a77b9b280
parent37cf2279c9df2cadcc489467be77a635354f940c (diff)
parentf982ee7ba16ea02e7464187e160c5208b1aa2c61 (diff)
Merge "Fixing last CL (uploaded the wrong patch)" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java4
2 files changed, 18 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
index a7dd53e48a81..35431e01d2f6 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
@@ -228,7 +228,6 @@ public class PipTaskOrganizer extends TaskOrganizer implements
PipAnimationController.PipTransitionAnimator animator =
mPipAnimationController.getCurrentAnimator();
if (animator != null && animator.isRunning()) {
- System.out.println("RUNNING ANIM: anim=" + animator.getDestinationBounds() + " last=" + getLastReportedBounds());
return new Rect(animator.getDestinationBounds());
}
return getLastReportedBounds();
@@ -238,6 +237,10 @@ public class PipTaskOrganizer extends TaskOrganizer implements
return mInPip;
}
+ public boolean isDeferringEnterPipAnimation() {
+ return mInPip && mShouldDeferEnteringPip;
+ }
+
/**
* Registers {@link PipTransitionCallback} to receive transition callbacks.
*/
@@ -533,12 +536,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
// If we are rotating while there is a current animation, immediately cancel the
// animation (remove the listeners so we don't trigger the normal finish resize
// call that should only happen on the update thread)
- int direction = animator.getTransitionDirection();
- animator.removeAllUpdateListeners();
- animator.removeAllListeners();
- animator.cancel();
- // Do notify the listeners that this was canceled
- sendOnPipTransitionCancelled(direction);
+ int direction = TRANSITION_DIRECTION_NONE;
+ if (animator != null) {
+ direction = animator.getTransitionDirection();
+ animator.removeAllUpdateListeners();
+ animator.removeAllListeners();
+ animator.cancel();
+ // Do notify the listeners that this was canceled
+ sendOnPipTransitionCancelled(direction);
+ sendOnPipTransitionFinished(direction);
+ }
mLastReportedBounds.set(destinationBoundsOut);
// Create a reset surface transaction for the new bounds and update the window
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index 1fbe58d28d39..40a86b78d3ad 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -95,6 +95,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
*/
private final DisplayChangeController.OnDisplayChangingListener mRotationController = (
int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> {
+ if (!mPipTaskOrganizer.isInPip() || mPipTaskOrganizer.isDeferringEnterPipAnimation()) {
+ // Skip if we aren't in PIP or haven't actually entered PIP yet
+ return;
+ }
// If there is an animation running (ie. from a shelf offset), then ensure that we calculate
// the bounds for the next orientation using the destination bounds of the animation
// TODO: Techincally this should account for movement animation bounds as well