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

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

Merge "Add ACTIVITY_TYPE and STACK_ID constants to Test API"

parents 5f3af50d e597ca15
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -4013,6 +4013,17 @@ package android.app {
    field public android.content.ComponentName topActivity;
  }
  public static class ActivityManager.StackId {
    field public static final int ASSISTANT_STACK_ID = 6; // 0x6
    field public static final int DOCKED_STACK_ID = 3; // 0x3
    field public static final int FREEFORM_WORKSPACE_STACK_ID = 2; // 0x2
    field public static final int FULLSCREEN_WORKSPACE_STACK_ID = 1; // 0x1
    field public static final int HOME_STACK_ID = 0; // 0x0
    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
    field public static final int PINNED_STACK_ID = 4; // 0x4
    field public static final int RECENTS_STACK_ID = 5; // 0x5
  }
  public static class ActivityManager.TaskDescription implements android.os.Parcelable {
    ctor public ActivityManager.TaskDescription(java.lang.String, android.graphics.Bitmap, int);
    ctor public ActivityManager.TaskDescription(java.lang.String, android.graphics.Bitmap);
@@ -6214,6 +6225,14 @@ package android.app {
    method public abstract void onColorsChanged(android.app.WallpaperColors, int);
  }
  public class WindowConfiguration implements java.lang.Comparable android.os.Parcelable {
    method public int compareTo(android.app.WindowConfiguration);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACTIVITY_TYPE_HOME = 2; // 0x2
    field public static final int ACTIVITY_TYPE_RECENTS = 3; // 0x3
  }
}
package android.app.admin {
+33 −8
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import android.content.pm.IPackageDataObserver;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -62,7 +61,6 @@ import android.os.Debug;
import android.os.Handler;
import android.os.IBinder;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.os.Process;
import android.os.RemoteException;
@@ -665,11 +663,17 @@ public class ActivityManager {
            SystemProperties.getBoolean("debug.force_low_ram", false);

    /** @hide */
    @TestApi
    public static class StackId {

        private StackId() {
        }

        /** Invalid stack ID. */
        public static final int INVALID_STACK_ID = -1;

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

        /** Home activity stack ID. */
@@ -693,25 +697,30 @@ public class ActivityManager {
        /** ID of stack that contains activities launched by the assistant. */
        public static final int ASSISTANT_STACK_ID = RECENTS_STACK_ID + 1;

        /** Last static stack stack ID. */
        /** Last static stack stack ID.
         * @hide */
        public static final int LAST_STATIC_STACK_ID = ASSISTANT_STACK_ID;

        /** Start of ID range used by stacks that are created dynamically. */
        /** 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 dynamic stacks are allowed to be visible behind the input stack.
         * @hide
         */
        // TODO: Figure-out a way to remove.
        public static boolean isDynamicStacksVisibleBehindAllowed(int stackId) {
@@ -721,6 +730,7 @@ public class ActivityManager {
        /**
         * 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) {
@@ -730,6 +740,7 @@ public class ActivityManager {

        /**
         * Returns true if Stack size is affected by the docked stack changing size.
         * @hide
         */
        // TODO: Figure-out a way to remove.
        public static boolean isResizeableByDockedStack(int stackId) {
@@ -740,6 +751,7 @@ public class ActivityManager {
        /**
         * Returns true if the size of tasks in the input stack are affected by the docked stack
         * changing size.
         * @hide
         */
        // TODO: What is the difference between this method and the one above??
        public static boolean isTaskResizeableByDockedStack(int stackId) {
@@ -750,6 +762,7 @@ public class ActivityManager {

        /**
         * Returns true if the input stack is affected by drag resizing.
         * @hide
         */
        public static boolean isStackAffectedByDragResizing(int stackId) {
            return isStaticStack(stackId) && stackId != PINNED_STACK_ID
@@ -760,6 +773,7 @@ public class ActivityManager {
         * 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
@@ -769,6 +783,7 @@ public class ActivityManager {
        /**
         * Return whether a stackId is a stack that be a backdrop to a translucent activity.  These
         * are generally fullscreen stacks.
         * @hide
         */
        public static boolean isBackdropToTranslucentActivity(int stackId) {
            return stackId == FULLSCREEN_WORKSPACE_STACK_ID
@@ -778,6 +793,7 @@ public class ActivityManager {
        /**
         * Returns true if animation specs should be constructed for app transition that moves
         * the task to the specified stack.
         * @hide
         */
        public static boolean useAnimationSpecForAppTransition(int stackId) {
            // TODO: INVALID_STACK_ID is also animated because we don't persist stack id's across
@@ -792,6 +808,7 @@ public class ActivityManager {
        /**
         * Returns true if activities from stasks in the given {@param stackId} are allowed to
         * enter picture-in-picture.
         * @hide
         */
        public static boolean isAllowedToEnterPictureInPicture(int stackId) {
            return stackId != HOME_STACK_ID && stackId != ASSISTANT_STACK_ID &&
@@ -801,6 +818,7 @@ public class ActivityManager {
        /**
         * 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;
@@ -809,6 +827,7 @@ public class ActivityManager {
        /**
         * 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;
@@ -819,6 +838,7 @@ public class ActivityManager {
         * 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) {
@@ -830,6 +850,7 @@ public class ActivityManager {
         * Returns true if the input stack id should only be present on a device that supports
         * multi-window mode.
         * @see android.app.ActivityManager#supportsMultiWindow
         * @hide
         */
        // TODO: What about the other side of docked stack if we move this to WindowConfiguration?
        public static boolean isMultiWindowStack(int stackId) {
@@ -839,12 +860,14 @@ public class ActivityManager {

        /**
         * Returns true if the input {@param stackId} is HOME_STACK_ID or RECENTS_STACK_ID
         * @hide
         */
        public static boolean isHomeOrRecentsStack(int stackId) {
            return stackId == HOME_STACK_ID || stackId == RECENTS_STACK_ID;
        }

        /** Returns true if the input stack and its content can affect the device orientation. */
        /** Returns true if the input stack and its content can affect the device orientation.
         * @hide */
        public static boolean canSpecifyOrientation(int stackId) {
            return stackId == HOME_STACK_ID
                    || stackId == RECENTS_STACK_ID
@@ -853,7 +876,8 @@ public class ActivityManager {
                    || isDynamicStack(stackId);
        }

        /** Returns the windowing mode that should be used for this input 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) {
            final int windowingMode;
@@ -879,7 +903,8 @@ public class ActivityManager {
            return windowingMode;
        }

        /** Returns the activity type that should be used for this input stack id. */
        /** Returns the activity type 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 getActivityTypeForStackId(int stackId) {
            final int activityType;
+59 −13
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.app;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Parcel;
@@ -31,6 +32,7 @@ import android.view.DisplayInfo;
 * up-to-date and ran anytime changes are made to this class.
 * @hide
 */
@TestApi
public class WindowConfiguration implements Parcelable, Comparable<WindowConfiguration> {

    /**
@@ -44,17 +46,23 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /** The current windowing mode of the configuration. */
    private @WindowingMode int mWindowingMode;

    /** Windowing mode is currently not defined. */
    /** Windowing mode is currently not defined.
     * @hide */
    public static final int WINDOWING_MODE_UNDEFINED = 0;
    /** Occupies the full area of the screen or the parent container. */
    /** Occupies the full area of the screen or the parent container.
     * @hide */
    public static final int WINDOWING_MODE_FULLSCREEN = 1;
    /** Always on-top (always visible). of other siblings in its parent container. */
    /** Always on-top (always visible). of other siblings in its parent container.
     * @hide */
    public static final int WINDOWING_MODE_PINNED = 2;
    /** Occupies a dedicated region of the screen or its parent container. */
    /** Occupies a dedicated region of the screen or its parent container.
     * @hide */
    public static final int WINDOWING_MODE_DOCKED = 3;
    /** Can be freely resized within its parent container. */
    /** Can be freely resized within its parent container.
     * @hide */
    public static final int WINDOWING_MODE_FREEFORM = 4;

    /** @hide */
    @IntDef({
            WINDOWING_MODE_UNDEFINED,
            WINDOWING_MODE_FULLSCREEN,
@@ -67,17 +75,21 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /** The current activity type of the configuration. */
    private @ActivityType int mActivityType;

    /** Activity type is currently not defined. */
    /** Activity type is currently not defined.
     * @hide */
    public static final int ACTIVITY_TYPE_UNDEFINED = 0;
    /** Standard activity type. Nothing special about the activity... */
    /** Standard activity type. Nothing special about the activity...
     * @hide */
    public static final int ACTIVITY_TYPE_STANDARD = 1;
    /** Home/Launcher activity type. */
    public static final int ACTIVITY_TYPE_HOME = 2;
    /** Recents/Overview activity type. */
    public static final int ACTIVITY_TYPE_RECENTS = 3;
    /** Assistant activity type. */
    /** Assistant activity type.
     * @hide */
    public static final int ACTIVITY_TYPE_ASSISTANT = 4;

    /** @hide */
    @IntDef({
            ACTIVITY_TYPE_UNDEFINED,
            ACTIVITY_TYPE_STANDARD,
@@ -87,13 +99,17 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    })
    public @interface ActivityType {}

    /** Bit that indicates that the {@link #mAppBounds} changed. */
    /** Bit that indicates that the {@link #mAppBounds} changed.
     * @hide */
    public static final int WINDOW_CONFIG_APP_BOUNDS = 1 << 0;
    /** Bit that indicates that the {@link #mWindowingMode} changed. */
    /** Bit that indicates that the {@link #mWindowingMode} changed.
     * @hide */
    public static final int WINDOW_CONFIG_WINDOWING_MODE = 1 << 1;
    /** Bit that indicates that the {@link #mActivityType} changed. */
    /** Bit that indicates that the {@link #mActivityType} changed.
     * @hide */
    public static final int WINDOW_CONFIG_ACTIVITY_TYPE = 1 << 2;

    /** @hide */
    @IntDef(flag = true,
            value = {
                    WINDOW_CONFIG_APP_BOUNDS,
@@ -102,10 +118,12 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
            })
    public @interface WindowConfig {}

    /** @hide */
    public WindowConfiguration() {
        unset();
    }

    /** @hide */
    public WindowConfiguration(WindowConfiguration configuration) {
        setTo(configuration);
    }
@@ -132,6 +150,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return 0;
    }

    /** @hide */
    public static final Creator<WindowConfiguration> CREATOR = new Creator<WindowConfiguration>() {
        @Override
        public WindowConfiguration createFromParcel(Parcel in) {
@@ -148,6 +167,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * Set {@link #mAppBounds} to the input Rect.
     * @param rect The rect value to set {@link #mAppBounds} to.
     * @see #getAppBounds()
     * @hide
     */
    public void setAppBounds(Rect rect) {
        if (rect == null) {
@@ -161,6 +181,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * @see #setAppBounds(Rect)
     * @see #getAppBounds()
     * @hide
     */
    public void setAppBounds(int left, int top, int right, int bottom) {
        if (mAppBounds == null) {
@@ -172,20 +193,24 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu

    /**
     * @see #setAppBounds(Rect)
     * @hide
     */
    public Rect getAppBounds() {
        return mAppBounds;
    }

    /** @hide */
    public void setWindowingMode(@WindowingMode int windowingMode) {
        mWindowingMode = windowingMode;
    }

    /** @hide */
    @WindowingMode
    public int getWindowingMode() {
        return mWindowingMode;
    }

    /** @hide */
    public void setActivityType(@ActivityType int activityType) {
        if (mActivityType == activityType) {
            return;
@@ -198,22 +223,26 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        mActivityType = activityType;
    }

    /** @hide */
    @ActivityType
    public int getActivityType() {
        return mActivityType;
    }

    /** @hide */
    public void setTo(WindowConfiguration other) {
        setAppBounds(other.mAppBounds);
        setWindowingMode(other.mWindowingMode);
        setActivityType(other.mActivityType);
    }

    /** Set this object to completely undefined. */
    /** Set this object to completely undefined.
     * @hide */
    public void unset() {
        setToDefaults();
    }

    /** @hide */
    public void setToDefaults() {
        setAppBounds(null);
        setWindowingMode(WINDOWING_MODE_UNDEFINED);
@@ -226,6 +255,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * are ignored and not copied in to the current Configuration.
     *
     * @return a bit mask of the changed fields, as per {@link #diff}
     * @hide
     */
    public @WindowConfig int updateFrom(@NonNull WindowConfiguration delta) {
        int changed = 0;
@@ -255,6 +285,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * values has changed, containing any combination of {@link WindowConfig} flags.
     *
     * @see Configuration#diff(Configuration)
     * @hide
     */
    public @WindowConfig long diff(WindowConfiguration other, boolean compareUndefined) {
        long changes = 0;
@@ -305,6 +336,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return n;
    }

    /** @hide */
    @Override
    public boolean equals(Object that) {
        if (that == null) return false;
@@ -315,6 +347,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return this.compareTo((WindowConfiguration) that) == 0;
    }

    /** @hide */
    @Override
    public int hashCode() {
        int result = 0;
@@ -326,6 +359,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return result;
    }

    /** @hide */
    @Override
    public String toString() {
        return "{mAppBounds=" + mAppBounds
@@ -336,6 +370,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if the activities associated with this window configuration display a shadow
     * around their border.
     * @hide
     */
    public boolean hasWindowShadow() {
        return tasksAreFloating();
@@ -344,6 +379,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if the activities associated with this window configuration display a decor
     * view.
     * @hide
     */
    public boolean hasWindowDecorCaption() {
        return mWindowingMode == WINDOWING_MODE_FREEFORM;
@@ -352,12 +388,14 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if the tasks associated with this window configuration can be resized
     * independently of their parent container.
     * @hide
     */
    public boolean canResizeTask() {
        return mWindowingMode == WINDOWING_MODE_FREEFORM;
    }

    /** Returns true if the task bounds should persist across power cycles. */
    /** Returns true if the task bounds should persist across power cycles.
     * @hide */
    public boolean persistTaskBounds() {
        return mWindowingMode == WINDOWING_MODE_FREEFORM;
    }
@@ -366,6 +404,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * Returns true if the tasks associated with this window configuration are floating.
     * Floating tasks are laid out differently as they are allowed to extend past the display bounds
     * without overscan insets.
     * @hide
     */
    public boolean tasksAreFloating() {
        return mWindowingMode == WINDOWING_MODE_FREEFORM || mWindowingMode == WINDOWING_MODE_PINNED;
@@ -373,6 +412,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu

    /**
     * Returns true if the windows associated with this window configuration can receive input keys.
     * @hide
     */
    public boolean canReceiveKeys() {
        return mWindowingMode != WINDOWING_MODE_PINNED;
@@ -381,6 +421,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if the container associated with this window configuration is always-on-top of
     * its siblings.
     * @hide
     */
    public boolean isAlwaysOnTop() {
        return mWindowingMode == WINDOWING_MODE_PINNED;
@@ -389,6 +430,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if any visible windows belonging to apps with this window configuration should
     * be kept on screen when the app is killed due to something like the low memory killer.
     * @hide
     */
    public boolean keepVisibleDeadAppWindowOnScreen() {
        return mWindowingMode != WINDOWING_MODE_PINNED;
@@ -397,6 +439,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if the backdrop on the client side should match the frame of the window.
     * Returns false, if the backdrop should be fullscreen.
     * @hide
     */
    public boolean useWindowFrameForBackdrop() {
        return mWindowingMode == WINDOWING_MODE_FREEFORM || mWindowingMode == WINDOWING_MODE_PINNED;
@@ -405,6 +448,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
    /**
     * Returns true if this container may be scaled without resizing, and windows within may need
     * to be configured as such.
     * @hide
     */
    public boolean windowsAreScaleable() {
        return mWindowingMode == WINDOWING_MODE_PINNED;
@@ -412,6 +456,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu

    /**
     * Returns true if windows in this container should be given move animations by default.
     * @hide
     */
    public boolean hasMovementAnimations() {
        return mWindowingMode == WINDOWING_MODE_PINNED;
@@ -428,6 +473,7 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return String.valueOf(windowingMode);
    }

    /** @hide */
    public static String activityTypeToString(@ActivityType int applicationType) {
        switch (applicationType) {
            case ACTIVITY_TYPE_UNDEFINED: return "undefined";