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

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

Merge "Add TestApi for CtsActivityManagerDeviceTestCases."

parents 3c1a3a41 793e056a
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -8,6 +8,8 @@ package android {
    field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final java.lang.String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
    field public static final java.lang.String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
    field public static final java.lang.String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
    field public static final java.lang.String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
    field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final java.lang.String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION";
  }
  }


}
}
@@ -30,6 +32,8 @@ package android.app {
    method public long getTotalRam();
    method public long getTotalRam();
    method public int getUidImportance(int);
    method public int getUidImportance(int);
    method public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method public void forceStopPackage(java.lang.String);
    method public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
  }
  }


  public static abstract interface ActivityManager.OnUidImportanceListener {
  public static abstract interface ActivityManager.OnUidImportanceListener {
@@ -56,6 +60,14 @@ package android.app {
    method public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
    method public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
    method public static boolean supportsMultiWindow(android.content.Context);
    method public static boolean supportsMultiWindow(android.content.Context);
    method public static boolean supportsSplitScreenMultiWindow(android.content.Context);
    method public static boolean supportsSplitScreenMultiWindow(android.content.Context);
    method public boolean moveTopActivityToPinnedStack(int, android.graphics.Rect);
    method public void startSystemLockTaskMode(int);
    method public void stopSystemLockTaskMode();
    method public void moveTaskToStack(int, int, boolean);
    method public void resizeStack(int, android.graphics.Rect, boolean);
    method public void resizeTask(int, android.graphics.Rect);
    method public void resizeDockedStack(android.graphics.Rect,android.graphics.Rect);
    method public java.lang.String listAllStacks();
    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
    field public static final int SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; // 0x1
    field public static final int SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; // 0x1
    field public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; // 0x0
    field public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; // 0x0
@@ -1456,6 +1468,7 @@ package android.view {
  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public void setActionButton(int);
    method public void setActionButton(int);
    method public void setButtonState(int);
    method public void setButtonState(int);
    method public void setDisplayId(int);
  }
  }


  public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
  public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
+14 −1
Original line number Original line Diff line number Diff line
@@ -3360,7 +3360,7 @@ public class ActivityManager {
     * @see #forceStopPackageAsUser(String, int)
     * @see #forceStopPackageAsUser(String, int)
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi @TestApi
    @RequiresPermission(Manifest.permission.FORCE_STOP_PACKAGES)
    @RequiresPermission(Manifest.permission.FORCE_STOP_PACKAGES)
    public void forceStopPackage(String packageName) {
    public void forceStopPackage(String packageName) {
        forceStopPackageAsUser(packageName, mContext.getUserId());
        forceStopPackageAsUser(packageName, mContext.getUserId());
@@ -3986,6 +3986,19 @@ public class ActivityManager {
        }
        }
    }
    }


    /**
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.CHANGE_CONFIGURATION)
    public void scheduleApplicationInfoChanged(List<String> packages, int userId) {
        try {
            getService().scheduleApplicationInfoChanged(packages, userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
    /**
     * The AppTask allows you to manage your own application's tasks.
     * The AppTask allows you to manage your own application's tasks.
     * See {@link android.app.ActivityManager#getAppTasks()}
     * See {@link android.app.ActivityManager#getAppTasks()}
+138 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,8 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.util.Singleton;
import android.util.Singleton;


import java.util.List;

/**
/**
 * This class gives information about, and interacts with activities and their containers like task,
 * This class gives information about, and interacts with activities and their containers like task,
 * stacks, and displays.
 * stacks, and displays.
@@ -263,4 +265,140 @@ public class ActivityTaskManager {
                && Resources.getSystem().getBoolean(
                && Resources.getSystem().getBoolean(
                com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
                com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
    }
    }

    /**
     * Moves the top activity in the input stackId to the pinned stack.
     * @param stackId Id of stack to move the top activity to pinned stack.
     * @param bounds Bounds to use for pinned stack.
     * @return True if the top activity of stack was successfully moved to the pinned stack.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) {
        try {
            return getService().moveTopActivityToPinnedStack(stackId, bounds);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Start to enter lock task mode for given task by system(UI).
     * @param taskId Id of task to lock.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void startSystemLockTaskMode(int taskId) {
        try {
            getService().startSystemLockTaskMode(taskId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Stop lock task mode by system(UI).
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void stopSystemLockTaskMode() {
        try {
            getService().stopSystemLockTaskMode();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Move task to stack with given id.
     * @param taskId Id of the task to move.
     * @param stackId Id of the stack for task moving.
     * @param toTop Whether the given task should shown to top of stack.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) {
        try {
            getService().moveTaskToStack(taskId, stackId, toTop);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Resize the input stack id to the given bounds with animate setting.
     * @param stackId Id of the stack to resize.
     * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
     * @param animate Whether we should play an animation for resizing stack.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeStack(int stackId, Rect bounds, boolean animate) {
        try {
            getService().resizeStack(stackId, bounds, false, false, animate /* animate */,
                    -1 /* animationDuration */);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Resize task to given bounds.
     * @param taskId Id of task to resize.
     * @param bounds Bounds to resize task.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeTask(int taskId, Rect bounds) {
        try {
            getService().resizeTask(taskId, bounds, RESIZE_MODE_SYSTEM);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Resize docked stack & its task to given stack & task bounds.
     * @param stackBounds Bounds to resize stack.
     * @param taskBounds Bounds to resize task.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public void resizeDockedStack(Rect stackBounds, Rect taskBounds) {
        try {
            getService().resizeDockedStack(stackBounds, taskBounds, null, null, null);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * List all activity stacks information.
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
    public String listAllStacks() {
        final List<ActivityManager.StackInfo> stacks;
        try {
            stacks = getService().getAllStackInfos();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }

        final StringBuilder sb = new StringBuilder();
        if (stacks != null) {
            for (ActivityManager.StackInfo info : stacks) {
                sb.append(info).append("\n");
            }
        }
        return sb.toString();
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -1956,6 +1956,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
    }
    }


    /** @hide */
    /** @hide */
    @TestApi
    @Override
    @Override
    public void setDisplayId(int displayId) {
    public void setDisplayId(int displayId) {
        nativeSetDisplayId(mNativePtr, displayId);
        nativeSetDisplayId(mNativePtr, displayId);
+4 −4
Original line number Original line Diff line number Diff line
@@ -2150,11 +2150,11 @@


    <!-- @SystemApi @TestApi @hide Allows an application to create/manage/remove stacks -->
    <!-- @SystemApi @TestApi @hide Allows an application to create/manage/remove stacks -->
    <permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"
    <permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"
        android:protectionLevel="signature|privileged|development" />
        android:protectionLevel="signature|privileged" />


    <!-- @SystemApi @TestApi @hide Allows an application to embed other activities -->
    <!-- @SystemApi @TestApi @hide Allows an application to embed other activities -->
    <permission android:name="android.permission.ACTIVITY_EMBEDDING"
    <permission android:name="android.permission.ACTIVITY_EMBEDDING"
                android:protectionLevel="signature|privileged|development" />
                android:protectionLevel="signature|privileged" />


    <!-- Allows an application to start any activity, regardless of permission
    <!-- Allows an application to start any activity, regardless of permission
         protection or exported state.
         protection or exported state.
@@ -2387,7 +2387,7 @@
    <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
    <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
        android:protectionLevel="signature" />
        android:protectionLevel="signature" />


    <!-- @SystemApi Allows an application to modify the current configuration, such
    <!-- @SystemApi @TestApi Allows an application to modify the current configuration, such
         as locale. -->
         as locale. -->
    <permission android:name="android.permission.CHANGE_CONFIGURATION"
    <permission android:name="android.permission.CHANGE_CONFIGURATION"
        android:protectionLevel="signature|privileged|development" />
        android:protectionLevel="signature|privileged|development" />
@@ -2414,7 +2414,7 @@
    <permission android:name="android.permission.WRITE_GSERVICES"
    <permission android:name="android.permission.WRITE_GSERVICES"
        android:protectionLevel="signature|privileged" />
        android:protectionLevel="signature|privileged" />


    <!-- @SystemApi Allows an application to call
    <!-- @SystemApi @TestApi Allows an application to call
        {@link android.app.ActivityManager#forceStopPackage}.
        {@link android.app.ActivityManager#forceStopPackage}.
        @hide -->
        @hide -->
    <permission android:name="android.permission.FORCE_STOP_PACKAGES"
    <permission android:name="android.permission.FORCE_STOP_PACKAGES"