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
This commit is contained in:
@@ -1796,6 +1796,8 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
|
||||
&& (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) {
|
||||
builder.setFromRotation(mRemoteTargetHandles[0].getTaskViewSimulator(), windowRotation,
|
||||
taskInfo.displayCutoutInsets);
|
||||
} else if (taskInfo.displayCutoutInsets != null) {
|
||||
builder.setDisplayCutoutInsets(taskInfo.displayCutoutInsets);
|
||||
}
|
||||
final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build();
|
||||
AnimatorPlaybackController activityAnimationToHome =
|
||||
|
||||
@@ -437,13 +437,21 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDisplayCutoutInsets(@NonNull Rect displayCutoutInsets) {
|
||||
mDisplayCutoutInsets = new Rect(displayCutoutInsets);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SwipePipToHomeAnimator build() {
|
||||
if (mDestinationBoundsTransformed.isEmpty()) {
|
||||
mDestinationBoundsTransformed.set(mDestinationBounds);
|
||||
}
|
||||
// adjust the mSourceRectHint / mAppBounds by display cutout if applicable.
|
||||
if (mSourceRectHint != null && mDisplayCutoutInsets != null) {
|
||||
if (mFromRotation == Surface.ROTATION_90) {
|
||||
if (mFromRotation == Surface.ROTATION_0 && mDisplayCutoutInsets.top >= 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) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user