From 87b40601062a2f01e930c7eda3d38ac8ff2c3ba8 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 16 May 2024 10:14:24 -0700 Subject: [PATCH] Offset display cutous on foldables When entering PiP on foldables, especically in unfolded mode, offset the display cutouts even if it's from ROTATION_0 (which is always the case in unfolded state). Flag: NONE bug fix Before: http://recall/-/aaaaaabFQoRHlzixHdtY/eIR7VykaHpYeOigkuZVTp After: http://recall/-/aaaaaabFQoRHlzixHdtY/cP7NticbA68I4eev2MyZgc Bug: 331128612 Test: Hold unfolded foldable in different orientation, enter PiP Test: Hold folded foldable in different orientation, enter PiP Test: see also the videos Change-Id: I62e8d3f361644ca0ca78ef20b3d3b5441d7f26c8 --- .../android/quickstep/AbsSwipeUpHandler.java | 2 ++ .../util/SwipePipToHomeAnimator.java | 21 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 1acafab217..76c7a0717a 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1796,6 +1796,8 @@ public abstract class AbsSwipeUpHandler= 0) { + // TODO: this is to special case the issues on Pixel Foldable device(s). + mSourceRectHint.offset(mDisplayCutoutInsets.left, mDisplayCutoutInsets.top); + } else if (mFromRotation == Surface.ROTATION_90) { mSourceRectHint.offset(mDisplayCutoutInsets.left, mDisplayCutoutInsets.top); } else if (mFromRotation == Surface.ROTATION_270) { mAppBounds.inset(mDisplayCutoutInsets); @@ -457,15 +465,6 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim { } } - private static class RotatedPosition { - private final float degree; - private final float positionX; - private final float positionY; - - private RotatedPosition(float degree, float positionX, float positionY) { - this.degree = degree; - this.positionX = positionX; - this.positionY = positionY; - } + private record RotatedPosition(float degree, float positionX, float positionY) { } }