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

Commit 5f4301bc authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Avoid moving visible task to front" into main

parents 68b753e3 f22bf2cb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -205,3 +205,14 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "fix_moving_unfocused_task"
    description: "Avoid moving the visible and unfocused multi-window mode Task to front"
    bug: "399860102"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -274,6 +274,8 @@ class ActivityStarter {
    private static final int MOVE_TO_FRONT_AVOID_PI_ONLY_CREATOR_ALLOWS = 1;
    // Avoid a task move to front because of all other legacy reasons.
    private static final int MOVE_TO_FRONT_AVOID_LEGACY = 2;
    // Avoid a task move to front because it was requested from a visible multiple window.
    private static final int MOVE_TO_FRONT_AVOID_VISIBLE_MULTI_WINDOW = 3;
    private @MoveToFrontCode int mCanMoveToFrontCode = MOVE_TO_FRONT_ALLOWED;
    private boolean mFrozeTaskList;
    private boolean mTransientLaunch;
@@ -1982,6 +1984,14 @@ class ActivityStarter {
                    && r.mTransitionController.isTransientHide(targetTask)) {
                mCanMoveToFrontCode = MOVE_TO_FRONT_AVOID_LEGACY;
            }
            // To prevent interruption of the user's current focus, if a launch request
            // originates from activities within the same visible task, the task should not be
            // moved to the front, or an unfocused Task could be moved to top unexpectedly.
            if (com.android.window.flags.Flags.fixMovingUnfocusedTask() && !avoidMoveToFront()
                    && sourceRecord != null && sourceRecord.getTask() == targetTask
                    && targetTask.isVisible() && targetTask.inMultiWindowMode()) {
                mCanMoveToFrontCode = MOVE_TO_FRONT_AVOID_VISIBLE_MULTI_WINDOW;
            }
            // If the activity is started by sending a pending intent and only its creator has the
            // privilege to allow BAL (its sender does not), avoid move it to the front. Only do
            // this when it is not a new task and not already been marked as avoid move to front.