diff options
| author | Heemin Seog <hseog@google.com> | 2020-08-18 16:44:38 -0700 |
|---|---|---|
| committer | Heemin Seog <hseog@google.com> | 2020-08-21 19:38:44 +0000 |
| commit | b0d0d7c46ab0425431912d2e03cc620be657a969 (patch) | |
| tree | bfa5be13b919c27089816c5f0edc06f786aac3ad /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | bae844a14d42430ddb2932cc16efefa5b63b41df (diff) | |
Smooth out IME animation for automotive devices
Automotive devices may request the navigation bar to be
hidden when the IME shows up (controlled via
config_automotiveHideNavBarForKeyboard) in order to maximize
the visible screen real estate. When this happens, the IME window
should animate from the bottom of the screen to reduce the jank
that happens from the lack of synchronization between the bottom
system window and the IME window.
Bug: 163418214
Test: manual
Change-Id: I5d7b03d5c829a2679efdd06fa961d1158494e08f
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index c5a11abe1136..4f0c84e586a2 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -1208,15 +1208,19 @@ public class InputMethodService extends AbstractInputMethodService { mWindow.getWindow().getAttributes().setFitInsetsIgnoringVisibility(true); // 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. + // unless automotive requests it. Automotive devices may request the navigation bar to be + // hidden when the IME shows up (controlled via config_automotiveHideNavBarForKeyboard) + // in order to maximize the visible screen real estate. When this happens, the IME window + // should animate from the bottom of the screen to reduce the jank that happens from the + // lack of synchronization between the bottom system window and the IME window. + if (mIsAutomotive && mAutomotiveHideNavBarForKeyboard) { + mWindow.getWindow().setDecorFitsSystemWindows(false); + } mWindow.getWindow().getDecorView().setOnApplyWindowInsetsListener( (v, insets) -> v.onApplyWindowInsets( new WindowInsets.Builder(insets).setInsets( navigationBars(), - mIsAutomotive && mAutomotiveHideNavBarForKeyboard - ? android.graphics.Insets.NONE - : insets.getInsetsIgnoringVisibility(navigationBars()) - ) + insets.getInsetsIgnoringVisibility(navigationBars())) .build())); // For ColorView in DecorView to work, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS needs to be set |
