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

Commit 2cca8621 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Only allow the top fullscreen stack to influence lockscreen state

Only activities in the top fullscreen stack should be able to
showWhenLocked or dismiss the keyguard.
Also, use ActivityRecord.visibleIgnoringKeyguard to determine if a
stack is translucent instead of AR.visible.

Bug: 68689819
Bug: 70562363
Test: manual steps from bug
Change-Id: Ib13395198d00366df13f34d4642a1a163b9d2435
parent b4183a0e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -556,6 +556,16 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
        return stack == getTopStack();
    }

    boolean isTopFullscreenStack(ActivityStack stack) {
        for (int i = mStacks.size() - 1; i >= 0; --i) {
            final ActivityStack current = mStacks.get(i);
            if (current.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
                return current == stack;
            }
        }
        return false;
    }

    int getIndexOf(ActivityStack stack) {
        return mStacks.indexOf(stack);
    }
+2 −1
Original line number Diff line number Diff line
@@ -2731,7 +2731,8 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
     *         {@link #mShowWhenLocked}.
     */
    boolean canShowWhenLocked() {
        return mShowWhenLocked || service.mWindowManager.containsShowWhenLockedWindow(appToken);
        return !inMultiWindowMode() && (mShowWhenLocked
                || service.mWindowManager.containsShowWhenLockedWindow(appToken));
    }

    void setTurnScreenOn(boolean turnScreenOn) {
+5 −6
Original line number Diff line number Diff line
@@ -1683,7 +1683,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                    continue;
                }

                if (!r.visible && r != starting) {
                if (!r.visibleIgnoringKeyguard && r != starting) {
                    // Also ignore invisible activities that are not the currently starting
                    // activity (about to be visible).
                    continue;
@@ -1811,6 +1811,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            boolean behindFullscreenActivity = !stackShouldBeVisible;
            boolean resumeNextActivity = mStackSupervisor.isFocusedStack(this)
                    && (isInStackLocked(starting) == null);
            final boolean isTopFullscreenStack = getDisplay().isTopFullscreenStack(this);
            for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
                final TaskRecord task = mTaskHistory.get(taskNdx);
                final ArrayList<ActivityRecord> activities = task.mActivities;
@@ -1832,7 +1833,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

                    // Now check whether it's really visible depending on Keyguard state.
                    final boolean reallyVisible = checkKeyguardVisibility(r,
                            visibleIgnoringKeyguard, isTop);
                            visibleIgnoringKeyguard, isTop && isTopFullscreenStack);
                    if (visibleIgnoringKeyguard) {
                        behindFullscreenActivity = updateBehindFullscreen(!stackShouldBeVisible,
                                behindFullscreenActivity, r);
@@ -1958,13 +1959,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
     *
     * @return true if {@param r} is visible taken Keyguard state into account, false otherwise
     */
    boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible,
            boolean isTop) {
        final boolean isInPinnedStack = r.inPinnedWindowingMode();
    boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible, boolean isTop) {
        final boolean keyguardShowing = mStackSupervisor.getKeyguardController().isKeyguardShowing(
                mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY);
        final boolean keyguardLocked = mStackSupervisor.getKeyguardController().isKeyguardLocked();
        final boolean showWhenLocked = r.canShowWhenLocked() && !isInPinnedStack;
        final boolean showWhenLocked = r.canShowWhenLocked();
        final boolean dismissKeyguard = r.hasDismissKeyguardWindows();
        if (shouldBeVisible) {
            if (dismissKeyguard && mTopDismissingKeyguardActivity == null) {