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

Commit f65d1669 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removed remaining use of static stack ids."

parents 6ecf046c 44f036fd
Loading
Loading
Loading
Loading
+0 −132
Original line number Diff line number Diff line
@@ -670,138 +670,6 @@ public class ActivityManager {
        /** Invalid stack ID. */
        public static final int INVALID_STACK_ID = -1;

        /** First static stack ID.
         * @hide */
        private  static final int FIRST_STATIC_STACK_ID = 0;

        /** ID of stack where fullscreen activities are normally launched into.
         * @hide */
        public static final int FULLSCREEN_WORKSPACE_STACK_ID = 1;

        /** ID of stack where freeform/resized activities are normally launched into.
         * @hide */
        public static final int FREEFORM_WORKSPACE_STACK_ID = FULLSCREEN_WORKSPACE_STACK_ID + 1;

        /** ID of stack that occupies a dedicated region of the screen.
         * @hide */
        public static final int DOCKED_STACK_ID = FREEFORM_WORKSPACE_STACK_ID + 1;

        /** ID of stack that always on top (always visible) when it exist.
         * @hide */
        public static final int PINNED_STACK_ID = DOCKED_STACK_ID + 1;

        /** Last static stack stack ID.
         * @hide */
        private static final int LAST_STATIC_STACK_ID = PINNED_STACK_ID;

        /** Start of ID range used by stacks that are created dynamically.
         * @hide */
        public static final int FIRST_DYNAMIC_STACK_ID = LAST_STATIC_STACK_ID + 1;

        // TODO: Figure-out a way to remove this.
        /** @hide */
        public static boolean isStaticStack(int stackId) {
            return stackId >= FIRST_STATIC_STACK_ID && stackId <= LAST_STATIC_STACK_ID;
        }

        // TODO: It seems this mostly means a stack on a secondary display now. Need to see if
        // there are other meanings. If not why not just use information from the display?
        /** @hide */
        public static boolean isDynamicStack(int stackId) {
            return stackId >= FIRST_DYNAMIC_STACK_ID;
        }

        /**
         * Returns true if we try to maintain focus in the current stack when the top activity
         * finishes.
         * @hide
         */
        // TODO: Figure-out a way to remove. Probably isn't needed in the new world...
        public static boolean keepFocusInStackIfPossible(int stackId) {
            return stackId == FREEFORM_WORKSPACE_STACK_ID
                    || stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID;
        }

        /**
         * Returns true if the windows of tasks being moved to the target stack from the source
         * stack should be replaced, meaning that window manager will keep the old window around
         * until the new is ready.
         * @hide
         */
        public static boolean replaceWindowsOnTaskMove(int sourceStackId, int targetStackId) {
            return sourceStackId == FREEFORM_WORKSPACE_STACK_ID
                    || targetStackId == FREEFORM_WORKSPACE_STACK_ID;
        }

        /**
         * Returns true if the top task in the task is allowed to return home when finished and
         * there are other tasks in the stack.
         * @hide
         */
        public static boolean allowTopTaskToReturnHome(int stackId) {
            return stackId != PINNED_STACK_ID;
        }

        /**
         * Returns true if the stack should be resized to match the bounds specified by
         * {@link ActivityOptions#setLaunchBounds} when launching an activity into the stack.
         * @hide
         */
        public static boolean resizeStackWithLaunchBounds(int stackId) {
            return stackId == PINNED_STACK_ID;
        }

        /**
         * Returns true if a window from the specified stack with {@param stackId} are normally
         * fullscreen, i. e. they can become the top opaque fullscreen window, meaning that it
         * controls system bars, lockscreen occluded/dismissing state, screen rotation animation,
         * etc.
         * @hide
         */
        // TODO: What about the other side of docked stack if we move this to WindowConfiguration?
        public static boolean normallyFullscreenWindows(int stackId) {
            return stackId != PINNED_STACK_ID && stackId != FREEFORM_WORKSPACE_STACK_ID
                    && stackId != DOCKED_STACK_ID;
        }

        /** Returns the stack id for the input windowing mode.
         * @hide */
        // TODO: To be removed once we are not using stack id for stuff...
        public static int getStackIdForWindowingMode(int windowingMode) {
            switch (windowingMode) {
                case WINDOWING_MODE_PINNED: return PINNED_STACK_ID;
                case WINDOWING_MODE_FREEFORM: return FREEFORM_WORKSPACE_STACK_ID;
                case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: return DOCKED_STACK_ID;
                case WINDOWING_MODE_SPLIT_SCREEN_SECONDARY: return FULLSCREEN_WORKSPACE_STACK_ID;
                case WINDOWING_MODE_FULLSCREEN: return FULLSCREEN_WORKSPACE_STACK_ID;
                default: return INVALID_STACK_ID;
            }
        }

        /** Returns the windowing mode that should be used for this input stack id.
         * @hide */
        // TODO: To be removed once we are not using stack id for stuff...
        public static int getWindowingModeForStackId(int stackId, boolean inSplitScreenMode) {
            final int windowingMode;
            switch (stackId) {
                case FULLSCREEN_WORKSPACE_STACK_ID:
                    windowingMode = inSplitScreenMode
                            ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY : WINDOWING_MODE_FULLSCREEN;
                    break;
                case PINNED_STACK_ID:
                    windowingMode = WINDOWING_MODE_PINNED;
                    break;
                case DOCKED_STACK_ID:
                    windowingMode = WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
                    break;
                case FREEFORM_WORKSPACE_STACK_ID:
                    windowingMode = WINDOWING_MODE_FREEFORM;
                    break;
                default :
                    windowingMode = WINDOWING_MODE_UNDEFINED;
            }
            return windowingMode;
        }
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.app;

import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.Display.INVALID_DISPLAY;
+2 −1
Original line number Diff line number Diff line
@@ -511,7 +511,8 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return windowingMode != WINDOWING_MODE_FREEFORM && windowingMode != WINDOWING_MODE_PINNED;
    }

    private static String windowingModeToString(@WindowingMode int windowingMode) {
    /** @hide */
    public static String windowingModeToString(@WindowingMode int windowingMode) {
        switch (windowingMode) {
            case WINDOWING_MODE_UNDEFINED: return "undefined";
            case WINDOWING_MODE_FULLSCREEN: return "fullscreen";
+2 −2
Original line number Diff line number Diff line
@@ -335,8 +335,8 @@ public abstract class WindowManagerInternal {
    public abstract void setOnHardKeyboardStatusChangeListener(
        OnHardKeyboardStatusChangeListener listener);

    /** Returns true if the stack with the input Id is currently visible. */
    public abstract boolean isStackVisible(int stackId);
    /** Returns true if a stack in the windowing mode is currently visible. */
    public abstract boolean isStackVisible(int windowingMode);

    /**
     * @return True if and only if the docked divider is currently in resize mode.
+2 −5
Original line number Diff line number Diff line
@@ -467,11 +467,8 @@ public interface WindowManagerPolicy {
         */
        public boolean isDimming();

        /**
         * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
         *         not attached to any stack.
         */
        int getStackId();
        /** @return the current windowing mode of this window. */
        int getWindowingMode();

        /**
         * Returns true if the window is current in multi-windowing mode. i.e. it shares the
Loading