diff options
| author | 2024-08-21 09:09:45 -0700 | |
|---|---|---|
| committer | 2024-08-21 09:22:41 -0700 | |
| commit | 090c20fdc8d0353ef23a0251808ab87a02ddfb6a (patch) | |
| tree | 7de21cf32a53311b03ca24ae8505a6b199e11afa | |
| parent | a50a0106231b20754437756983a9d7db2126b84b (diff) | |
Rotate display layout if there is a delta present
We should be careful rotating a DisplayLayout in place
through requestStartTransition trigger path as
the DisplayChange in TransitionRequestInfo uses
ROTATION_UNDEFINED as default start and end rotation
values, while DisplayLayout only supports 0, 90, 180, 270.
This can cause issues since display layouts use their
internally cached mRotation as the startRotation instead
of the one provided by transitions leading to
non-zero delta degree calculations.
We should also avoid assuming in OnDisplayChangingListener
implementations that a rotation caused the display change.
So short-circuiting if so in pip1.PipController
It is still unclear how to exactly repro this case, since
at least generrally, we populate the rotation fields with
a non undefined value - even if the rotation is unchanged,
but this change should guard against the unlikely usage of
ROTATION_UNDEFINED.
Bug: 360907644
Bug: 360908318
Flag: EXEMPT bugfix
Test: N/A
Change-Id: If7ac78d4497b0774268b937d0f5aad0d4972ea53
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java | 4 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java index 7c51a6994306..f532be6b8277 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayController.java @@ -211,7 +211,9 @@ public class DisplayController { dr.mDisplayLayout.resizeTo(dr.mContext.getResources(), new Size(endAbsBounds.width(), endAbsBounds.height())); } - dr.mDisplayLayout.rotateTo(dr.mContext.getResources(), toRotation); + if (fromRotation != toRotation) { + dr.mDisplayLayout.rotateTo(dr.mContext.getResources(), toRotation); + } } mChangeController.dispatchOnDisplayChange( diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index da6221efdaee..7d217fcab880 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -240,6 +240,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb */ private final DisplayChangeController.OnDisplayChangingListener mRotationController = ( displayId, fromRotation, toRotation, newDisplayAreaInfo, t) -> { + if (fromRotation == toRotation) { + // OnDisplayChangingListener also gets triggered upon Display size changes; + // in PiP1, those are handled separately by OnDisplaysChangedListener callbacks. + return; + } + if (mPipTransitionController.handleRotateDisplay(fromRotation, toRotation, t)) { return; } |