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

Commit dbe2ce5e authored by Evan Rosky's avatar Evan Rosky
Browse files

Unify Window resize (1/N)

This decouples the Split and Pinned stack resize flows. The
current goal is to prepare for a leashed resize implementation
for split-screen. For this to work, it needs to be clear
what actual logic belongs to the various docked resizing modes
vs what is for general stack resize or pinned resize. This
also enables PiP and Split to be worked-on in parallel.

As can be seen, general stack resize is actually not required
because freeform and fullscreen modes use task resize.

Bug: 119687367
Test: go/wm-smoke + related CTS
Change-Id: I9cca1910a18b87dda618235e89f2bdc582086f34
parent a4cc3a93
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -96,8 +96,7 @@ package android.app {
    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 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 removeStacksWithActivityTypes(int[]) throws java.lang.SecurityException;
    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 resizeDockedStack(android.graphics.Rect, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeStack(int, android.graphics.Rect) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizePinnedStack(int, android.graphics.Rect, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeStack(int, android.graphics.Rect, boolean);
    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 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 void setDisplayToSingleTaskInstance(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
+6 −18
Original line number Original line Diff line number Diff line
@@ -201,21 +201,6 @@ public class ActivityTaskManager {
        }
        }
    }
    }


    /**
     * Resizes the input stack id to the given bounds.
     * @param stackId Id of the stack to resize.
     * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeStack(int stackId, Rect bounds) throws SecurityException {
        try {
            getService().resizeStack(stackId, bounds, false /* allowResizeInDockedMode */,
                    false /* preserveWindows */, false /* animate */, -1 /* animationDuration */);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
    /**
     * Removes stacks in the windowing modes from the system if they are of activity type
     * Removes stacks in the windowing modes from the system if they are of activity type
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
@@ -362,10 +347,13 @@ public class ActivityTaskManager {
     * @param animate Whether we should play an animation for resizing stack.
     * @param animate Whether we should play an animation for resizing stack.
     */
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeStack(int stackId, Rect bounds, boolean animate) {
    public void resizePinnedStack(int stackId, Rect bounds, boolean animate) {
        try {
        try {
            getService().resizeStack(stackId, bounds, false, false, animate /* animate */,
            if (animate) {
                    -1 /* animationDuration */);
                getService().animateResizePinnedStack(stackId, bounds, -1 /* animationDuration */);
            } else {
                getService().resizePinnedStack(bounds, null /* tempPinnedTaskBounds */);
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+0 −17
Original line number Original line Diff line number Diff line
@@ -397,23 +397,6 @@ interface IActivityManager {
    List<ActivityManager.StackInfo> getAllStackInfos();
    List<ActivityManager.StackInfo> getAllStackInfos();
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    /**
     * Resizes the input stack id to the given bounds.
     *
     * @param stackId Id of the stack to resize.
     * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
     * @param allowResizeInDockedMode True if the resize should be allowed when the docked stack is
     *                                active.
     * @param preserveWindows True if the windows of activities contained in the stack should be
     *                        preserved.
     * @param animate True if the stack resize should be animated.
     * @param animationDuration The duration of the resize animation in milliseconds or -1 if the
     *                          default animation duration should be used.
     * @throws RemoteException
     */
    @UnsupportedAppUsage
    void resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode,
            boolean preserveWindows, boolean animate, int animationDuration);
    void setFocusedStack(int stackId);
    void setFocusedStack(int stackId);
    ActivityManager.StackInfo getFocusedStackInfo();
    ActivityManager.StackInfo getFocusedStackInfo();
    @UnsupportedAppUsage
    @UnsupportedAppUsage
+3 −9
Original line number Original line Diff line number Diff line
@@ -234,21 +234,15 @@ interface IActivityTaskManager {
    void setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
    void setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    void moveTaskToStack(int taskId, int stackId, boolean toTop);
    /**
    /**
     * Resizes the input stack id to the given bounds.
     * Resizes the input pinned stack to the given bounds with animation.
     *
     *
     * @param stackId Id of the stack to resize.
     * @param stackId Id of the pinned stack to resize.
     * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
     * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
     * @param allowResizeInDockedMode True if the resize should be allowed when the docked stack is
     *                                active.
     * @param preserveWindows True if the windows of activities contained in the stack should be
     *                        preserved.
     * @param animate True if the stack resize should be animated.
     * @param animationDuration The duration of the resize animation in milliseconds or -1 if the
     * @param animationDuration The duration of the resize animation in milliseconds or -1 if the
     *                          default animation duration should be used.
     *                          default animation duration should be used.
     * @throws RemoteException
     * @throws RemoteException
     */
     */
    void resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode,
    void animateResizePinnedStack(int stackId, in Rect bounds, int animationDuration);
            boolean preserveWindows, boolean animate, int animationDuration);
    boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop,
    boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop,
            boolean animate, in Rect initialBounds, boolean showRecents);
            boolean animate, in Rect initialBounds, boolean showRecents);
    /**
    /**
+2 −3
Original line number Original line Diff line number Diff line
@@ -551,9 +551,8 @@ public class PipMotionHelper implements Handler.Callback, PipAppOpsListener.Call
                        return true;
                        return true;
                    }
                    }


                    mActivityTaskManager.resizeStack(stackInfo.stackId, toBounds,
                    mActivityTaskManager.animateResizePinnedStack(stackInfo.stackId, toBounds,
                            false /* allowResizeInDockedMode */, true /* preserveWindows */,
                            duration);
                            true /* animate */, duration);
                    mBounds.set(toBounds);
                    mBounds.set(toBounds);
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    Log.e(TAG, "Could not animate resize pinned stack to bounds: " + toBounds, e);
                    Log.e(TAG, "Could not animate resize pinned stack to bounds: " + toBounds, e);
Loading