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

Commit 188d8010 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Changed createRootTask task to be completely async

Currently some of the information about a task created by createRootTask
is returned with the method and the rest like leash is return in
onTaskAppear. Mixing both async and sync infromation return styles
complicates the mental model for this. So, we will have this be
completely aync for now.

Also, fixed an issue where the windowing mode for organizer created
task was not set correctly before the organizer gets the first task
appear signal.

Bug: 169266958
Test: Split-screen works!
Change-Id: Ia4180d5a42838bf566fbf75f40466dfd8237e0f1
parent 6a6ce5e6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2375,7 +2375,7 @@ package android.window {

  public class TaskOrganizer extends android.window.WindowOrganizer {
    ctor public TaskOrganizer();
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public android.app.ActivityManager.RunningTaskInfo createRootTask(int, int);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void createRootTask(int, int, @Nullable android.os.IBinder);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean deleteRootTask(@NonNull android.window.WindowContainerToken);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getChildTasks(@NonNull android.window.WindowContainerToken, @NonNull int[]);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public android.window.WindowContainerToken getImeTarget(int);
+1 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ public class TaskInfo {

    /** @hide */
    public void addLaunchCookie(IBinder cookie) {
        if (cookie == null || launchCookies.contains(cookie)) return;
        launchCookies.add(cookie);
    }

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ interface ITaskOrganizerController {
    void unregisterTaskOrganizer(ITaskOrganizer organizer);

    /** Creates a persistent root task in WM for a particular windowing-mode. */
    ActivityManager.RunningTaskInfo createRootTask(int displayId, int windowingMode);
    void createRootTask(int displayId, int windowingMode, IBinder launchCookie);

    /** Deletes a persistent root task in WM */
    boolean deleteRootTask(in WindowContainerToken task);
+10 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.SurfaceControl;

@@ -101,12 +102,18 @@ public class TaskOrganizer extends WindowOrganizer {
    @BinderThread
    public void onBackPressedOnTaskRoot(@NonNull ActivityManager.RunningTaskInfo taskInfo) {}

    /** Creates a persistent root task in WM for a particular windowing-mode. */
    /**
     * Creates a persistent root task in WM for a particular windowing-mode.
     * @param displayId The display to create the root task on.
     * @param windowingMode Windowing mode to put the root task in.
     * @param launchCookie Launch cookie to associate with the task so that is can be identified
     *                     when the {@link ITaskOrganizer#onTaskAppeared} callback is called.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    @Nullable
    public ActivityManager.RunningTaskInfo createRootTask(int displayId, int windowingMode) {
    public void createRootTask(int displayId, int windowingMode, @Nullable IBinder launchCookie) {
        try {
            return mTaskOrganizerController.createRootTask(displayId, windowingMode);
            mTaskOrganizerController.createRootTask(displayId, windowingMode, launchCookie);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+6 −0
Original line number Diff line number Diff line
@@ -2923,6 +2923,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/TaskDisplayArea.java"
    },
    "1396893178": {
      "message": "createRootTask unknown displayId=%d",
      "level": "ERROR",
      "group": "WM_DEBUG_WINDOW_ORGANIZER",
      "at": "com\/android\/server\/wm\/TaskOrganizerController.java"
    },
    "1401295262": {
      "message": "Mode default, asking user",
      "level": "WARN",
Loading