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

Commit ba6b1a28 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Dismiss keyguard if entering PiP from lock screen" into main

parents a93c8e82 5181a70b
Loading
Loading
Loading
Loading
+37 −24
Original line number Diff line number Diff line
@@ -3853,8 +3853,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }

        if (isPip2ExperimentEnabled()) {
            // If PiP2 flag is on and request to enter PiP comes in,
            // we request a direct transition TRANSIT_PIP from Shell to get the right entry bounds.
            final Runnable enterPipRunnable = () -> {
                // If PiP2 flag is on and request to enter PiP comes in, we request a direct
                // transition TRANSIT_PIP from Shell to get the right entry bounds.
                // So PiP activity isn't moved to a pinned task until after
                // Shell calls back into Core with the entry bounds to be applied with startWCT.
                final Transition enterPipTransition = new Transition(TRANSIT_PIP,
@@ -3863,20 +3864,32 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                enterPipTransition.setPipActivity(r);
                r.mAutoEnteringPip = isAutoEnter;

            if (r.getTaskFragment() != null && r.getTaskFragment().isEmbeddedWithBoundsOverride()
                    && enterPipTransition != null) {
                if (r.getTaskFragment() != null
                        && r.getTaskFragment().isEmbeddedWithBoundsOverride()) {
                    enterPipTransition.addFlag(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY);
                }

                getTransitionController().startCollectOrQueue(enterPipTransition, (deferred) -> {
                    mChainTracker.start("enterPip2", enterPipTransition);
                // Collecting PiP activity explicitly to avoid stopping PiP activity while Shell
                // handles the request; see task supervisor's processStoppingAndFinishingActivities.
                    // Collecting PiP activity explicitly to avoid stopping PiP activity while
                    // Shell handles the request; see task supervisor's
                    // processStoppingAndFinishingActivities.
                    enterPipTransition.collect(r);
                    getTransitionController().requestStartTransition(enterPipTransition,
                            r.getTask(), null /* remoteTransition */, null /* displayChange */);
                    mChainTracker.end();
                });
            };
            if (r.isKeyguardLocked()) {
                mActivityClientController.dismissKeyguard(r.token, new KeyguardDismissCallback() {
                    @Override
                    public void onDismissSucceeded() {
                        enterPipRunnable.run();
                    }
                }, null /* message */);
            } else {
                enterPipRunnable.run();
            }
            return true;
        }