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

Commit 913690d7 authored by Winson Chung's avatar Winson Chung
Browse files

Always inset by nav bar frame when IME is visible

- When the IME is floating and does not report insets, the app content
  is never inset to accomodate the visible dismiss-ime button in the
  nav bar.

Bug: 142218188
Test: Enable floating ime (no reported insets) and verify that the
      app does not render under the nav bar

Change-Id: I3b8e03a4e9cf82b12c2054db479a8a027bc9c918
parent 8a505cde
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2320,9 +2320,22 @@ public class DisplayPolicy {
    }

    private void offsetInputMethodWindowLw(WindowState win, DisplayFrames displayFrames) {
        final int rotation = displayFrames.mRotation;
        final int navBarPosition = navigationBarPosition(displayFrames.mDisplayWidth,
                displayFrames.mDisplayHeight, rotation);

        int top = Math.max(win.getDisplayFrameLw().top, win.getContentFrameLw().top);
        top += win.getGivenContentInsetsLw().top;
        displayFrames.mContent.bottom = Math.min(displayFrames.mContent.bottom, top);
        if (navBarPosition == NAV_BAR_BOTTOM) {
            // Always account for the nav bar frame height on the bottom since in all navigation
            // modes we make room to show the dismiss-ime button, even if the IME does not report
            // insets (ie. when floating)
            final int uimode = mService.mPolicy.getUiMode();
            final int navFrameHeight = getNavigationBarFrameHeight(rotation, uimode);
            displayFrames.mContent.bottom = Math.min(displayFrames.mContent.bottom,
                    displayFrames.mUnrestricted.bottom - navFrameHeight);
        }
        displayFrames.mVoiceContent.bottom = Math.min(displayFrames.mVoiceContent.bottom, top);
        top = win.getVisibleFrameLw().top;
        top += win.getGivenVisibleInsetsLw().top;