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

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

Merge "Disable multi-resumed activities for pre-Q app"

parents 3fc4af65 77ce34dc
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1267,6 +1267,15 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
        positionChildAt(stack, Math.max(0, insertIndex));
    }

    void ensureActivitiesVisible(ActivityRecord starting, int configChanges,
            boolean preserveWindows, boolean notifyClients) {
        for (int stackNdx = getChildCount() - 1; stackNdx >= 0; --stackNdx) {
            final ActivityStack stack = getChildAt(stackNdx);
            stack.ensureActivitiesVisibleLocked(starting, configChanges, preserveWindows,
                    notifyClients);
        }
    }

    void moveHomeStackToFront(String reason) {
        if (mHomeStack != null) {
            mHomeStack.moveToFront(reason);
+10 −0
Original line number Diff line number Diff line
@@ -3401,6 +3401,16 @@ final class ActivityRecord extends ConfigurationContainer {
                stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, true /* isTop */);
    }

    /**
     * Check if this activity is able to resume. For pre-Q apps, only the topmost activities of each
     * process are allowed to be resumed.
     *
     * @return true if this activity can be resumed.
     */
    boolean canResumeByCompat() {
        return app == null || app.updateTopResumingActivityInProcessIfNeeded(this);
    }

    boolean getTurnScreenOnFlag() {
        return mTurnScreenOn;
    }
+4 −0
Original line number Diff line number Diff line
@@ -2597,6 +2597,10 @@ class ActivityStack extends ConfigurationContainer {
            return false;
        }

        if (!next.canResumeByCompat()) {
            return false;
        }

        // If we are sleeping, and there is no resumed activity, and the top
        // activity is paused, well that is the state we want.
        if (shouldSleepOrShutDownActivities()
+5 −0
Original line number Diff line number Diff line
@@ -720,6 +720,11 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {

            r.setProcess(proc);

            // Ensure activity is allowed to be resumed after process has set.
            if (andResume && !r.canResumeByCompat()) {
                andResume = false;
            }

            if (getKeyguardController().isKeyguardLocked()) {
                r.notifyUnknownVisibilityLaunched();
            }
+2 −5
Original line number Diff line number Diff line
@@ -777,12 +777,9 @@ class RootActivityContainer extends ConfigurationContainer
            // First the front stacks. In case any are not fullscreen and are in front of home.
            for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
                final ActivityDisplay display = mActivityDisplays.get(displayNdx);
                for (int stackNdx = display.getChildCount() - 1; stackNdx >= 0; --stackNdx) {
                    final ActivityStack stack = display.getChildAt(stackNdx);
                    stack.ensureActivitiesVisibleLocked(starting, configChanges, preserveWindows,
                display.ensureActivitiesVisible(starting, configChanges, preserveWindows,
                        notifyClients);
            }
            }
        } finally {
            mStackSupervisor.getKeyguardController().endActivityVisibilityUpdate();
        }
Loading