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

Commit 5df216f2 authored by Mark Renouf's avatar Mark Renouf Committed by Android (Google) Code Review
Browse files

Merge "Omit NavigationGuard if the input method uses FLAG_LAYOUT_IN_OVERSCAN" into cw-f-dev

parents d8e95f6b 9b32a35a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import static android.view.Window.DECOR_CAPTION_SHADE_LIGHT;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
@@ -969,7 +970,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        mFrameOffsets.set(insets.getSystemWindowInsets());
        insets = updateColorViews(insets, true /* animate */);
        insets = updateStatusGuard(insets);
        updateNavigationGuard(insets);
        insets = updateNavigationGuard(insets);
        if (getForeground() != null) {
            drawableChanged();
        }
@@ -1329,9 +1330,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        return insets;
    }

    private void updateNavigationGuard(WindowInsets insets) {
        // IMEs lay out below the nav bar, but the content view must not (for back compat)
        if (mWindow.getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD) {
    private WindowInsets updateNavigationGuard(WindowInsets insets) {
        // IME windows lay out below the nav bar, but the content view must not (for back compat)
        // Only make this adjustment if the window is not requesting layout in overscan
        if (mWindow.getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD
                && (mWindow.getAttributes().flags & FLAG_LAYOUT_IN_OVERSCAN) == 0) {
            // prevent the content view from including the nav bar height
            if (mWindow.mContentParent != null) {
                if (mWindow.mContentParent.getLayoutParams() instanceof MarginLayoutParams) {
@@ -1356,7 +1359,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                mNavigationGuard.setLayoutParams(lp);
            }
            updateNavigationGuardColor();
            insets = insets.consumeSystemWindowInsets(
                    false, false, false, true /* bottom */);
        }
        return insets;
    }

    void updateNavigationGuardColor() {