Merge "Add lock task check when applying window container transaction" into sc-dev am: a20b10345d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13417776 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I54a295b3d7a6283317a02609cdedf8f22050b547
This commit is contained in:
@@ -35,6 +35,7 @@ import static android.app.ActivityManagerInternal.ALLOW_NON_FULL;
|
|||||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||||
import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW;
|
import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW;
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
|
||||||
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||||
@@ -1877,6 +1878,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
synchronized (mGlobalLock) {
|
synchronized (mGlobalLock) {
|
||||||
final long ident = Binder.clearCallingIdentity();
|
final long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
|
if (isInLockTaskMode() && windowingMode != WINDOWING_MODE_FULLSCREEN) {
|
||||||
|
Slog.w(TAG, "setTaskWindowingMode: Is in lock task mode="
|
||||||
|
+ getLockTaskModeState());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
|
if (WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
|
||||||
return setTaskWindowingModeSplitScreen(taskId, windowingMode, toTop);
|
return setTaskWindowingModeSplitScreen(taskId, windowingMode, toTop);
|
||||||
}
|
}
|
||||||
@@ -2141,11 +2148,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
throw new IllegalArgumentException("Calling setTaskWindowingModeSplitScreen with non"
|
throw new IllegalArgumentException("Calling setTaskWindowingModeSplitScreen with non"
|
||||||
+ "split-screen mode: " + windowingMode);
|
+ "split-screen mode: " + windowingMode);
|
||||||
}
|
}
|
||||||
if (isInLockTaskMode()) {
|
|
||||||
Slog.w(TAG, "setTaskWindowingModeSplitScreen: Is in lock task mode="
|
|
||||||
+ getLockTaskModeState());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Task task = mRootWindowContainer.anyTaskForId(taskId,
|
final Task task = mRootWindowContainer.anyTaskForId(taskId,
|
||||||
MATCH_ATTACHED_TASK_ONLY);
|
MATCH_ATTACHED_TASK_ONLY);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
import static android.Manifest.permission.READ_FRAME_BUFFER;
|
import static android.Manifest.permission.READ_FRAME_BUFFER;
|
||||||
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT;
|
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT;
|
||||||
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER;
|
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER;
|
||||||
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REPARENT;
|
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REPARENT;
|
||||||
@@ -264,57 +265,63 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
}
|
}
|
||||||
// Hierarchy changes
|
// Hierarchy changes
|
||||||
final List<WindowContainerTransaction.HierarchyOp> hops = t.getHierarchyOps();
|
final List<WindowContainerTransaction.HierarchyOp> hops = t.getHierarchyOps();
|
||||||
for (int i = 0, n = hops.size(); i < n; ++i) {
|
if (!hops.isEmpty() && mService.isInLockTaskMode()) {
|
||||||
final WindowContainerTransaction.HierarchyOp hop = hops.get(i);
|
Slog.w(TAG, "Attempt to perform hierarchy operations while in lock task mode...");
|
||||||
switch (hop.getType()) {
|
} else {
|
||||||
case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT: {
|
for (int i = 0, n = hops.size(); i < n; ++i) {
|
||||||
final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
|
final WindowContainerTransaction.HierarchyOp hop = hops.get(i);
|
||||||
final Task task = wc != null ? wc.asTask() : null;
|
switch (hop.getType()) {
|
||||||
if (task != null) {
|
case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT: {
|
||||||
task.getDisplayArea().setLaunchRootTask(task,
|
final WindowContainer wc = WindowContainer.fromBinder(
|
||||||
hop.getWindowingModes(), hop.getActivityTypes());
|
hop.getContainer());
|
||||||
} else {
|
final Task task = wc != null ? wc.asTask() : null;
|
||||||
throw new IllegalArgumentException(
|
if (task != null) {
|
||||||
"Cannot set non-task as launch root: " + wc);
|
task.getDisplayArea().setLaunchRootTask(task,
|
||||||
|
hop.getWindowingModes(), hop.getActivityTypes());
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Cannot set non-task as launch root: " + wc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT:
|
||||||
}
|
effects |= reparentChildrenTasksHierarchyOp(hop, transition, syncId);
|
||||||
case HIERARCHY_OP_TYPE_CHILDREN_TASKS_REPARENT:
|
break;
|
||||||
effects |= reparentChildrenTasksHierarchyOp(hop, transition, syncId);
|
case HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS:
|
||||||
break;
|
effects |= setAdjacentRootsHierarchyOp(hop);
|
||||||
case HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS:
|
break;
|
||||||
effects |= setAdjacentRootsHierarchyOp(hop);
|
case HIERARCHY_OP_TYPE_REORDER:
|
||||||
break;
|
case HIERARCHY_OP_TYPE_REPARENT:
|
||||||
case HIERARCHY_OP_TYPE_REORDER:
|
final WindowContainer wc = WindowContainer.fromBinder(
|
||||||
case HIERARCHY_OP_TYPE_REPARENT:
|
hop.getContainer());
|
||||||
final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
|
if (wc == null || !wc.isAttached()) {
|
||||||
if (wc == null || !wc.isAttached()) {
|
Slog.e(TAG, "Attempt to operate on detached container: " + wc);
|
||||||
Slog.e(TAG, "Attempt to operate on detached container: " + wc);
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
if (syncId >= 0) {
|
||||||
if (syncId >= 0) {
|
addToSyncSet(syncId, wc);
|
||||||
addToSyncSet(syncId, wc);
|
}
|
||||||
}
|
if (transition != null) {
|
||||||
if (transition != null) {
|
transition.collect(wc);
|
||||||
transition.collect(wc);
|
if (hop.isReparent()) {
|
||||||
if (hop.isReparent()) {
|
if (wc.getParent() != null) {
|
||||||
if (wc.getParent() != null) {
|
// Collect the current parent. It's visibility may change as
|
||||||
// Collect the current parent. It's visibility may change as
|
// a result of this reparenting.
|
||||||
// a result of this reparenting.
|
transition.collect(wc.getParent());
|
||||||
transition.collect(wc.getParent());
|
}
|
||||||
}
|
if (hop.getNewParent() != null) {
|
||||||
if (hop.getNewParent() != null) {
|
final WindowContainer parentWc =
|
||||||
final WindowContainer parentWc =
|
WindowContainer.fromBinder(hop.getNewParent());
|
||||||
WindowContainer.fromBinder(hop.getNewParent());
|
if (parentWc == null) {
|
||||||
if (parentWc == null) {
|
Slog.e(TAG, "Can't resolve parent window from token");
|
||||||
Slog.e(TAG, "Can't resolve parent window from token");
|
continue;
|
||||||
continue;
|
}
|
||||||
|
transition.collect(parentWc);
|
||||||
}
|
}
|
||||||
transition.collect(parentWc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
effects |= sanitizeAndApplyHierarchyOp(wc, hop);
|
||||||
effects |= sanitizeAndApplyHierarchyOp(wc, hop);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Queue-up bounds-change transactions for tasks which are now organized. Do
|
// Queue-up bounds-change transactions for tasks which are now organized. Do
|
||||||
@@ -412,6 +419,10 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (windowingMode > -1) {
|
if (windowingMode > -1) {
|
||||||
|
if (mService.isInLockTaskMode() && windowingMode != WINDOWING_MODE_FULLSCREEN) {
|
||||||
|
throw new UnsupportedOperationException("Not supported to set non-fullscreen"
|
||||||
|
+ " windowing mode during locked task mode.");
|
||||||
|
}
|
||||||
container.setWindowingMode(windowingMode);
|
container.setWindowingMode(windowingMode);
|
||||||
}
|
}
|
||||||
return effects;
|
return effects;
|
||||||
|
|||||||
Reference in New Issue
Block a user