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

Commit 11efffc0 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Fix swipe-to-pip from transparent activity

Swiping to enter PiP from a transparent activity causes
a flicker because the background activity (in multi-activit enter PiP)
is PAUSED instead of STOPPED.

This means the moment TRANSIT_PIP's startTx is applied, the transient
hide original host task will be temporarily visible due to a
non-stopping top activity as per policy. This is corrected when the
transient-launch transition is finished and that background activity is
eventually stopped and its layer is moved to back.

This also means that earlier we were just effectively were not seeing
the last parent before PiP flickering, just cause the background
activity would be stopped.

Instead we should explicitly hide the last parent before PiP if it's
specifically a transient hide task in a currently playing transition;
we also do this in sync with the reparenting of the layers once enter
PiP plays on the Shell side.

Bug: 423211835
Flag: com.android.wm.shell.enable_pip2
Test: manually swipe to PiP from a spotify video podcast
Change-Id: I2707b7e34fe247b2963ed1d4aad38679026909ab
parent 6f40fe65
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2243,6 +2243,15 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

                // Ensure the leash of new task is in sync with its current bounds after reparent.
                rootTask.maybeApplyLastRecentsAnimationTransaction();

                boolean isLastParentTransientHide = mTransitionController
                        .getTransientHideTransitionForContainer(task) != null;
                if (isPip2ExperimentEnabled() && isLastParentTransientHide) {
                    // Ensure the last parent is explicitly hidden in the sync transaction of the
                    // enter PiP transition. This is needed because transient hide task's layer
                    // isn't actually hidden until the transient-launch transition finishes in Core.
                    rootTask.getSyncTransaction().hide(task.getSurfaceControl());
                }
            }

            // TODO(remove-legacy-transit): Move this to the `singleActivity` case when removing