diff options
| -rw-r--r-- | api/test-current.txt | 13 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 15 | ||||
| -rw-r--r-- | core/java/android/app/ActivityTaskManager.java | 138 | ||||
| -rw-r--r-- | core/java/android/view/MotionEvent.java | 1 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 8 |
5 files changed, 170 insertions, 5 deletions
diff --git a/api/test-current.txt b/api/test-current.txt index 9dc61ee4c0dd..5a65902bd75f 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -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 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 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 int getUidImportance(int); 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 { @@ -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 static boolean supportsMultiWindow(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 SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; // 0x1 field public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; // 0x0 @@ -1446,6 +1458,7 @@ package android.view { public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable { method public void setActionButton(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 { diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 1105ed68a8d8..73a52bece781 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -3311,7 +3311,7 @@ public class ActivityManager { * @see #forceStopPackageAsUser(String, int) * @hide */ - @SystemApi + @SystemApi @TestApi @RequiresPermission(Manifest.permission.FORCE_STOP_PACKAGES) public void forceStopPackage(String packageName) { forceStopPackageAsUser(packageName, mContext.getUserId()); @@ -3933,6 +3933,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. * See {@link android.app.ActivityManager#getAppTasks()} */ diff --git a/core/java/android/app/ActivityTaskManager.java b/core/java/android/app/ActivityTaskManager.java index 2f18b89d9c69..af8aa4e7c3b4 100644 --- a/core/java/android/app/ActivityTaskManager.java +++ b/core/java/android/app/ActivityTaskManager.java @@ -29,6 +29,8 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Singleton; +import java.util.List; + /** * This class gives information about, and interacts with activities and their containers like task, * stacks, and displays. @@ -263,4 +265,140 @@ public class ActivityTaskManager { && Resources.getSystem().getBoolean( 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(); + } } diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 344806aa4d50..61f851c8b82b 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1949,6 +1949,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { } /** @hide */ + @TestApi @Override public void setDisplayId(int displayId) { nativeSetDisplayId(mNativePtr, displayId); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index f9d81bad87df..4d5c6c514014 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2076,11 +2076,11 @@ <!-- @SystemApi @TestApi @hide Allows an application to create/manage/remove 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 --> <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 protection or exported state. @@ -2313,7 +2313,7 @@ <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY" 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. --> <permission android:name="android.permission.CHANGE_CONFIGURATION" android:protectionLevel="signature|privileged|development" /> @@ -2340,7 +2340,7 @@ <permission android:name="android.permission.WRITE_GSERVICES" android:protectionLevel="signature|privileged" /> - <!-- @SystemApi Allows an application to call + <!-- @SystemApi @TestApi Allows an application to call {@link android.app.ActivityManager#forceStopPackage}. @hide --> <permission android:name="android.permission.FORCE_STOP_PACKAGES" |