diff options
| author | 2023-11-07 13:45:34 -0800 | |
|---|---|---|
| committer | 2023-11-16 13:50:09 -0800 | |
| commit | 2c2b7136ae0589fc5a33e9f197f63c6fc7fb4d86 (patch) | |
| tree | 458dfc21af5b3caf013e9c62970d0ad624b5b4f1 /libs | |
| parent | 499d8e4af8f84651faf92e331999bf652d3d1c4c (diff) | |
Implement no animation expand pip (2/2)
Prevent any flickers upon early draws when
exiting PiP via expand
(with PiP2 experimental flag being on).
This is done by utilizing the current freezing and snapshot
mechanism during collection phase. The snapshot surface is also
appropriately reparented and repositioned.
This needs to be done since reparenting of an activity removes
the original parent along with the snapshot attached to it.
Fore more info see go/pip2-transitions
Bug: 307784067
Test: adb shell am broadcast -a \
com.android.wm.shell.pip2.phone.PipScheduler
Change-Id: I48943bb90dcead045ad86da4bb85b345a9996c0e
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java | 10 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java | 21 |
2 files changed, 2 insertions, 29 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java index 9bb383f0b61a..0448d94669ce 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java @@ -57,11 +57,6 @@ public class PipScheduler { @Nullable private SurfaceControl mPinnedTaskLeash; - // the leash of the original task of the PiP activity; - // used to synchronize app drawings in the multi-activity case - @Nullable - private SurfaceControl mOriginalTaskLeash; - /** * A temporary broadcast receiver to initiate exit PiP via expand. * This will later be modified to be triggered by the PiP menu. @@ -95,10 +90,6 @@ public class PipScheduler { mPinnedTaskLeash = pinnedTaskLeash; } - void setOriginalTaskLeash(SurfaceControl originalTaskLeash) { - mOriginalTaskLeash = originalTaskLeash; - } - void setPipTaskToken(@Nullable WindowContainerToken pipTaskToken) { mPipTaskToken = pipTaskToken; } @@ -133,6 +124,5 @@ public class PipScheduler { void onExitPip() { mPipTaskToken = null; mPinnedTaskLeash = null; - mOriginalTaskLeash = null; } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java index 7d3bd658d126..6200ea583a48 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java @@ -16,7 +16,6 @@ package com.android.wm.shell.pip2.phone; -import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.view.WindowManager.TRANSIT_OPEN; @@ -50,7 +49,7 @@ import com.android.wm.shell.transition.Transitions; public class PipTransition extends PipTransitionController { private static final String TAG = PipTransition.class.getSimpleName(); - private PipScheduler mPipScheduler; + private final PipScheduler mPipScheduler; @Nullable private WindowContainerToken mPipTaskToken; @Nullable @@ -168,14 +167,9 @@ public class PipTransition extends PipTransitionController { } mPipTaskToken = pipChange.getContainer(); - // cache the PiP task token and the relevant leashes + // cache the PiP task token and leash mPipScheduler.setPipTaskToken(mPipTaskToken); mPipScheduler.setPinnedTaskLeash(pipChange.getLeash()); - // check if we entered PiP from a multi-activity task and set the original task leash - final int lastParentTaskId = pipChange.getTaskInfo().lastParentTaskIdBeforePip; - final boolean isSingleActivity = lastParentTaskId == INVALID_TASK_ID; - mPipScheduler.setOriginalTaskLeash(isSingleActivity ? null : - findChangeByTaskId(info, lastParentTaskId).getLeash()); startTransaction.apply(); finishCallback.onTransitionFinished(null); @@ -201,17 +195,6 @@ public class PipTransition extends PipTransitionController { return null; } - @Nullable - private TransitionInfo.Change findChangeByTaskId(TransitionInfo info, int taskId) { - for (TransitionInfo.Change change : info.getChanges()) { - if (change.getTaskInfo() != null - && change.getTaskInfo().taskId == taskId) { - return change; - } - } - return null; - } - private void onExitPip() { mPipTaskToken = null; mPipScheduler.onExitPip(); |