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

Commit b2cc3bf4 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Adjust animation bounds for AE on expanding PiP

When expanding PiP back to ActivityEmbedding setup, the bounds to
animate from transition is in absolute screen coordinates while we're
animating to its parent TaskFragment. Adjust both the start and end
bounds accordingly if that's the case.

Flag: com.android.wm.shell.enable_pip2
Bug: 420998087
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/hNeqWhkP6Vdxs82oKv4lTz
Test: Use the Demo app to enter and expand PiP, see Video
Change-Id: Icd3c193f06fc840db28d01962bca3c693e40db24
parent 752d4d22
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.pip2.phone.transition;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.Surface.ROTATION_0;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;

import static com.android.wm.shell.pip2.phone.transition.PipTransitionUtils.getChangeByToken;
import static com.android.wm.shell.pip2.phone.transition.PipTransitionUtils.getFixedRotationDelta;
@@ -192,6 +193,14 @@ public class PipExpandHandler implements Transitions.TransitionHandler {
                endBounds.set(appCompatTaskInfo.topActivityLetterboxBounds);
            }
        }
        // Resolve the ActivityEmbedding case: the startBounds and endBounds are in absolute screen
        // coordinates, and we are animating the coordinates relative to its parent TaskFragment.
        if (pipChange.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY)) {
            final int offsetX = -endBounds.left;
            final int offsetY = -endBounds.top;
            startBounds.offset(offsetX, offsetY);
            endBounds.offsetTo(0, 0);
        }
        final SurfaceControl pipLeash = getLeash(pipChange);

        PictureInPictureParams params = null;