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

Commit 498a4b83 authored by wilsonshih's avatar wilsonshih
Browse files

Hide content on all displays when the device is locked.

Currently we cannot show Keyguard on private display. To prevent
security regression, we should hide the content when device is locked.

Bug: 120669490
Test: atest ActivityManagerMultiDisplayTests
Test: atest ActivityManagerDisplayLockedKeyguardTests
Test: atest ActivityManagerDisplayKeyguardTests

Change-Id: I94a5099b91f15b3871da497a8bc7cb66713d9b64
parent 2d97aa80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2286,7 +2286,7 @@ class ActivityStack extends ConfigurationContainer {
     * Check if the display to which this stack is attached has
     * {@link Display#FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD} applied.
     */
    private boolean canShowWithInsecureKeyguard() {
    boolean canShowWithInsecureKeyguard() {
        final ActivityDisplay activityDisplay = getDisplay();
        if (activityDisplay == null) {
            throw new IllegalStateException("Stack is not attached to any display, stackId="
+11 −16
Original line number Diff line number Diff line
@@ -91,9 +91,7 @@ class KeyguardController {
     */
    boolean isKeyguardOrAodShowing(int displayId) {
        return (mKeyguardShowing || mAodShowing) && !mKeyguardGoingAway
                && (displayId == DEFAULT_DISPLAY
                        ? !isDisplayOccluded(DEFAULT_DISPLAY)
                        : isShowingOnSecondaryDisplay(displayId));
                && !isDisplayOccluded(displayId);
    }

    /**
@@ -101,10 +99,7 @@ class KeyguardController {
     *         display, false otherwise
     */
    boolean isKeyguardShowing(int displayId) {
        return mKeyguardShowing && !mKeyguardGoingAway
                && (displayId == DEFAULT_DISPLAY
                        ? !isDisplayOccluded(DEFAULT_DISPLAY)
                        : isShowingOnSecondaryDisplay(displayId));
        return mKeyguardShowing && !mKeyguardGoingAway && !isDisplayOccluded(displayId);
    }

    /**
@@ -152,14 +147,6 @@ class KeyguardController {
        updateKeyguardSleepToken();
    }

    private boolean isShowingOnSecondaryDisplay(int displayId) {
        if (mSecondaryDisplayIdsShowing == null) return false;
        for (int showingId : mSecondaryDisplayIdsShowing) {
            if (displayId == showingId) return true;
        }
        return false;
    }

    /**
     * Called when Keyguard is going away.
     *
@@ -473,8 +460,16 @@ class KeyguardController {
                if (stack.getTopDismissingKeyguardActivity() != null) {
                    mDismissingKeyguardActivity = stack.getTopDismissingKeyguardActivity();
                }
                // FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD only apply for secondary display.
                if (mDisplayId != DEFAULT_DISPLAY) {
                    mOccluded |= stack.canShowWithInsecureKeyguard()
                            && controller.canDismissKeyguard();
                }
            }
            // TODO(b/123372519): isShowingDream can only works on default display.
            if (mDisplayId == DEFAULT_DISPLAY) {
                mOccluded |= controller.mWindowManager.isShowingDream();
            }

            // TODO(b/113840485): Handle app transition for individual display, and apply occluded
            // state change to secondary displays.
+1 −1
Original line number Diff line number Diff line
@@ -2817,7 +2817,7 @@ public class WindowManagerService extends IWindowManager.Stub

    public boolean isShowingDream() {
        synchronized (mGlobalLock) {
            // TODO: fix this when dream can be shown on non-default display.
            // TODO(b/123372519): Fix this when dream can be shown on non-default display.
            return getDefaultDisplayContentLocked().getDisplayPolicy().isShowingDreamLw();
        }
    }