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

Commit 1df27e32 authored by Yabin Huang's avatar Yabin Huang
Browse files

Introduce a transition flag for background launched activity

testPI_onlyCreatorAllowsBALwithOptIn_isStartedInBackground() failed on wm_shell build because ScalableUI handled the background activity launch transition by moving the task to front.

To fix it, this CL introduced a new transition flag and set it in the transition when launching background activity. As a result, ScalableUI will be able to decide whether it should move the task to front or not by checking the transition flag.


Bug: 390565578
Test: manual
Flag: EXEMPT bug fix
Change-Id: I1ee0e5643e450defb97ffff121cd45dd1e630d77
parent 5e6386a3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -630,6 +630,12 @@ public interface WindowManager extends ViewManager {
     */
    int TRANSIT_FLAG_AOD_APPEARING = (1 << 15); // 0x8000

    /**
     * Transition flag: Indicates that the task shouldn't move to front when launching the activity.
     * @hide
     */
    int TRANSIT_FLAG_AVOID_MOVE_TO_FRONT = (1 << 16); // 0x10000

    /**
     * @hide
     */
@@ -650,6 +656,7 @@ public interface WindowManager extends ViewManager {
            TRANSIT_FLAG_KEYGUARD_UNOCCLUDING,
            TRANSIT_FLAG_PHYSICAL_DISPLAY_SWITCH,
            TRANSIT_FLAG_AOD_APPEARING,
            TRANSIT_FLAG_AVOID_MOVE_TO_FRONT,
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionFlags {}
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import static android.os.Process.INVALID_UID;
import static android.security.Flags.preventIntentRedirectAbortOrThrowException;
import static android.security.Flags.preventIntentRedirectShowToast;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.TRANSIT_FLAG_AVOID_MOVE_TO_FRONT;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -1841,6 +1842,9 @@ class ActivityStarter {
            // no-user-leaving implies not entering PiP.
            transition.setCanPipOnFinish(false /* canPipOnFinish */);
        }
        if (avoidMoveToFront() && transition != null) {
            transition.addFlag(TRANSIT_FLAG_AVOID_MOVE_TO_FRONT);
        }
        if (isIndependentLaunch && transition != null) {
            transitionController.requestStartTransition(transition,
                    mTargetTask == null ? started.getTask() : mTargetTask,