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

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

Renaming Stacks APIs to RootTasks

This CL is aimed to refine the AM/ATM API surface. The other
stack naming internally spread in AM and ATM will be covered
in later CLs.

Also Consolidate #removeStack() with #removeTask().

Bug: 157876448
Test: existing tests

Change-Id: I1254f972dab3bbe66a736a0402eebce9d0fb1496
parent b7100b5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public class WmPerfRunListener extends RunListener {
        runWithShellPermissionIdentity(() -> {
            final ActivityTaskManager atm = mContext.getSystemService(ActivityTaskManager.class);
            atm.removeAllVisibleRecentTasks();
            atm.removeStacksWithActivityTypes(new int[] { ACTIVITY_TYPE_STANDARD,
            atm.removeRootTasksWithActivityTypes(new int[] { ACTIVITY_TYPE_STANDARD,
                    ACTIVITY_TYPE_ASSISTANT, ACTIVITY_TYPE_RECENTS, ACTIVITY_TYPE_UNDEFINED });
        });
        PhoneWindow.sendCloseSystemWindows(mContext, "WmPerfTests");
+5 −5
Original line number Diff line number Diff line
@@ -136,12 +136,12 @@ package android.app {
  public class ActivityTaskManager {
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void clearLaunchParamsForPackages(java.util.List<java.lang.String>);
    method public static boolean currentUiModeSupportsErrorDialogs(@NonNull android.content.Context);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void moveTaskToStack(int, int, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean moveTopActivityToPinnedStack(int, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeStacksInWindowingModes(int[]) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeStacksWithActivityTypes(int[]) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void moveTaskToRootTask(int, int, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean moveTopActivityToPinnedRootTask(int, @NonNull android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeRootTasksInWindowingModes(@NonNull int[]);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeRootTasksWithActivityTypes(@NonNull int[]);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void requestPictureInPictureMode(@NonNull android.os.IBinder);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeDockedStack(android.graphics.Rect, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizePrimarySplitScreen(@NonNull android.graphics.Rect, @NonNull android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeTask(int, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setDisplayToSingleTaskInstance(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
+19 −19
Original line number Diff line number Diff line
@@ -211,23 +211,23 @@ public class ActivityTaskManager {
    }

    /**
     * Removes stacks in the windowing modes from the system if they are of activity type
     * Removes root tasks in the windowing modes from the system if they are of activity type
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void removeStacksInWindowingModes(int[] windowingModes) throws SecurityException {
    public void removeRootTasksInWindowingModes(@NonNull int[] windowingModes) {
        try {
            getService().removeStacksInWindowingModes(windowingModes);
            getService().removeRootTasksInWindowingModes(windowingModes);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /** Removes stack of the activity types from the system. */
    /** Removes root tasks of the activity types from the system. */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void removeStacksWithActivityTypes(int[] activityTypes) throws SecurityException {
    public void removeRootTasksWithActivityTypes(@NonNull int[] activityTypes) {
        try {
            getService().removeStacksWithActivityTypes(activityTypes);
            getService().removeRootTasksWithActivityTypes(activityTypes);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -310,15 +310,15 @@ public class ActivityTaskManager {
    }

    /**
     * Moves the top activity in the input stackId to the pinned stack.
     * @param stackId Id of stack to move the top activity to pinned stack.
     * @param bounds Bounds to use for pinned stack.
     * @return True if the top activity of stack was successfully moved to the pinned stack.
     * Moves the top activity in the input rootTaskId to the pinned root task.
     * @param rootTaskId Id of root task to move the top activity to pinned root task.
     * @param bounds Bounds to use for pinned root task.
     * @return True if the top activity of root task was successfully moved to the pinned root task.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) {
    public boolean moveTopActivityToPinnedRootTask(int rootTaskId, @NonNull Rect bounds) {
        try {
            return getService().moveTopActivityToPinnedStack(stackId, bounds);
            return getService().moveTopActivityToPinnedRootTask(rootTaskId, bounds);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -350,15 +350,15 @@ public class ActivityTaskManager {
    }

    /**
     * Move task to stack with given id.
     * Move task to root task with given id.
     * @param taskId Id of the task to move.
     * @param stackId Id of the stack for task moving.
     * @param rootTaskId Id of the rootTask for task moving.
     * @param toTop Whether the given task should shown to top of stack.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) {
    public void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop) {
        try {
            getService().moveTaskToStack(taskId, stackId, toTop);
            getService().moveTaskToRootTask(taskId, rootTaskId, toTop);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -380,13 +380,13 @@ public class ActivityTaskManager {

    /**
     * Resize docked stack & its task to given stack & task bounds.
     * @param stackBounds Bounds to resize stack.
     * @param rootTaskBounds Bounds to resize stack.
     * @param taskBounds Bounds to resize task.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeDockedStack(Rect stackBounds, Rect taskBounds) {
    public void resizePrimarySplitScreen(@NonNull Rect rootTaskBounds, @NonNull Rect taskBounds) {
        try {
            getService().resizeDockedStack(stackBounds, taskBounds, null, null, null);
            getService().resizePrimarySplitScreen(rootTaskBounds, taskBounds, null, null, null);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+3 −7
Original line number Diff line number Diff line
@@ -447,9 +447,8 @@ interface IActivityManager {
    void hang(in IBinder who, boolean allowRestart);

    List<ActivityTaskManager.RootTaskInfo> getAllRootTaskInfos();
    @UnsupportedAppUsage
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    void setFocusedStack(int stackId);
    void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop);
    void setFocusedRootTask(int taskId);
    ActivityTaskManager.RootTaskInfo getFocusedRootTaskInfo();
    @UnsupportedAppUsage
    void restart();
@@ -507,15 +506,12 @@ interface IActivityManager {
    boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd);
    @UnsupportedAppUsage
    void suppressResizeConfigChanges(boolean suppress);
    @UnsupportedAppUsage
    boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
    boolean moveTopActivityToPinnedRootTask(int rootTaskId, in Rect bounds);
    boolean isAppStartModeDisabled(int uid, in String packageName);
    @UnsupportedAppUsage
    boolean unlockUser(int userid, in byte[] token, in byte[] secret,
            in IProgressListener listener);
    void killPackageDependents(in String packageName, int userId);
    @UnsupportedAppUsage
    void removeStack(int stackId);
    void makePackageIdle(String packageName, int userId);
    int getMemoryTrimLevel();
    boolean isVrModePackageEnabled(in ComponentName packageName);
+10 −11
Original line number Diff line number Diff line
@@ -186,11 +186,11 @@ interface IActivityTaskManager {
    void reportAssistContextExtras(in IBinder token, in Bundle extras,
            in AssistStructure structure, in AssistContent content, in Uri referrer);

    void setFocusedStack(int stackId);
    void setFocusedRootTask(int taskId);
    ActivityTaskManager.RootTaskInfo getFocusedRootTaskInfo();
    Rect getTaskBounds(int taskId);

    void cancelRecentsAnimation(boolean restoreHomeStackPosition);
    void cancelRecentsAnimation(boolean restoreHomeRootTaskPosition);
    void startLockTaskModeByToken(in IBinder token);
    void stopLockTaskModeByToken(in IBinder token);
    void updateLockTaskPackages(int userId, in String[] packages);
@@ -239,8 +239,7 @@ interface IActivityTaskManager {
     * @return Return true on success. Otherwise false.
     */
    boolean resizeTask(int taskId, in Rect bounds, int resizeMode);
    void moveStackToDisplay(int stackId, int displayId);
    void removeStack(int stackId);
    void moveRootTaskToDisplay(int taskId, int displayId);

    /**
     * Sets the windowing mode for a specific task. Only works on tasks of type
@@ -251,15 +250,15 @@ interface IActivityTaskManager {
     * @return Whether the task was successfully put into the specified windowing mode.
     */
    boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop);
    boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop);
    /**
     * Removes stacks in the input windowing modes from the system if they are of activity type
     * Removes root tasks in the input windowing modes from the system if they are of activity type
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
     */
    void removeStacksInWindowingModes(in int[] windowingModes);
    /** Removes stack of the activity types from the system. */
    void removeStacksWithActivityTypes(in int[] activityTypes);
    void removeRootTasksInWindowingModes(in int[] windowingModes);
    /** Removes root tasks of the activity types from the system. */
    void removeRootTasksWithActivityTypes(in int[] activityTypes);

    List<ActivityTaskManager.RootTaskInfo> getAllRootTaskInfos();
    ActivityTaskManager.RootTaskInfo getRootTaskInfo(int windowingMode, int activityType);
@@ -299,7 +298,7 @@ interface IActivityTaskManager {
            in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);

    void suppressResizeConfigChanges(boolean suppress);
    boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
    boolean moveTopActivityToPinnedRootTask(int rootTaskId, in Rect bounds);
    boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params);
    void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params);
    void requestPictureInPictureMode(in IBinder token);
@@ -325,7 +324,7 @@ interface IActivityTaskManager {
     *                                 stacks.
     * @throws RemoteException
     */
    void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds,
    void resizePrimarySplitScreen(in Rect dockedBounds, in Rect tempDockedTaskBounds,
            in Rect tempDockedTaskInsetBounds,
            in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds);

Loading