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

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

Merge "Don't allow pinned activities to request visible behind" into nyc-dev

parents 4b6dfc2e 43896cff
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -675,6 +675,14 @@ public class ActivityManager {
            return isStaticStack(stackId) || stackId == PINNED_STACK_ID
                    || stackId == FREEFORM_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
        }

        /**
         * Returns true if activities contained in this stack can request visible behind by
         * calling {@link Activity#requestVisibleBehind}.
         */
        public static boolean activitiesCanRequestVisibleBehind(int stackId) {
            return stackId == FULLSCREEN_WORKSPACE_STACK_ID;
        }
    }

    /**
+14 −0
Original line number Diff line number Diff line
@@ -2430,6 +2430,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
        try {
            final TaskRecord task = r.task;

            if (r == task.stack.getVisibleBehindActivity()) {
                // An activity can't be pinned and visible behind at the same time. Go ahead and
                // release it from been visible behind before pinning.
                requestVisibleBehindLocked(r, false);
            }

            // Need to make sure the pinned stack exist so we can resize it below...
            final ActivityStack stack = getStack(PINNED_STACK_ID, CREATE_IF_NEEDED, ON_TOP);

@@ -2689,6 +2695,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
                    "requestVisibleBehind: r=" + r + " visible=" + visible + " stack is null");
            return false;
        }

        if (visible && !StackId.activitiesCanRequestVisibleBehind(stack.mStackId)) {
            if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND, "requestVisibleBehind: r=" + r
                    + " visible=" + visible + " stackId=" + stack.mStackId
                    + " can't contain visible behind activities");
            return false;
        }

        final boolean isVisible = stack.hasVisibleBehindActivity();
        if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
                "requestVisibleBehind r=" + r + " visible=" + visible + " isVisible=" + isVisible);