Merge "Make sure PiP appears on screen when folding the device" into tm-qpr-dev

This commit is contained in:
Mateusz Cicheński
2023-02-17 21:31:23 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 1 deletions

View File

@@ -209,7 +209,7 @@ public class PipAnimationController {
/**
* Quietly cancel the animator by removing the listeners first.
*/
static void quietCancel(@NonNull ValueAnimator animator) {
public static void quietCancel(@NonNull ValueAnimator animator) {
animator.removeAllUpdateListeners();
animator.removeAllListeners();
animator.cancel();

View File

@@ -715,6 +715,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
private void onDisplayChanged(DisplayLayout layout, boolean saveRestoreSnapFraction) {
if (!mPipBoundsState.getDisplayLayout().isSameGeometry(layout)) {
PipAnimationController.PipTransitionAnimator animator =
mPipAnimationController.getCurrentAnimator();
if (animator != null && animator.isRunning()) {
// cancel any running animator, as it is using stale display layout information
PipAnimationController.quietCancel(animator);
}
onDisplayChangedUncheck(layout, saveRestoreSnapFraction);
}
}