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

Commit 8c4fd65f authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Remove some more dead-code from old split impl" into rvc-dev am: e68c8ac0 am: c8b8ac25

Change-Id: Ic1fad8abfb242ef86a098e5c045eebd53fa35da0
parents 38858b47 c8b8ac25
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -299,7 +299,6 @@ interface IActivityTaskManager {
            in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);
            in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);


    void suppressResizeConfigChanges(boolean suppress);
    void suppressResizeConfigChanges(boolean suppress);
    void moveTasksToFullscreenStack(int fromStackId, boolean onTop);
    boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
    boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
    boolean isInMultiWindowMode(in IBinder token);
    boolean isInMultiWindowMode(in IBinder token);
    boolean isInPictureInPictureMode(in IBinder token);
    boolean isInPictureInPictureMode(in IBinder token);
+2 −14
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.activityTypeToString;
import static android.app.WindowConfiguration.activityTypeToString;
import static android.content.Intent.ACTION_MAIN;
import static android.content.Intent.ACTION_MAIN;
import static android.content.Intent.CATEGORY_HOME;
import static android.content.Intent.CATEGORY_HOME;
@@ -109,7 +108,6 @@ import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS;
import static android.view.WindowManager.TRANSIT_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_UNSET;
import static android.view.WindowManager.TRANSIT_UNSET;
import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN;


import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
@@ -5812,18 +5810,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    boolean shouldAnimate(int transit) {
    boolean shouldAnimate() {
        if (task != null && !task.shouldAnimate()) {
        return task == null || task.shouldAnimate();
            return false;
        }
        final boolean isSplitScreenPrimary =
                getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
        final boolean allowSplitScreenPrimaryAnimation = transit != TRANSIT_WALLPAPER_OPEN;

        // We animate always if it's not split screen primary, and only some special cases in split
        // screen primary because it causes issues with stack clipping when we run an un-minimize
        // animation at the same time.
        return !isSplitScreenPrimary || allowSplitScreenPrimaryAnimation;
    }
    }


    /**
    /**
+9 −49
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.ITaskStackListener.FORCED_RESIZEABLE_REASON_SPLIT_SCREEN;
import static android.app.ITaskStackListener.FORCED_RESIZEABLE_REASON_SPLIT_SCREEN;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.PINNED_WINDOWING_MODE_ELEVATION_IN_DIP;
import static android.app.WindowConfiguration.PINNED_WINDOWING_MODE_ELEVATION_IN_DIP;
@@ -685,9 +684,7 @@ class ActivityStack extends Task {
            return;
            return;
        }
        }


        setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
        setWindowingMode(windowingMode, false /* creating */);
                false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
                false /* creating */);
    }
    }


    /**
    /**
@@ -709,23 +706,14 @@ class ActivityStack extends Task {
     * @param preferredWindowingMode the preferred windowing mode. This may not be honored depending
     * @param preferredWindowingMode the preferred windowing mode. This may not be honored depending
     *         on the state of things. For example, WINDOWING_MODE_UNDEFINED will resolve to the
     *         on the state of things. For example, WINDOWING_MODE_UNDEFINED will resolve to the
     *         previous non-transient mode if this stack is currently in a transient mode.
     *         previous non-transient mode if this stack is currently in a transient mode.
     * @param animate Can be used to prevent animation.
     * @param showRecents Controls whether recents is shown on the other side of a split while
     *         entering split mode.
     * @param enteringSplitScreenMode {@code true} if entering split mode.
     * @param deferEnsuringVisibility Whether visibility updates are deferred. This is set when
     *         many operations (which can effect visibility) are being performed in bulk.
     * @param creating {@code true} if this is being run during ActivityStack construction.
     * @param creating {@code true} if this is being run during ActivityStack construction.
     */
     */
    void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents,
    void setWindowingMode(int preferredWindowingMode, boolean creating) {
            boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, boolean creating) {
        mWmService.inSurfaceTransaction(() -> setWindowingModeInSurfaceTransaction(
        mWmService.inSurfaceTransaction(() -> setWindowingModeInSurfaceTransaction(
                preferredWindowingMode, animate, showRecents, enteringSplitScreenMode,
                preferredWindowingMode, creating));
                deferEnsuringVisibility, creating));
    }
    }


    private void setWindowingModeInSurfaceTransaction(int preferredWindowingMode, boolean animate,
    private void setWindowingModeInSurfaceTransaction(int preferredWindowingMode,
            boolean showRecents, boolean enteringSplitScreenMode, boolean deferEnsuringVisibility,
            boolean creating) {
            boolean creating) {
        final int currentMode = getWindowingMode();
        final int currentMode = getWindowingMode();
        final int currentOverrideMode = getRequestedOverrideWindowingMode();
        final int currentOverrideMode = getRequestedOverrideWindowingMode();
@@ -753,12 +741,9 @@ class ActivityStack extends Task {


        final boolean alreadyInSplitScreenMode = taskDisplayArea.isSplitScreenModeActivated();
        final boolean alreadyInSplitScreenMode = taskDisplayArea.isSplitScreenModeActivated();


        // Don't send non-resizeable notifications if the windowing mode changed was a side effect
        // of us entering split-screen mode.
        final boolean sendNonResizeableNotification = !enteringSplitScreenMode;
        // Take any required action due to us not supporting the preferred windowing mode.
        // Take any required action due to us not supporting the preferred windowing mode.
        if (alreadyInSplitScreenMode && windowingMode == WINDOWING_MODE_FULLSCREEN
        if (alreadyInSplitScreenMode && windowingMode == WINDOWING_MODE_FULLSCREEN
                && sendNonResizeableNotification && isActivityTypeStandardOrUndefined()) {
                && isActivityTypeStandardOrUndefined()) {
            final boolean preferredSplitScreen =
            final boolean preferredSplitScreen =
                    preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                    preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                    || preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
                    || preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
@@ -794,7 +779,7 @@ class ActivityStack extends Task {
        if (currentMode == WINDOWING_MODE_PINNED) {
        if (currentMode == WINDOWING_MODE_PINNED) {
            mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
            mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
        }
        }
        if (sendNonResizeableNotification && likelyResolvedMode != WINDOWING_MODE_FULLSCREEN
        if (likelyResolvedMode != WINDOWING_MODE_FULLSCREEN
                && topActivity != null && !topActivity.noDisplay
                && topActivity != null && !topActivity.noDisplay
                && topActivity.isNonResizableOrForcedResizable(likelyResolvedMode)) {
                && topActivity.isNonResizableOrForcedResizable(likelyResolvedMode)) {
            // Inform the user that they are starting an app that may not work correctly in
            // Inform the user that they are starting an app that may not work correctly in
@@ -806,7 +791,7 @@ class ActivityStack extends Task {


        mAtmService.deferWindowLayout();
        mAtmService.deferWindowLayout();
        try {
        try {
            if (!animate && topActivity != null) {
            if (topActivity != null) {
                mStackSupervisor.mNoAnimActivities.add(topActivity);
                mStackSupervisor.mNoAnimActivities.add(topActivity);
            }
            }
            super.setWindowingMode(windowingMode);
            super.setWindowingMode(windowingMode);
@@ -845,37 +830,12 @@ class ActivityStack extends Task {
                        false /*preserveWindows*/, true /*deferResume*/);
                        false /*preserveWindows*/, true /*deferResume*/);
            }
            }
        } finally {
        } finally {
            if (showRecents && !alreadyInSplitScreenMode && isOnHomeDisplay()
                    && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                // Make sure recents stack exist when creating a dock stack as it normally needs to
                // be on the other side of the docked stack and we make visibility decisions based
                // on that.
                // TODO: This is only here to help out with the case where recents stack doesn't
                // exist yet. For that case the initial size of the split-screen stack will be the
                // the one where the home stack is visible since recents isn't visible yet, but the
                // divider will be off. I think we should just make the initial bounds that of home
                // so that the divider matches and remove this logic.
                // TODO: This is currently only called when entering split-screen while in another
                // task, and from the tests
                // TODO (b/78247419): Fix the rotation animation from fullscreen to minimized mode
                final boolean isRecentsComponentHome =
                        mAtmService.getRecentTasks().isRecentsComponentHomeActivity(mCurrentUser);
                final ActivityStack recentStack = taskDisplayArea.getOrCreateStack(
                        WINDOWING_MODE_SPLIT_SCREEN_SECONDARY,
                        isRecentsComponentHome ? ACTIVITY_TYPE_HOME : ACTIVITY_TYPE_RECENTS,
                        true /* onTop */);
                recentStack.moveToFront("setWindowingMode");
                // If task moved to docked stack - show recents if needed.
                mWmService.showRecentApps();
            }
            mAtmService.continueWindowLayout();
            mAtmService.continueWindowLayout();
        }
        }


        if (!deferEnsuringVisibility) {
        mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
        mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
        mRootWindowContainer.resumeFocusedStacksTopActivities();
        mRootWindowContainer.resumeFocusedStacksTopActivities();
    }
    }
    }


    @Override
    @Override
    public boolean isCompatible(int windowingMode, int activityType) {
    public boolean isCompatible(int windowingMode, int activityType) {
+34 −132
Original line number Original line Diff line number Diff line
@@ -80,8 +80,6 @@ import static com.android.server.wm.Task.LOCK_TASK_AUTH_LAUNCHABLE;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_LAUNCHABLE_PRIV;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_LAUNCHABLE_PRIV;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_WHITELISTED;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_WHITELISTED;
import static com.android.server.wm.Task.REPARENT_KEEP_STACK_AT_FRONT;
import static com.android.server.wm.Task.REPARENT_KEEP_STACK_AT_FRONT;
import static com.android.server.wm.Task.REPARENT_LEAVE_STACK_IN_PLACE;
import static com.android.server.wm.Task.REPARENT_MOVE_STACK_TO_FRONT;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
@@ -140,7 +138,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.content.ReferrerIntent;
import com.android.internal.content.ReferrerIntent;
import com.android.internal.os.TransferPipe;
import com.android.internal.os.TransferPipe;
import com.android.internal.os.logging.MetricsLoggerWrapper;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.function.pooled.PooledConsumer;
import com.android.internal.util.function.pooled.PooledConsumer;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.internal.util.function.pooled.PooledLambda;
@@ -382,71 +379,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {


    private boolean mInitialized;
    private boolean mInitialized;


    private final MoveTaskToFullscreenHelper mMoveTaskToFullscreenHelper =
            new MoveTaskToFullscreenHelper();
    private class MoveTaskToFullscreenHelper {
        private TaskDisplayArea mToDisplayArea;
        private boolean mOnTop;
        private Task mTopTask;
        private boolean mSchedulePictureInPictureModeChange;

        void process(ActivityStack fromStack, TaskDisplayArea toDisplayArea, boolean onTop,
                boolean schedulePictureInPictureModeChange) {
            mSchedulePictureInPictureModeChange = schedulePictureInPictureModeChange;
            mToDisplayArea = toDisplayArea;
            mOnTop = onTop;
            mTopTask = fromStack.getTopMostTask();

            final PooledConsumer c = PooledLambda.obtainConsumer(
                    MoveTaskToFullscreenHelper::processLeafTask, this, PooledLambda.__(Task.class));
            fromStack.forAllLeafTasks(c, false /* traverseTopToBottom */);
            c.recycle();
            mToDisplayArea = null;
            mTopTask = null;
        }

        private void processLeafTask(Task task) {
            // This is a one level task that we don't need to create stack for reparenting to.
            if (task.isRootTask() && DisplayContent.alwaysCreateStack(WINDOWING_MODE_FULLSCREEN,
                    task.getActivityType())) {
                final ActivityStack stack = (ActivityStack) task;
                stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
                if (mToDisplayArea.getDisplayId() != stack.getDisplayId()) {
                    stack.reparent(mToDisplayArea, mOnTop);
                } else if (mOnTop) {
                    mToDisplayArea.positionStackAtTop(stack, false /* includingParents */);
                } else {
                    mToDisplayArea.positionStackAtBottom(stack);
                }
                return;
            }

            final ActivityStack toStack = mToDisplayArea.getOrCreateStack(null, mTmpOptions, task,
                    task.getActivityType(), mOnTop);
            if (task == toStack) {
                // The task was reused as the root task.
                return;
            }

            if (mOnTop) {
                final boolean isTopTask = task == mTopTask;
                // Defer resume until all the tasks have been moved to the fullscreen stack
                task.reparent(toStack, ON_TOP, REPARENT_MOVE_STACK_TO_FRONT, isTopTask /*animate*/,
                        DEFER_RESUME, mSchedulePictureInPictureModeChange,
                        "moveTasksToFullscreenStack - onTop");
                MetricsLoggerWrapper.logPictureInPictureFullScreen(mService.mContext,
                        task.effectiveUid, task.realActivity.flattenToString());
            } else {
                // Position the tasks in the fullscreen stack in order at the bottom of the
                // stack. Also defer resume until all the tasks have been moved to the
                // fullscreen stack.
                task.reparent(toStack, ON_TOP, REPARENT_LEAVE_STACK_IN_PLACE,
                        !ANIMATE, DEFER_RESUME, mSchedulePictureInPictureModeChange,
                        "moveTasksToFullscreenStack - NOT_onTop");
            }
        }
    }

    /**
    /**
     * Description of a request to start a new activity, which has been held
     * Description of a request to start a new activity, which has been held
     * due to app switches being disabled.
     * due to app switches being disabled.
@@ -1501,56 +1433,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        mResizingTasksDuringAnimation.clear();
        mResizingTasksDuringAnimation.clear();
    }
    }


    /**
     * TODO: This should just change the windowing mode and resize vs. actually moving task around.
     * Can do that once we are no longer using static stack ids.
     */
    private void moveTasksToFullscreenStackInSurfaceTransaction(ActivityStack fromStack,
            int toDisplayId, boolean onTop) {

        mService.deferWindowLayout();
        try {
            final int windowingMode = fromStack.getWindowingMode();
            final TaskDisplayArea toDisplayArea = mRootWindowContainer
                    .getDisplayContent(toDisplayId).getDefaultTaskDisplayArea();

            if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                // We are moving all tasks from the docked stack to the fullscreen stack,
                // which is dismissing the docked stack, so resize all other stacks to
                // fullscreen here already so we don't end up with resize trashing.
                for (int i = toDisplayArea.getStackCount() - 1; i >= 0; --i) {
                    final ActivityStack otherStack = toDisplayArea.getStackAt(i);
                    if (!otherStack.inSplitScreenSecondaryWindowingMode()) {
                        continue;
                    }
                    otherStack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
                }
            }

            // If we are moving from the pinned stack, then the animation takes care of updating
            // the picture-in-picture mode.
            final boolean schedulePictureInPictureModeChange =
                    windowingMode == WINDOWING_MODE_PINNED;

            if (fromStack.hasChild()) {
                mTmpOptions.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
                mMoveTaskToFullscreenHelper.process(
                        fromStack, toDisplayArea, onTop, schedulePictureInPictureModeChange);
            }

            mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
            mRootWindowContainer.resumeFocusedStacksTopActivities();
        } finally {
            mService.continueWindowLayout();
        }
    }

    void moveTasksToFullscreenStackLocked(ActivityStack fromStack, boolean onTop) {
        // TODO(b/153089193): Support moving within the same task display area
        mWindowManager.inSurfaceTransaction(() ->
                moveTasksToFullscreenStackInSurfaceTransaction(fromStack, DEFAULT_DISPLAY, onTop));
    }

    void setSplitScreenResizing(boolean resizing) {
    void setSplitScreenResizing(boolean resizing) {
        if (resizing == mDockedStackResizing) {
        if (resizing == mDockedStackResizing) {
            return;
            return;
@@ -1560,8 +1442,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        mWindowManager.setDockedStackResizing(resizing);
        mWindowManager.setDockedStackResizing(resizing);
    }
    }


    private void removeStackInSurfaceTransaction(ActivityStack stack) {
    private void removePinnedStackInSurfaceTransaction(ActivityStack stack) {
        if (stack.getWindowingMode() == WINDOWING_MODE_PINNED) {
        /**
        /**
         * Workaround: Force-stop all the activities in the pinned stack before we reparent them
         * Workaround: Force-stop all the activities in the pinned stack before we reparent them
         * to the fullscreen stack.  This is to guarantee that when we are removing a stack,
         * to the fullscreen stack.  This is to guarantee that when we are removing a stack,
@@ -1578,8 +1459,29 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        activityIdleInternal(null /* idleActivity */, false /* fromTimeout */,
        activityIdleInternal(null /* idleActivity */, false /* fromTimeout */,
                true /* processPausingActivities */, null /* configuration */);
                true /* processPausingActivities */, null /* configuration */);


            // Move all the tasks to the bottom of the fullscreen stack
        // Reparent all the tasks to the bottom of the display
            moveTasksToFullscreenStackLocked(stack, !ON_TOP);
        final DisplayContent toDisplay =
                mRootWindowContainer.getDisplayContent(DEFAULT_DISPLAY);

        mService.deferWindowLayout();
        try {
            stack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
            if (toDisplay.getDisplayId() != stack.getDisplayId()) {
                stack.reparent(toDisplay.getDefaultTaskDisplayArea(), false /* onTop */);
            } else {
                toDisplay.mTaskContainers.positionStackAtBottom(stack);
            }

            mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
            mRootWindowContainer.resumeFocusedStacksTopActivities();
        } finally {
            mService.continueWindowLayout();
        }
    }

    private void removeStackInSurfaceTransaction(ActivityStack stack) {
        if (stack.getWindowingMode() == WINDOWING_MODE_PINNED) {
            removePinnedStackInSurfaceTransaction(stack);
        } else {
        } else {
            final PooledConsumer c = PooledLambda.obtainConsumer(
            final PooledConsumer c = PooledLambda.obtainConsumer(
                    ActivityStackSupervisor::processRemoveTask, this, PooledLambda.__(Task.class));
                    ActivityStackSupervisor::processRemoveTask, this, PooledLambda.__(Task.class));
+0 −43
Original line number Original line Diff line number Diff line
@@ -3324,33 +3324,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    Slog.w(TAG, "resizeTask: taskId=" + taskId + " not found");
                    Slog.w(TAG, "resizeTask: taskId=" + taskId + " not found");
                    return;
                    return;
                }
                }
                // Place the task in the right stack if it isn't there already based on
                // the requested bounds.
                // The stack transition logic is:
                // - a null bounds on a freeform task moves that task to fullscreen
                // - a non-null bounds on a non-freeform (fullscreen OR docked) task moves
                //   that task to freeform
                // - otherwise the task is not moved
                ActivityStack stack = task.getStack();
                if (!task.getWindowConfiguration().canResizeTask()) {
                if (!task.getWindowConfiguration().canResizeTask()) {
                    throw new IllegalArgumentException("resizeTask not allowed on task=" + task);
                    throw new IllegalArgumentException("resizeTask not allowed on task=" + task);
                }
                }
                if (bounds == null && stack.getWindowingMode() == WINDOWING_MODE_FREEFORM) {
                    stack = stack.getDisplayArea().getOrCreateStack(
                            WINDOWING_MODE_FULLSCREEN, stack.getActivityType(), ON_TOP);
                } else if (bounds != null && stack.getWindowingMode() != WINDOWING_MODE_FREEFORM) {
                    stack = stack.getDisplayArea().getOrCreateStack(
                            WINDOWING_MODE_FREEFORM, stack.getActivityType(), ON_TOP);
                }


                // Reparent the task to the right stack if necessary
                // Reparent the task to the right stack if necessary
                boolean preserveWindow = (resizeMode & RESIZE_MODE_PRESERVE_WINDOW) != 0;
                boolean preserveWindow = (resizeMode & RESIZE_MODE_PRESERVE_WINDOW) != 0;
                if (stack != task.getStack()) {
                    // Defer resume until the task is resized below
                    task.reparent(stack, ON_TOP, REPARENT_KEEP_STACK_AT_FRONT, ANIMATE,
                            DEFER_RESUME, "resizeTask");
                    preserveWindow = false;
                }


                // After reparenting (which only resizes the task to the stack bounds), resize the
                // After reparenting (which only resizes the task to the stack bounds), resize the
                // task to the actual bounds provided
                // task to the actual bounds provided
@@ -4022,28 +4001,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
        }
    }
    }


    @Override
    // TODO: API should just be about changing windowing modes...
    public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) {
        enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS,
                "moveTasksToFullscreenStack()");
        synchronized (mGlobalLock) {
            final long origId = Binder.clearCallingIdentity();
            try {
                final ActivityStack stack = mRootWindowContainer.getStack(fromStackId);
                if (stack != null){
                    if (!stack.isActivityTypeStandardOrUndefined()) {
                        throw new IllegalArgumentException(
                                "You can't move tasks from non-standard stacks.");
                    }
                    mStackSupervisor.moveTasksToFullscreenStackLocked(stack, onTop);
                }
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }

    /**
    /**
     * Moves the top activity in the input stackId to the pinned stack.
     * Moves the top activity in the input stackId to the pinned stack.
     *
     *
Loading