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

Commit bf3b6185 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Dismiss PiP without bespoke animation when it is not visible.

Previously the default behavior was to stay in PiP when a transition
brought the PiP'ed activity to the front, if PiP was not visible
before the transition (i.e. when launched from the lockscreen).

However we want notification taps for the PiP'ed app to always go
fullscreen, even from the lockscreen. This change expands PiP
instead of keeping it open when coming from the lockscreen, and
crucially does not mark the PiP transition handler as the default for
the transition, so that the keyguard dismiss transition can handle
it instead.

Bug: 373314569
Flag: com.android.wm.shell.dismiss_pip_from_lockscreen
Test: atest PipSchedulerTest + manual (see videos in the bug)
Change-Id: I01dd7f35bce1b989f2d2df8c65ab3f0f890379d5
parent cdbee107
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -312,3 +312,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "dismiss_pip_from_lockscreen"
    namespace: "multitasking"
    description: "Fixes a bug where tapping on a notification for a PiP-ed app while on Lockscreen does not launch it in fullscreen."
    bug: "373314569"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -144,7 +144,8 @@ public abstract class PipTransitionController implements Transitions.TransitionH
    /**
     * Called when the Shell wants to start an exit-via-expand from Pip transition/animation.
     */
    public void startExpandTransition(WindowContainerTransaction wct, boolean toSplit) {
    public void startExpandTransition(
            WindowContainerTransaction wct, boolean toSplit, boolean hasFirstHandler) {
        // Default implementation does nothing.
    }

+3 −2
Original line number Diff line number Diff line
@@ -290,10 +290,11 @@ public class PipController implements ConfigurationChangeListener,
                ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "onActivityRestartAttempt: topActivity=%s, wasVisible=%b",
                        task.topActivity, wasVisible);
                if (task.getWindowingMode() != WINDOWING_MODE_PINNED || !wasVisible) {
                boolean keepPipFromLockscreen = !wasVisible && !Flags.dismissPipFromLockscreen();
                if (task.getWindowingMode() != WINDOWING_MODE_PINNED || keepPipFromLockscreen) {
                    return;
                }
                mPipScheduler.scheduleExitPipViaExpand();
                mPipScheduler.scheduleExitPipViaExpand(wasVisible);
            }
        });

+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
        if (PipUtils.isContentPip(mPipTransitionState.getPipTaskInfo())) {
            mPipScheduler.scheduleRemovePip(true /* withFadeout */);
        } else {
            mPipScheduler.scheduleExitPipViaExpand();
            mPipScheduler.scheduleExitPipViaExpand(true /* wasVisible */);
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
    /**
     * Schedules exit PiP via expand transition.
     */
    public void scheduleExitPipViaExpand() {
    public void scheduleExitPipViaExpand(boolean wasVisible) {
        mMainExecutor.execute(() -> {
            if (!mPipTransitionState.isInPip()) return;

@@ -187,7 +187,7 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
            });
            boolean toSplit = !wct.isEmpty();
            wct.merge(expandWct, true /* transfer */);
            mPipTransitionController.startExpandTransition(wct, toSplit);
            mPipTransitionController.startExpandTransition(wct, toSplit, wasVisible);
        });
    }

Loading