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

Commit f73ae65b authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Save reentry state upon exiting PiP

Save the reentry state when state goes to EXITED_PIP,
so that we reenter bounds with the same scale and snap fraction
if we reenter PiP from the same component right after exiting.

These are ignored if we enter PiP from a different app.

Bug: 380323092
Flag: com.android.wm.shell.enable_pip2
Test: Enter PiP from app A, expand and enter PiP from app A again
Test: Enter PiP from app A, expand and enter PiP from app B
Change-Id: I51a4c50ccfa84acf8c9e7c69b9c026748a64ef38
parent 8caa1ad4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -910,6 +910,11 @@ public class PipTransition extends PipTransitionController implements
                        "Unexpected bundle for " + mPipTransitionState);
                break;
            case PipTransitionState.EXITED_PIP:
                // Save the PiP bounds in case, we re-enter the PiP with the same component.
                float snapFraction = mPipBoundsAlgorithm.getSnapFraction(
                        mPipBoundsState.getBounds());
                mPipBoundsState.saveReentryState(snapFraction);

                mPipTransitionState.setPipTaskToken(null);
                mPipTransitionState.setPinnedTaskLeash(null);
                break;