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

Commit 46c2f337 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Handle TO_BACK in PiP onTransitionConsumed

When the PiP task gets removed when the screen is off, the TO_BACK
transition would be aborted and leaves an inconsistent state:

- Task is reset to full-screen mode with full-screen bounds in Core
- Shell does not touch the Task leash and stills it's in PiP mode

Fixing this by re-use the mMoveToBackTransition to reset the Shell
states when in onTransitionConsumed if the transition is aborted.

Flag: EXEMPT bugfix
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/giwcYi06KeZL2R07uGwh7k
Bug: 373693542
Test: manual test with the test app
Change-Id: Ie019f80b7f8df35d415c1846f1b5d856245c4374
parent a85ddc54
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ public class PipTransition extends PipTransitionController {
        // so update fixed rotation state to default.
        mFixedRotationState = FIXED_ROTATION_UNDEFINED;

        if (transition != mExitTransition) {
        if (transition != mExitTransition && transition != mMoveToBackTransition) {
            return;
        }
        // This means an expand happened before enter-pip finished and we are now "merging" a
@@ -477,8 +477,10 @@ public class PipTransition extends PipTransitionController {
            cancelled = true;
        }

        // Unset exitTransition AFTER cancel so that finishResize knows we are merging.
        // Unset both exitTransition and moveToBackTransition AFTER cancel so that
        // finishResize knows we are merging.
        mExitTransition = null;
        mMoveToBackTransition = null;
        if (!cancelled) return;
        final ActivityManager.RunningTaskInfo taskInfo = mPipOrganizer.getTaskInfo();
        if (taskInfo != null) {
@@ -515,7 +517,8 @@ public class PipTransition extends PipTransitionController {
        // means we're expecting the exit transition will be "merged" into another transition
        // (likely a remote like launcher), so don't fire the finish-callback here -- wait until
        // the exit transition is merged.
        if ((mExitTransition == null || isAnimatingLocally()) && mFinishCallback != null) {
        if ((mExitTransition == null || mMoveToBackTransition == null || isAnimatingLocally())
                && mFinishCallback != null) {
            final SurfaceControl leash = mPipOrganizer.getSurfaceControl();
            final boolean hasValidLeash = leash != null && leash.isValid();
            WindowContainerTransaction wct = null;