summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2024-08-09 16:33:32 +0000
committer Riddle Hsu <riddlehsu@google.com> 2024-08-09 16:34:26 +0000
commit9d87e52800b47dffcf8041e355ca79d12b7422d9 (patch)
treebab696cca98610d260a72167f08125a3b5f1fb4e
parentaa96091053edb7c0a6eb6168899e643657d98439 (diff)
Distinguish exited pip task change
Shell only uses the windowing mode task info to decide whether the task is entering pip. But when entering pip or exiting pip, the task windowing mode is pip and the activity windowing mode is fullscreen. The causes shell to treat both cases as entering pip. Bug: 353618234 Flag: EXEMPT bugfix Test: Enable home rotation and auto rotation. Enter PiP in landscape. Leave PiP and rotate to portrait at the same time. The transition should be handled by DefaultTransitionHandler. And the PiP task should not be cropped by landscape bounds. Change-Id: Ia3894d2a846dbd16d864e560d035ec1591fcb09c
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
index ba97c8322c92..deb44574c336 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
@@ -285,6 +285,20 @@ public class PipTransition extends PipTransitionController {
// Entering PIP.
if (isEnteringPip(info)) {
+ if (!mPipTransitionState.isInPip() && TransitionUtil.hasDisplayChange(info)) {
+ final TransitionInfo.Change pipChange = getPipChange(info);
+ if (pipChange != null) {
+ // Clear old crop.
+ updatePipForUnhandledTransition(pipChange, startTransaction, finishTransaction);
+ }
+ ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
+ "%s: ignore exited PiP with display change", TAG);
+ // This should be an exited pip. E.g. a display change transition happens when
+ // the exiting pip is animating, then mergeAnimation -> end -> onFinishResize ->
+ // onExitPipFinished was called, i.e. pip state is UNDEFINED. So do not handle
+ // the incoming transition as entering pip.
+ return false;
+ }
if (handleEnteringPipWithDisplayChange(transition, info, startTransaction,
finishTransaction, finishCallback)) {
// The destination position is applied directly and let default transition handler