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

Commit 188b0139 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

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

am: 02ebaa02

* commit '02ebaa02':
  Don't allow pinned activities to request visible behind

Change-Id: I78704c8b677f91b268d83da971b3f50bd479b6ba
parents 3a869886 02ebaa02
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);