diff options
| author | Tiger Huang <tigerhuang@google.com> | 2020-03-10 21:20:58 +0800 |
|---|---|---|
| committer | Tiger Huang <tigerhuang@google.com> | 2020-03-10 21:40:40 +0800 |
| commit | c8364e3878aa8e0f9e8dda1bd5305c5ef7eeada0 (patch) | |
| tree | 1c871933319321e7b2538bbe00cd61c9f9c2abce /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | 82f3ed2925a9520e160165fdb39e0601400b453c (diff) | |
Make IME fit navgation bars at left and right sides
IME is not big enough to be the background of navigation bar when
navigation bar is on the left or right edge of the screen. Also,
IME can be on top of navigation bar in landscape split-screen mode,
we don't want IME to block touches on navigation bar.
Fix: 151083985
Test: 1. Open Messages.
2. Rotate device to landscape.
3. Click on "Search message" and see if IME extends into
the navigation bar area at the left or right edge.
Change-Id: I0ef3d6379a9ae52b3749154d2fdc54e9aa94a9e0
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 1b6c1ee4f7e2..7e4d68d9925e 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -20,6 +20,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE; import static android.view.WindowInsets.Type.navigationBars; +import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -71,6 +72,7 @@ import android.view.ViewRootImpl; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowInsets; +import android.view.WindowInsets.Side; import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.view.autofill.AutofillId; @@ -1246,7 +1248,8 @@ public class InputMethodService extends AbstractInputMethodService { Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState, WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); - mWindow.getWindow().getAttributes().setFitInsetsTypes(WindowInsets.Type.statusBars()); + mWindow.getWindow().getAttributes().setFitInsetsTypes(statusBars() | navigationBars()); + mWindow.getWindow().getAttributes().setFitInsetsSides(Side.all() & ~Side.BOTTOM); // IME layout should always be inset by navigation bar, no matter its current visibility, // unless automotive requests it, since automotive may hide the navigation bar. |
