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

Commit 2a25dd5c authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Animate pinned stack resizing."

parents 0a4b4cdf 84fa3351
Loading
Loading
Loading
Loading
+22 −8
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
@@ -79,7 +78,6 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;

public class Am extends BaseCommand {
@@ -159,6 +157,7 @@ public class Am extends BaseCommand {
                "       am stack start <DISPLAY_ID> <INTENT>\n" +
                "       am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" +
                "       am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
                "       am stack resize-animated <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
                "       am stack resize-docked-stack <LEFT,TOP,RIGHT,BOTTOM> [<TASK_LEFT,TASK_TOP,TASK_RIGHT,TASK_BOTTOM>]\n" +
                "       am stack size-docked-stack-test: <STEP_SIZE> <l|t|r|b> [DELAY_MS]\n" +
                "       am stack move-top-activity-to-pinned-stack: <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
@@ -1688,6 +1687,9 @@ public class Am extends BaseCommand {
            case "resize":
                runStackResize();
                break;
            case "resize-animated":
                runStackResizeAnimated();
                break;
            case "resize-docked-stack":
                runStackResizeDocked();
                break;
@@ -1756,7 +1758,18 @@ public class Am extends BaseCommand {
            System.err.println("Error: invalid input bounds");
            return;
        }
        resizeStack(stackId, bounds, 0);
        resizeStack(stackId, bounds, 0, false);
    }

    private void runStackResizeAnimated() throws Exception {
        String stackIdStr = nextArgRequired();
        int stackId = Integer.valueOf(stackIdStr);
        final Rect bounds = getBounds();
        if (bounds == null) {
            System.err.println("Error: invalid input bounds");
            return;
        }
        resizeStack(stackId, bounds, 0, true);
    }

    private void runStackResizeDocked() throws Exception {
@@ -1773,14 +1786,15 @@ public class Am extends BaseCommand {
        }
    }

    private void resizeStack(int stackId, Rect bounds, int delayMs) throws Exception {
    private void resizeStack(int stackId, Rect bounds, int delayMs, boolean animate)
            throws Exception {
        if (bounds == null) {
            showError("Error: invalid input bounds");
            return;
        }

        try {
            mAm.resizeStack(stackId, bounds, false);
            mAm.resizeStack(stackId, bounds, false, false, animate);
            Thread.sleep(delayMs);
        } catch (RemoteException e) {
            showError("Error: resizing stack " + e);
@@ -1894,7 +1908,7 @@ public class Am extends BaseCommand {
            maxChange = Math.min(stepSize, currentPoint - minPoint);
            currentPoint -= maxChange;
            setBoundsSide(bounds, side, currentPoint);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs, false);
        }

        System.out.println("Growing docked stack side=" + side);
@@ -1902,7 +1916,7 @@ public class Am extends BaseCommand {
            maxChange = Math.min(stepSize, maxPoint - currentPoint);
            currentPoint += maxChange;
            setBoundsSide(bounds, side, currentPoint);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs, false);
        }

        System.out.println("Back to Original size side=" + side);
@@ -1910,7 +1924,7 @@ public class Am extends BaseCommand {
            maxChange = Math.min(stepSize, currentPoint - startPoint);
            currentPoint -= maxChange;
            setBoundsSide(bounds, side, currentPoint);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs);
            resizeStack(DOCKED_STACK_ID, bounds, delayMs, false);
        }
    }

+9 −2
Original line number Diff line number Diff line
@@ -564,8 +564,7 @@ public class ActivityManager {
         * there isn't a display gap.
         */
        public static boolean preserveWindowOnTaskMove(int stackId) {
            return stackId == FULLSCREEN_WORKSPACE_STACK_ID
                    || stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID;
            return stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
        }

        /**
@@ -616,6 +615,14 @@ public class ActivityManager {
        public static boolean keepVisibleDeadAppWindowOnScreen(int stackId) {
            return stackId != PINNED_STACK_ID;
        }

        /**
         * Returns true if the backdrop on the client side should match the frame of the window.
         * Returns false, if the backdrop should be fullscreen.
         */
        public static boolean useWindowFrameForBackdrop(int stackId) {
            return stackId == FREEFORM_WORKSPACE_STACK_ID || stackId == PINNED_STACK_ID;
        }
    }

    /**
+7 −4
Original line number Diff line number Diff line
@@ -816,7 +816,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
                r = Rect.CREATOR.createFromParcel(data);
            }
            final boolean allowResizeInDockedMode = data.readInt() == 1;
            resizeStack(stackId, r, allowResizeInDockedMode);
            final boolean preserveWindows = data.readInt() == 1;
            final boolean animate = data.readInt() == 1;
            resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
            reply.writeNoException();
            return true;
        }
@@ -3815,9 +3817,8 @@ class ActivityManagerProxy implements IActivityManager
        return res;
    }
    @Override
    public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
            throws RemoteException
    {
    public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
            boolean preserveWindows, boolean animate) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
@@ -3829,6 +3830,8 @@ class ActivityManagerProxy implements IActivityManager
            data.writeInt(0);
        }
        data.writeInt(allowResizeInDockedMode ? 1 : 0);
        data.writeInt(preserveWindows ? 1 : 0);
        data.writeInt(animate ? 1 : 0);
        mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
+2 −2
Original line number Diff line number Diff line
@@ -146,8 +146,8 @@ public interface IActivityManager extends IInterface {
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException;
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;
    public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode)
            throws RemoteException;
    public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode,
            boolean preserveWindows, boolean animate) throws RemoteException;

    /**
     * Resizes the docked stack, and all other stacks as the result of the dock stack bounds change.
+2 −1
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ public class WindowManagerProxy {
        @Override
        public void run() {
            try {
                ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true);
                ActivityManagerNative.getDefault().resizeStack(DOCKED_STACK_ID, null, true, false,
                        false);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to resize stack: " + e);
            }
Loading