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

Commit 865c70f5 authored by Adrian Roos's avatar Adrian Roos
Browse files

Letterbox: Ignore light status bar flags for letterboxed windows

Fixes an issue where letterboxed windows would still apply the
light status bar flag, even though the status bar was letterboxed
to black.

Bug: 65689439
Test: Enable cutout emulation, open "all apps" on launcher, verify status bar icons are visible
Change-Id: I9ce9560eedcc9cc2c1907478f7c4f4a1002c7235
parent 4d18a2e4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -7833,8 +7833,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // If the top fullscreen-or-dimming window is also the top fullscreen, respect
            // its light flag.
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            if (!statusColorWin.isLetterboxedForDisplayCutoutLw()) {
                // Only allow white status bar if the window was not letterboxed.
                vis |= PolicyControl.getSystemUiVisibility(statusColorWin, null)
                        & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
        } else if (statusColorWin != null && statusColorWin.isDimming()) {
            // Otherwise if it's dimming, clear the light flag.
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+7 −0
Original line number Diff line number Diff line
@@ -440,6 +440,13 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
         */
        public boolean isDimming();

        /**
         * Returns true if the window is letterboxed for the display cutout.
         */
        default boolean isLetterboxedForDisplayCutoutLw() {
            return false;
        }

        /** @return the current windowing mode of this window. */
        int getWindowingMode();

+8 −4
Original line number Diff line number Diff line
@@ -202,7 +202,6 @@ import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.function.Predicate;

/** A window in the window manager. */
@@ -2981,11 +2980,16 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

    /** @return true when the window is in fullscreen task, but has non-fullscreen bounds set. */
    boolean isLetterboxedAppWindow() {
        return !isInMultiWindowMode() && mAppToken != null && (!mAppToken.matchParentBounds()
                || isLetterboxedForCutout());
        return !isInMultiWindowMode() && mAppToken != null && !mAppToken.matchParentBounds()
                || isLetterboxedForDisplayCutoutLw();
    }

    private boolean isLetterboxedForCutout() {
    @Override
    public boolean isLetterboxedForDisplayCutoutLw() {
        if (mAppToken == null) {
            // Only windows with an AppWindowToken are letterboxed.
            return false;
        }
        if (getDisplayContent().getDisplayInfo().displayCutout == null) {
            // No cutout, no letterbox.
            return false;