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

Commit 671bb6e8 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Do not reuse organized task as leaf task" into sc-dev am: 2791092c

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I57afff74eb7f634177d9afa631d5b66797beca31
parents e5a02a2f 2791092c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -908,7 +908,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                        pw.print(Integer.toHexString(taskDescription.getStatusBarColor()));
                        pw.print(" navigationBarColor=");
                        pw.println(Integer.toHexString(taskDescription.getNavigationBarColor()));
                        pw.print(" backgroundColorFloating=");
                        pw.print(prefix); pw.print(" backgroundColorFloating=");
                        pw.println(Integer.toHexString(
                                taskDescription.getBackgroundColorFloating()));
            }
+0 −7
Original line number Diff line number Diff line
@@ -5262,13 +5262,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                || windowingMode == WINDOWING_MODE_MULTI_WINDOW);
    }

    static boolean canReuseExistingTask(int windowingMode, int activityType) {
        // Existing Tasks can be reused if a new root task will be created anyway, or for the
        // Dream - because there can only ever be one DreamActivity.
        return alwaysCreateRootTask(windowingMode, activityType)
                || activityType == ACTIVITY_TYPE_DREAM;
    }

    @Nullable
    Task getFocusedRootTask() {
        return getItemFromTaskDisplayAreas(TaskDisplayArea::getFocusedRootTask);
+18 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.ActivityTaskManager.RESIZE_MODE_FORCED;
import static android.app.ActivityTaskManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION;
import static android.app.ITaskStackListener.FORCED_RESIZEABLE_REASON_SPLIT_SCREEN;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
@@ -7349,6 +7350,7 @@ class Task extends WindowContainer<WindowContainer> {
        return reuseOrCreateTask(info, intent, null /*voiceSession*/, null /*voiceInteractor*/,
                toTop, null /*activity*/, null /*source*/, null /*options*/);
    }

    // TODO: Can be removed once we change callpoints creating root tasks to be creating tasks.
    /** Either returns this current task to be re-used or creates a new child task. */
    Task reuseOrCreateTask(ActivityInfo info, Intent intent, IVoiceInteractionSession voiceSession,
@@ -7356,7 +7358,7 @@ class Task extends WindowContainer<WindowContainer> {
            ActivityRecord source, ActivityOptions options) {

        Task task;
        if (DisplayContent.canReuseExistingTask(getWindowingMode(), getActivityType())) {
        if (canReuseAsLeafTask()) {
            // This root task will only contain one task, so just return itself since all root
            // tasks ara now tasks and all tasks are now root tasks.
            task = reuseAsLeafTask(voiceSession, voiceInteractor, intent, info, activity);
@@ -7391,10 +7393,24 @@ class Task extends WindowContainer<WindowContainer> {
        return task;
    }

    /** Return {@code true} if this task can be reused as leaf task. */
    private boolean canReuseAsLeafTask() {
        // Cannot be reused as leaf task if this task is created by organizer or having child tasks.
        if (mCreatedByOrganizer || !isLeafTask()) {
            return false;
        }

        // Existing Tasks can be reused if a new root task will be created anyway, or for the
        // Dream - because there can only ever be one DreamActivity.
        final int windowingMode = getWindowingMode();
        final int activityType = getActivityType();
        return DisplayContent.alwaysCreateRootTask(windowingMode, activityType)
                || activityType == ACTIVITY_TYPE_DREAM;
    }

    void addChild(WindowContainer child, final boolean toTop, boolean showForAllUsers) {
        Task task = child.asTask();
        try {

            if (task != null) {
                task.setForceShowForAllUsers(showForAllUsers);
            }