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

Commit 844ba283 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Expand PiP with the letterbox bounds

When expand from PiP to full-screen mode, take account also the
letterbox information from the AppCompat

Note: we still need to polish this particular CUJ, this change makes
sure the experience is close to PiP1

Flag: com.android.wm.shell.enable_pip2
Bug: 377362511
Video: PiP1 http://recall/-/aaaaaabFQoRHlzixHdtY/hMUeZbxmAFIvRndeu5qDvT
Video: PiP2 http://recall/-/aaaaaabFQoRHlzixHdtY/hPPkheAQzbRPUGSAgf5qYf
Test: Enter PiP from Tangorpro portrait mode, see Videos
Change-Id: Ibb69753b5faa22d7017126abb07104b94006ff4a
parent f41c611a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP_TO_SP
import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AppCompatTaskInfo;
import android.app.PictureInPictureParams;
import android.content.Context;
import android.graphics.Rect;
@@ -174,6 +175,18 @@ public class PipExpandHandler implements Transitions.TransitionHandler {

        final Rect startBounds = pipChange.getStartAbsBounds();
        final Rect endBounds = pipChange.getEndAbsBounds();
        // Resolve the AppCompat info for multi-activity case
        if (parentBeforePip != null
                && parentBeforePip.getTaskInfo() != null) {
            final AppCompatTaskInfo appCompatTaskInfo =
                    parentBeforePip.getTaskInfo().appCompatTaskInfo;
            if (appCompatTaskInfo.topActivityLetterboxBounds != null) {
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "Offset endBounds from %s to %s due to letterbox on expand",
                        endBounds, appCompatTaskInfo.topActivityLetterboxBounds);
                endBounds.set(appCompatTaskInfo.topActivityLetterboxBounds);
            }
        }
        final SurfaceControl pipLeash = getLeash(pipChange);

        PictureInPictureParams params = null;