diff options
| author | Tiger Huang <tigerhuang@google.com> | 2020-09-23 17:08:09 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-09-23 17:08:09 +0000 |
| commit | 2ca936f4f0995611d2419c475e0df9cabe5b39c9 (patch) | |
| tree | e64830da74921b76137eebff6700794c0a274893 /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | 927e1f2a83031df57e659138dfe5d49ca5c09ae5 (diff) | |
| parent | 8fa94341e041bf65fce90a6950946446d283bdcc (diff) | |
Merge "Don't let IME window fit status bar" into rvc-qpr-dev am: 022e779ae5 am: 8fa94341e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12629660
Change-Id: I23e8c432b52df33c17024c4f87679784b43f7c79
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 60ddd8ab22a0..d62d1e1e5775 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -16,10 +16,10 @@ package android.inputmethodservice; +import static android.graphics.Color.TRANSPARENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; 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; @@ -69,7 +69,6 @@ import android.view.ViewGroup; 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; @@ -1204,25 +1203,22 @@ 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(statusBars() | navigationBars()); + mWindow.getWindow().getAttributes().setFitInsetsTypes(navigationBars()); mWindow.getWindow().getAttributes().setFitInsetsSides(Side.all() & ~Side.BOTTOM); mWindow.getWindow().getAttributes().setFitInsetsIgnoringVisibility(true); - // IME layout should always be inset by navigation bar, no matter its current visibility, - // 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. + // Our window will extend into the status bar area no matter the bar is visible or not. + // We don't want the ColorView to be visible when status bar is shown. + mWindow.getWindow().setStatusBarColor(TRANSPARENT); + + // 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(), - insets.getInsetsIgnoringVisibility(navigationBars())) - .build())); // For ColorView in DecorView to work, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS needs to be set // by default (but IME developers can opt this out later if they want a new behavior). |
