Merge "Add lock task check when entering split screen"
This commit is contained in:
@@ -118,8 +118,8 @@ package android.app {
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizePinnedStack(int, android.graphics.Rect, boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeTask(int, android.graphics.Rect);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setDisplayToSingleTaskInstance(int);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void startSystemLockTaskMode(int);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void stopSystemLockTaskMode();
|
||||
method public static boolean supportsMultiWindow(android.content.Context);
|
||||
|
||||
@@ -182,12 +182,13 @@ public class ActivityTaskManager {
|
||||
* @param taskId The id of the task to set the windowing mode for.
|
||||
* @param windowingMode The windowing mode to set for the task.
|
||||
* @param toTop If the task should be moved to the top once the windowing mode changes.
|
||||
* @return Whether the task was successfully put into the specified windowing mode.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
|
||||
public void setTaskWindowingMode(int taskId, int windowingMode, boolean toTop)
|
||||
public boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop)
|
||||
throws SecurityException {
|
||||
try {
|
||||
getService().setTaskWindowingMode(taskId, windowingMode, toTop);
|
||||
return getService().setTaskWindowingMode(taskId, windowingMode, toTop);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -208,13 +209,14 @@ public class ActivityTaskManager {
|
||||
* docked stack. Pass {@code null} to use default bounds.
|
||||
* @param showRecents If the recents activity should be shown on the other side of the task
|
||||
* going into split-screen mode.
|
||||
* @return Whether the task was successfully put into splitscreen.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
|
||||
public void setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop,
|
||||
public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop,
|
||||
boolean animate, Rect initialBounds, boolean showRecents) throws SecurityException {
|
||||
try {
|
||||
getService().setTaskWindowingModeSplitScreenPrimary(taskId, createMode, toTop, animate,
|
||||
initialBounds, showRecents);
|
||||
return getService().setTaskWindowingModeSplitScreenPrimary(taskId, createMode, toTop,
|
||||
animate, initialBounds, showRecents);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -231,8 +231,9 @@ interface IActivityTaskManager {
|
||||
* @param taskId The id of the task to set the windowing mode for.
|
||||
* @param windowingMode The windowing mode to set for the task.
|
||||
* @param toTop If the task should be moved to the top once the windowing mode changes.
|
||||
* @return Whether the task was successfully put into the specified windowing mode.
|
||||
*/
|
||||
void setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
|
||||
boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
|
||||
void moveTaskToStack(int taskId, int stackId, boolean toTop);
|
||||
/**
|
||||
* Resizes the input pinned stack to the given bounds with animation.
|
||||
|
||||
@@ -2247,11 +2247,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskWindowingMode(int taskId, int windowingMode, boolean toTop) {
|
||||
public boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop) {
|
||||
if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
|
||||
setTaskWindowingModeSplitScreenPrimary(taskId, SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT,
|
||||
return setTaskWindowingModeSplitScreenPrimary(taskId,
|
||||
SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT,
|
||||
toTop, ANIMATE, null /* initialBounds */, true /* showRecents */);
|
||||
return;
|
||||
}
|
||||
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "setTaskWindowingMode()");
|
||||
synchronized (mGlobalLock) {
|
||||
@@ -2261,7 +2261,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
MATCH_TASK_IN_STACKS_ONLY);
|
||||
if (task == null) {
|
||||
Slog.w(TAG, "setTaskWindowingMode: No task for id=" + taskId);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DEBUG_STACK) Slog.d(TAG_STACK, "setTaskWindowingMode: moving task=" + taskId
|
||||
@@ -2278,6 +2278,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
stack.moveToFront("setTaskWindowingMode", task);
|
||||
}
|
||||
stack.setWindowingMode(windowingMode);
|
||||
return true;
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
@@ -2696,6 +2697,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
* stack. Pass {@code null} to use default bounds.
|
||||
* @param showRecents If the recents activity should be shown on the other side of the task
|
||||
* going into split-screen mode.
|
||||
* @return Whether the task was successfully put into splitscreen.
|
||||
*/
|
||||
@Override
|
||||
public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode,
|
||||
@@ -2705,20 +2707,26 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
synchronized (mGlobalLock) {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
if (isInLockTaskMode()) {
|
||||
Slog.w(TAG, "setTaskWindowingModeSplitScreenPrimary: Is in lock task mode="
|
||||
+ getLockTaskModeState());
|
||||
return false;
|
||||
}
|
||||
|
||||
final Task task = mRootWindowContainer.anyTaskForId(taskId,
|
||||
MATCH_TASK_IN_STACKS_ONLY);
|
||||
if (task == null) {
|
||||
Slog.w(TAG, "setTaskWindowingModeSplitScreenPrimary: No task for id=" + taskId);
|
||||
return false;
|
||||
}
|
||||
if (DEBUG_STACK) Slog.d(TAG_STACK,
|
||||
"setTaskWindowingModeSplitScreenPrimary: moving task=" + taskId
|
||||
+ " to createMode=" + createMode + " toTop=" + toTop);
|
||||
if (!task.isActivityTypeStandardOrUndefined()) {
|
||||
throw new IllegalArgumentException("setTaskWindowingMode: Attempt to move"
|
||||
+ " non-standard task " + taskId + " to split-screen windowing mode");
|
||||
}
|
||||
|
||||
if (DEBUG_STACK) Slog.d(TAG_STACK,
|
||||
"setTaskWindowingModeSplitScreenPrimary: moving task=" + taskId
|
||||
+ " to createMode=" + createMode + " toTop=" + toTop);
|
||||
mWindowManager.setDockedStackCreateStateLocked(createMode, initialBounds);
|
||||
final int windowingMode = task.getWindowingMode();
|
||||
final ActivityStack stack = task.getStack();
|
||||
|
||||
Reference in New Issue
Block a user