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

Commit 7b1ed775 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Allow IMEs to use light nav bar buttons"

parents bc1ca0d9 af2e20e1
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -8084,22 +8084,28 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private int updateLightNavigationBarLw(int vis, WindowState opaque,
            WindowState opaqueOrDimming) {
        final WindowState imeWin = mWindowManagerFuncs.getInputMethodWindowLw();

        final WindowState navColorWin;
        if (imeWin != null && imeWin.isVisibleLw() && mNavigationBarPosition == NAV_BAR_BOTTOM) {
            navColorWin = imeWin;
        } else {
            navColorWin = opaqueOrDimming;
        final boolean isImeShownWithBottomNavBar =
                imeWin != null && imeWin.isVisibleLw() && mNavigationBarPosition == NAV_BAR_BOTTOM;
        if (isImeShownWithBottomNavBar) {
            final int winFlags = PolicyControl.getWindowFlags(imeWin, null);
            if ((winFlags & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
                // If the IME window is visible and explicitly requesting custom nav bar background
                // rendering, respect its light flag.
                vis &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
                vis |= PolicyControl.getSystemUiVisibility(imeWin, null)
                        & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
                return vis;
            }
        }

        if (navColorWin != null) {
            if (navColorWin == opaque) {
                // If the top fullscreen-or-dimming window is also the top fullscreen, respect
                // its light flag.
        if (opaqueOrDimming != null) {
            if (opaqueOrDimming == opaque) {
                // If the top fullscreen-or-dimming window is also the top fullscreen window,
                // respect its light flag.
                vis &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
                vis |= PolicyControl.getSystemUiVisibility(navColorWin, null)
                vis |= PolicyControl.getSystemUiVisibility(opaqueOrDimming, null)
                        & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            } else if (navColorWin.isDimming() || navColorWin == imeWin) {
            } else if (opaqueOrDimming.isDimming() || isImeShownWithBottomNavBar) {
                // Otherwise if it's dimming or it's the IME window, clear the light flag.
                vis &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            }