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

Commit 96d683bf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by android-build-merger
Browse files

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

am: da494279

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

Change-Id: I08f5da88cd5df2d2915d054f484eaeda2a2c703f
parents 255c0359 da494279
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);