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

Commit 6da008d5 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Allow mixed handler to handle transitions that might enter PIP" into...

Merge "Allow mixed handler to handle transitions that might enter PIP" into udc-qpr-dev am: fd740934

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/25039491



Change-Id: I4833b30572b7a27a7719bf6166ba9768afc3ffe6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents dcf8d52b fd740934
Loading
Loading
Loading
Loading
+22 −4
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVIT
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT;
import static android.content.res.Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
import static android.content.res.Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
@@ -392,6 +393,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        return mMainStage.isActive();
        return mMainStage.isActive();
    }
    }


    /** @return whether this transition-request has the launch-adjacent flag. */
    public boolean requestHasLaunchAdjacentFlag(TransitionRequestInfo request) {
        final ActivityManager.RunningTaskInfo triggerTask = request.getTriggerTask();
        return triggerTask != null && triggerTask.baseIntent != null
                && (triggerTask.baseIntent.getFlags() & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0;
    }

    /** @return whether the transition-request implies entering pip from split. */
    /** @return whether the transition-request implies entering pip from split. */
    public boolean requestImpliesSplitToPip(TransitionRequestInfo request) {
    public boolean requestImpliesSplitToPip(TransitionRequestInfo request) {
        if (!isSplitActive() || !mMixedHandler.requestHasPipEnter(request)) {
        if (!isSplitActive() || !mMixedHandler.requestHasPipEnter(request)) {
@@ -2434,10 +2442,20 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
                        EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP);
            }
            }


            // When split in the background, it should be only opening/dismissing transition and
            if (!out.isEmpty()) {
            // would keep out not empty. Prevent intercepting all transitions for split screen when
                // One of the cases above handled it
            // it is in the background and not identify to handle it.
                return out;
            return (!out.isEmpty() || isSplitScreenVisible()) ? out : null;
            } else if (isSplitScreenVisible()) {
                // If split is visible, only defer handling this transition if it's launching
                // adjacent while there is already a split pair -- this may trigger PIP and
                // that should be handled by the mixed handler.
                final boolean deferTransition = requestHasLaunchAdjacentFlag(request)
                    && mMainStage.getChildCount() != 0 && mSideStage.getChildCount() != 0;
                return !deferTransition ? out : null;
            }
            // Don't intercept the transition if we are not handling it as a part of one of the
            // cases above and it is not already visible
            return null;
        } else {
        } else {
            if (isOpening && getStageOfTask(triggerTask) != null) {
            if (isOpening && getStageOfTask(triggerTask) != null) {
                // One task is appearing into split, prepare to enter split screen.
                // One task is appearing into split, prepare to enter split screen.