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

Commit 6be8f593 authored by Yuichiro Hanada's avatar Yuichiro Hanada
Browse files

Add a custom transtion type, TRANSIT_MINIMIZE

which is used for the minimize action by the minimize button
on the caption bar in ADM

Bug: 361524575
Test: manual - the minimize button works
Flag: com.android.window.flags.enable_minimize_button

Change-Id: I2d331f823d138eb9f092f222c620f3ab2759e89d
parent 784140a0
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class FreeformTaskTransitionHandler

    @Override
    public IBinder startMinimizedModeTransition(WindowContainerTransaction wct) {
        final int type = WindowManager.TRANSIT_TO_BACK;
        final int type = Transitions.TRANSIT_MINIMIZE;
        final IBinder token = mTransitions.startTransition(type, wct, this);
        mPendingTransitionTokens.add(token);
        return token;
@@ -161,7 +161,8 @@ public class FreeformTaskTransitionHandler
                            transition, info.getType(), change);
                    break;
                case WindowManager.TRANSIT_TO_BACK:
                    transitionHandled |= startMinimizeTransition(transition);
                    transitionHandled |= startMinimizeTransition(
                            transition, info.getType(), change);
                    break;
                case WindowManager.TRANSIT_CLOSE:
                    if (change.getTaskInfo().getWindowingMode() == WINDOWING_MODE_FREEFORM) {
@@ -227,8 +228,20 @@ public class FreeformTaskTransitionHandler
        return handled;
    }

    private boolean startMinimizeTransition(IBinder transition) {
        return mPendingTransitionTokens.contains(transition);
    private boolean startMinimizeTransition(
            IBinder transition,
            int type,
            TransitionInfo.Change change) {
        if (!mPendingTransitionTokens.contains(transition)) {
            return false;
        }

        final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
        if (type != Transitions.TRANSIT_MINIMIZE) {
            return false;
        }
        // TODO(b/361524575): Add minimize animations
        return true;
    }

    private boolean startCloseTransition(IBinder transition, TransitionInfo.Change change,
+3 −0
Original line number Diff line number Diff line
@@ -196,6 +196,9 @@ public class Transitions implements RemoteCallable<Transitions>,
    /** Transition to set windowing mode after exit pip transition is finished animating. */
    public static final int TRANSIT_CLEANUP_PIP_EXIT = WindowManager.TRANSIT_FIRST_CUSTOM + 19;

    /** Transition type to minimize a task. */
    public static final int TRANSIT_MINIMIZE = WindowManager.TRANSIT_FIRST_CUSTOM + 20;

    /** Transition type for desktop mode transitions. */
    public static final int TRANSIT_DESKTOP_MODE_TYPES =
            WindowManager.TRANSIT_FIRST_CUSTOM + 100;