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

Commit d00a379a authored by Louis Chang's avatar Louis Chang
Browse files

Create Task Builder

Making Task ctors private and use builder to create Task.

Bug: 171664569
Test: atest TaskRecordTests TaskTests
Change-Id: Ia37319dc740912c9b342d68190108ecf773dfdae
parent 465e654a
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -2690,14 +2690,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                                    + ainfo.applicationInfo.uid + ", calling uid=" + callingUid);
                }

                final Task stack = r.getRootTask();
                final Task task = stack.getDisplayArea().createRootTask(stack.getWindowingMode(),
                        stack.getActivityType(), !ON_TOP, ainfo, intent,
                        false /* createdByOrganizer */);
                final Task rootTask = r.getRootTask();
                final Task task = new Task.Builder(this)
                        .setWindowingMode(rootTask.getWindowingMode())
                        .setActivityType(rootTask.getActivityType())
                        .setActivityInfo(ainfo)
                        .setParent(rootTask.getDisplayArea())
                        .setIntent(intent)
                        .build();

                if (!mRecentTasks.addToBottom(task)) {
                    // The app has too many tasks already and we can't add any more
                    stack.removeChild(task, "addAppTask");
                    rootTask.removeChild(task, "addAppTask");
                    return INVALID_TASK_ID;
                }
                task.getTaskDescription().copyFrom(description);
+7 −3
Original line number Diff line number Diff line
@@ -2152,9 +2152,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            } else {
                // In the case of multiple activities, we will create a new task for it and then
                // move the PIP activity into the task.
                rootTask = taskDisplayArea.createRootTask(WINDOWING_MODE_UNDEFINED,
                        r.getActivityType(), ON_TOP, r.info, r.intent,
                        false /* createdByOrganizer */);
                rootTask = new Task.Builder(mService)
                        .setActivityType(r.getActivityType())
                        .setOnTop(true)
                        .setActivityInfo(r.info)
                        .setParent(taskDisplayArea)
                        .setIntent(r.intent)
                        .build();
                // It's possible the task entering PIP is in freeform, so save the last
                // non-fullscreen bounds. Then when this new PIP task exits PIP, it can restore
                // to its previous freeform bounds.
+415 −55

File changed.

Preview size limit exceeded, changes collapsed.

+28 −107

File changed.

Preview size limit exceeded, changes collapsed.

+8 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;

@@ -480,9 +479,14 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
        // We want to defer the task appear signal until the task is fully created and attached to
        // to the hierarchy so that the complete starting configuration is in the task info we send
        // over to the organizer.
        final Task task = display.getDefaultTaskDisplayArea().createRootTask(windowingMode,
                ACTIVITY_TYPE_UNDEFINED, false /* onTop */, null /* info */, new Intent(),
                true /* createdByOrganizer */, true /* deferTaskAppear */, launchCookie);
        final Task task = new Task.Builder(mService)
                .setWindowingMode(windowingMode)
                .setIntent(new Intent())
                .setCreatedByOrganizer(true)
                .setDeferTaskAppear(true)
                .setLaunchCookie(launchCookie)
                .setParent(display.getDefaultTaskDisplayArea())
                .build();
        task.setDeferTaskAppear(false /* deferTaskAppear */);
        return task;
    }
Loading