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

Commit e5638a6f authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix nav bar consuming

- Cache shouldAlwaysConsumeNavbar so it doesn't get reset when
insets == null
- Remove logic with frame comparison when determining whether to
consume nav bar. Not sure how that ever worked.
- Make sure shouldAlwaysConsumeNavBar survives when consuming
insets.

Bug: 27157904
Change-Id: I35f209ab27cc12240038da7efa9e79c95f70c6ce
parent 03aa6514
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public final class WindowInsets {
        mWindowDecorInsetsConsumed = src.mWindowDecorInsetsConsumed;
        mStableInsetsConsumed = src.mStableInsetsConsumed;
        mIsRound = src.mIsRound;
        mAlwaysConsumeNavBar = src.mAlwaysConsumeNavBar;
    }

    /** @hide */
+3 −2
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
    private boolean mLastHasBottomStableInset = false;
    private boolean mLastHasRightStableInset = false;
    private int mLastWindowFlags = 0;
    private boolean mLastShouldAlwaysConsumeNavBar = false;

    private int mRootScrollY = 0;

@@ -996,6 +997,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                boolean hasRightStableInset = insets.getStableInsetRight() != 0;
                disallowAnimate |= (hasRightStableInset != mLastHasRightStableInset);
                mLastHasRightStableInset = hasRightStableInset;
                mLastShouldAlwaysConsumeNavBar = insets.shouldAlwaysConsumeNavBar();
            }

            boolean navBarToRightEdge = isNavBarToRightEdge(mLastBottomInset, mLastRightInset);
@@ -1016,12 +1018,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
        // to ensure that the rest of the view hierarchy doesn't notice it, unless they've
        // explicitly asked for it.

        boolean consumingNavBar =
                (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
                        && (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
                        && (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0
                || (insets != null && insets.shouldAlwaysConsumeNavBar());
                || mLastShouldAlwaysConsumeNavBar;

        // If we didn't request fullscreen layout, but we still got it because of the
        // mForceWindowDrawsStatusBarBackground flag, also consume top inset.
+1 −2
Original line number Diff line number Diff line
@@ -6299,8 +6299,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    @Override
    public boolean isNavBarForcedShownLw(WindowState windowState) {
        return mForceShowSystemBars
                && !windowState.getFrameLw().equals(windowState.getDisplayFrameLw());
        return mForceShowSystemBars;
    }

    @Override