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

Commit 744dec33 authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Add lock task check when applying window container transaction" into sc-dev am: a20b1034

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13417776

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3bdbc9c15c3dedd38661ca9ccf309fb674005440
parents 0595cb34 a20b1034
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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.RESIZE_MODE_PRESERVE_WINDOW;
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_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
@@ -1877,6 +1878,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        synchronized (mGlobalLock) {
            final long ident = Binder.clearCallingIdentity();
            try {
                if (isInLockTaskMode() && windowingMode != WINDOWING_MODE_FULLSCREEN) {
                    Slog.w(TAG, "setTaskWindowingMode: Is in lock task mode="
                            + getLockTaskModeState());
                    return false;
                }

                if (WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
                    return setTaskWindowingModeSplitScreen(taskId, windowingMode, toTop);
                }
@@ -2141,11 +2148,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            throw new IllegalArgumentException("Calling setTaskWindowingModeSplitScreen with non"
                    + "split-screen mode: " + windowingMode);
        }
        if (isInLockTaskMode()) {
            Slog.w(TAG, "setTaskWindowingModeSplitScreen: Is in lock task mode="
                    + getLockTaskModeState());
            return false;
        }

        final Task task = mRootWindowContainer.anyTaskForId(taskId,
                MATCH_ATTACHED_TASK_ONLY);
+58 −47
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;

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_REORDER;
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REPARENT;
@@ -264,11 +265,15 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            }
            // Hierarchy changes
            final List<WindowContainerTransaction.HierarchyOp> hops = t.getHierarchyOps();
            if (!hops.isEmpty() && mService.isInLockTaskMode()) {
                Slog.w(TAG, "Attempt to perform hierarchy operations while in lock task mode...");
            } else {
                for (int i = 0, n = hops.size(); i < n; ++i) {
                    final WindowContainerTransaction.HierarchyOp hop = hops.get(i);
                    switch (hop.getType()) {
                        case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT: {
                        final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
                            final WindowContainer wc = WindowContainer.fromBinder(
                                    hop.getContainer());
                            final Task task = wc != null ? wc.asTask() : null;
                            if (task != null) {
                                task.getDisplayArea().setLaunchRootTask(task,
@@ -287,7 +292,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                            break;
                        case HIERARCHY_OP_TYPE_REORDER:
                        case HIERARCHY_OP_TYPE_REPARENT:
                        final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
                            final WindowContainer wc = WindowContainer.fromBinder(
                                    hop.getContainer());
                            if (wc == null || !wc.isAttached()) {
                                Slog.e(TAG, "Attempt to operate on detached container: " + wc);
                                continue;
@@ -317,6 +323,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                            effects |= sanitizeAndApplyHierarchyOp(wc, hop);
                    }
                }
            }
            // Queue-up bounds-change transactions for tasks which are now organized. Do
            // this after hierarchy ops so we have the final organized state.
            entries = t.getChanges().entrySet().iterator();
@@ -412,6 +419,10 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        }

        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);
        }
        return effects;