Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6c062e0 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Offset display cutous on foldables, button nav

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). This is a follow up of ag/27381623, for button
navigation mode.

Flag: EXEMPT bugfix
Before: http://recall/-/aaaaaabFQoRHlzixHdtY/cYFaTH0f3SbuKApQY2xj2D
After: http://recall/-/aaaaaabFQoRHlzixHdtY/boBHZXG2FbKy9hfhrKrm3Z
Bug: 331128612
Test: Hold unfolded foldable in different orientation, enter PiP
Test: Hold folded foldable in different orientation, enter PiP
Change-Id: I1b78ccf2a5164fe9841e17193b21016b78a338d4
parent bf99a790
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.pip;

import static android.util.RotationUtils.rotateBounds;
import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;

@@ -625,6 +626,14 @@ public class PipAnimationController {
                }
            } else {
                adjustedSourceRectHint.set(sourceRectHint);
                if (isInPipDirection(direction)
                        && rotationDelta == ROTATION_0
                        && taskInfo.displayCutoutInsets != null) {
                    // TODO: this is to special case the issues on Foldable device
                    // with display cutout. This aligns with what's in SwipePipToHomeAnimator.
                    adjustedSourceRectHint.offset(taskInfo.displayCutoutInsets.left,
                            taskInfo.displayCutoutInsets.top);
                }
            }
            final Rect sourceHintRectInsets = new Rect();
            if (!adjustedSourceRectHint.isEmpty()) {