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

Commit e75a9adf authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Added support to specify animation duration when resizing stack

Needed for sys-ui to control the duration of various Pip transitions.

Bug: 27674339
Change-Id: I7bad27aaa19755a73c594e88b88b56db033e1a45
parent 2c83702a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1814,7 +1814,7 @@ public class Am extends BaseCommand {

    private void resizeStackUnchecked(int stackId, Rect bounds, int delayMs, boolean animate) {
        try {
            mAm.resizeStack(stackId, bounds, false, false, animate);
            mAm.resizeStack(stackId, bounds, false, false, animate, -1);
            Thread.sleep(delayMs);
        } catch (RemoteException e) {
            showError("Error: resizing stack " + e);
+6 −2
Original line number Diff line number Diff line
@@ -819,7 +819,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            final boolean allowResizeInDockedMode = data.readInt() == 1;
            final boolean preserveWindows = data.readInt() == 1;
            final boolean animate = data.readInt() == 1;
            resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
            final int animationDuration = data.readInt();
            resizeStack(stackId,
                    r, allowResizeInDockedMode, preserveWindows, animate, animationDuration);
            reply.writeNoException();
            return true;
        }
@@ -3881,7 +3883,8 @@ class ActivityManagerProxy implements IActivityManager
    }
    @Override
    public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
            boolean preserveWindows, boolean animate) throws RemoteException {
            boolean preserveWindows, boolean animate, int animationDuration)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
@@ -3895,6 +3898,7 @@ class ActivityManagerProxy implements IActivityManager
        data.writeInt(allowResizeInDockedMode ? 1 : 0);
        data.writeInt(preserveWindows ? 1 : 0);
        data.writeInt(animate ? 1 : 0);
        data.writeInt(animationDuration);
        mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
+16 −1
Original line number Diff line number Diff line
@@ -147,8 +147,23 @@ public interface IActivityManager extends IInterface {
    public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException;
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;

    /**
     * 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
     */
    public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode,
            boolean preserveWindows, boolean animate) throws RemoteException;
            boolean preserveWindows, boolean animate, int animationDuration) throws RemoteException;

    /**
     * Moves all tasks from the docked stack in the fullscreen stack and puts the top task of the
+2 −2
Original line number Diff line number Diff line
@@ -100,8 +100,8 @@ public class WindowManagerProxy {
        @Override
        public void run() {
            try {
                ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true, true,
                        false);
                ActivityManagerNative.getDefault().resizeStack(
                        DOCKED_STACK_ID, null, true, true, false, -1);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to resize stack: " + e);
            }
+1 −1
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ public class PipManager {
                break;
        }
        try {
            mActivityManager.resizeStack(PINNED_STACK_ID, mCurrentPipBounds, true, true, true);
            mActivityManager.resizeStack(PINNED_STACK_ID, mCurrentPipBounds, true, true, true, -1);
        } catch (RemoteException e) {
            Log.e(TAG, "showPipMenu failed", e);
        }
Loading