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

Commit b08669ba authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Revert "Allow IMEs to use light nav bar buttons"

This reverts commit af2e20e1 [1].

Reason of revert:
That commit causes an unexpected behavior change (Bug 69111208)
when the target application is using light navigation bar and
the IME does not override the navigation bar background color.

 [1]: I2cecadb82d14564d7019a9636918b06c3bcf433c

Bug: 69002467
Bug: 69002565
Fixes: 69111208
Test: Manually verified as follows:
  1. Make sure the current IME does not override navigation bar
     background color. (e.g. AOSP keyboard and SoftKeyboard sample)
  2. Open any app that specifies light nav bar (e.g. Settings app)
  3. Make sure that the navigation bar background is not dark and
     navigation bar buttons are rendered with dark color.
  4. Focus any EditText on that app.
  5. Make sure that Navigation bar background color becomes
     R.color.input_method_navigation_guard, which is black on AOSP.
     Also navigation bar buttons are rendered with light color.

Change-Id: I5e2e3007419f0ee81383b115f4073d5831c5d890
parent af2e20e1
Loading
Loading
Loading
Loading
+12 −18
Original line number Diff line number Diff line
@@ -8090,28 +8090,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private int updateLightNavigationBarLw(int vis, WindowState opaque,
            WindowState opaqueOrDimming) {
        final WindowState imeWin = mWindowManagerFuncs.getInputMethodWindowLw();
        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;
            }

        final WindowState navColorWin;
        if (imeWin != null && imeWin.isVisibleLw() && mNavigationBarPosition == NAV_BAR_BOTTOM) {
            navColorWin = imeWin;
        } else {
            navColorWin = opaqueOrDimming;
        }

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