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

Commit c9619b0e authored by Tiger's avatar Tiger
Browse files

Don't exit immersive mode while showing a floating window

While a floating window becomes the focused window, status bar would
stay hidden if the top fullscreen app hides it. This is the existing
logic. This CL applies the same logic to navigation bar.

Fix: 225684651
Test: 1. Open Window Insets Test > Window Insets Controller.
      2. Hide navigation bar.
      3. Click on the drop-down menu.
      See if navigation bar stay hidden.
Change-Id: I45ec5ec3312ea98f1c65886e509d2b3029603df7
parent c7f6a80c
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1623,14 +1623,13 @@ public class DisplayPolicy {
    }

    /**
     * @return Whether the top app should hide the statusbar based on the top fullscreen opaque
     *         window.
     * @return Whether the top fullscreen app hides the given type of system bar.
     */
    boolean topAppHidesStatusBar() {
    boolean topAppHidesSystemBar(@InsetsType int type) {
        if (mTopFullscreenOpaqueWindowState == null || mForceShowSystemBars) {
            return false;
        }
        return !mTopFullscreenOpaqueWindowState.isRequestedVisible(Type.statusBars());
        return !mTopFullscreenOpaqueWindowState.isRequestedVisible(type);
    }

    /**
@@ -2053,7 +2052,10 @@ public class DisplayPolicy {
                navColorWin != null && navColorWin == mDisplayContent.mInputMethodWindow;
        final int appearance = updateLightNavigationBarLw(win.mAttrs.insetsFlags.appearance,
                navColorWin) | opaqueAppearance;
        final int behavior = win.mAttrs.insetsFlags.behavior;
        final WindowState navBarControlWin = topAppHidesSystemBar(Type.navigationBars())
                ? mTopFullscreenOpaqueWindowState
                : win;
        final int behavior = navBarControlWin.mAttrs.insetsFlags.behavior;
        final String focusedApp = win.mAttrs.packageName;
        final boolean isFullscreen = !win.isRequestedVisible(Type.statusBars())
                || !win.isRequestedVisible(Type.navigationBars());
@@ -2168,7 +2170,7 @@ public class DisplayPolicy {
                || mDisplayContent.getInsetsPolicy().remoteInsetsControllerControlsSystemBars(win);
        mDisplayContent.getInsetsPolicy().updateBarControlTarget(win);

        final boolean topAppHidesStatusBar = topAppHidesStatusBar();
        final boolean topAppHidesStatusBar = topAppHidesSystemBar(Type.statusBars());
        if (getStatusBar() != null) {
            final StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
            if (statusBar != null) {
+10 −1
Original line number Diff line number Diff line
@@ -532,7 +532,8 @@ class InsetsPolicy {
            // fake control to the client, so that it can re-show the bar during this scenario.
            return mDummyControlTarget;
        }
        if (!canBeTopFullscreenOpaqueWindow(focusedWin) && mPolicy.topAppHidesStatusBar()
        if (!canBeTopFullscreenOpaqueWindow(focusedWin)
                && mPolicy.topAppHidesSystemBar(Type.statusBars())
                && (notificationShade == null || !notificationShade.canReceiveKeys())) {
            // Non-fullscreen focused window should not break the state that the top-fullscreen-app
            // window hides status bar, unless the notification shade can receive keys.
@@ -592,6 +593,14 @@ class InsetsPolicy {
            // fake control to the client, so that it can re-show the bar during this scenario.
            return mDummyControlTarget;
        }
        final WindowState notificationShade = mPolicy.getNotificationShade();
        if (!canBeTopFullscreenOpaqueWindow(focusedWin)
                && mPolicy.topAppHidesSystemBar(Type.navigationBars())
                && (notificationShade == null || !notificationShade.canReceiveKeys())) {
            // Non-fullscreen focused window should not break the state that the top-fullscreen-app
            // window hides navigation bar, unless the notification shade can receive keys.
            return mPolicy.getTopFullscreenOpaqueWindow();
        }
        return focusedWin;
    }