Loading core/java/android/inputmethodservice/InputMethodService.java +1 −0 Original line number Diff line number Diff line Loading @@ -720,6 +720,7 @@ public class InputMethodService extends AbstractInputMethodService { final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); mNavigationBarController.updateInsets(mTmpInsets); if (!mViewsCreated) { // The IME views are not ready, keep visible insets untouched. mTmpInsets.visibleTopInsets = 0; Loading core/java/android/inputmethodservice/NavigationBarController.java +31 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ import java.util.Objects; final class NavigationBarController { private interface Callback { default void updateInsets(@NonNull InputMethodService.Insets originalInsets) { } default void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { } Loading Loading @@ -96,6 +100,15 @@ final class NavigationBarController { ? new Impl(inputMethodService) : Callback.NOOP; } /** * Update the given insets to be at least as big as the IME navigation bar, when visible. * * @param originalInsets the insets to check and modify to include the IME navigation bar. */ void updateInsets(@NonNull InputMethodService.Insets originalInsets) { mImpl.updateInsets(originalInsets); } void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { mImpl.updateTouchableInsets(originalInsets, dest); Loading Loading @@ -269,6 +282,24 @@ final class NavigationBarController { mNavigationBarFrame = null; } @Override public void updateInsets(@NonNull InputMethodService.Insets originalInsets) { if (!mImeDrawsImeNavBar || mNavigationBarFrame == null || mNavigationBarFrame.getVisibility() != View.VISIBLE || mService.isFullscreenMode()) { return; } final int[] loc = new int[2]; mNavigationBarFrame.getLocationInWindow(loc); if (originalInsets.contentTopInsets > loc[1]) { originalInsets.contentTopInsets = loc[1]; } if (originalInsets.visibleTopInsets > loc[1]) { originalInsets.visibleTopInsets = loc[1]; } } @Override public void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +1 −0 Original line number Diff line number Diff line Loading @@ -720,6 +720,7 @@ public class InputMethodService extends AbstractInputMethodService { final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); mNavigationBarController.updateInsets(mTmpInsets); if (!mViewsCreated) { // The IME views are not ready, keep visible insets untouched. mTmpInsets.visibleTopInsets = 0; Loading
core/java/android/inputmethodservice/NavigationBarController.java +31 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ import java.util.Objects; final class NavigationBarController { private interface Callback { default void updateInsets(@NonNull InputMethodService.Insets originalInsets) { } default void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { } Loading Loading @@ -96,6 +100,15 @@ final class NavigationBarController { ? new Impl(inputMethodService) : Callback.NOOP; } /** * Update the given insets to be at least as big as the IME navigation bar, when visible. * * @param originalInsets the insets to check and modify to include the IME navigation bar. */ void updateInsets(@NonNull InputMethodService.Insets originalInsets) { mImpl.updateInsets(originalInsets); } void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { mImpl.updateTouchableInsets(originalInsets, dest); Loading Loading @@ -269,6 +282,24 @@ final class NavigationBarController { mNavigationBarFrame = null; } @Override public void updateInsets(@NonNull InputMethodService.Insets originalInsets) { if (!mImeDrawsImeNavBar || mNavigationBarFrame == null || mNavigationBarFrame.getVisibility() != View.VISIBLE || mService.isFullscreenMode()) { return; } final int[] loc = new int[2]; mNavigationBarFrame.getLocationInWindow(loc); if (originalInsets.contentTopInsets > loc[1]) { originalInsets.contentTopInsets = loc[1]; } if (originalInsets.visibleTopInsets > loc[1]) { originalInsets.visibleTopInsets = loc[1]; } } @Override public void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets, @NonNull ViewTreeObserver.InternalInsetsInfo dest) { Loading