From ea491da863774457299ffd5f2534dc2ba4d3ba52 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Mon, 3 May 2021 23:20:33 +0800 Subject: Let IME receive insets ignoring z-order When IME is targeting notification shade, IME will be above status bar, and IME won't receive status bar insets anymore. The surface position of the control of IME will be changed because IME fits status bar. If the IME control target receives the new IME control (new surface position) after the IME animation starts, the IME position will be stale until the next IME animation, because the controls would be copied before playing the insets animation. This CL lets IME receive insets no matter what z-order IME has. So the IME position will stay the same while it is moved above system bars, and the IME behavior will be the same as before Android S (receiving status bar insets while targeting notification shade). Fix: 186178729 Test: Steps as below: 1. Make, install, and open EditTextVariations. 2. Open menu, and select Direct Reply. 3. Expand notification shade. 4. Expand the notification of EditTextVariations. 5. Click Direct Teply Test. 6. See if IME is overlapped with (button-based) navigation bar. If no, press home button and repeat 3-6 for several times. Change-Id: I53c64a5598f246ad577f652156903e4666a30cd9 --- core/java/android/inputmethodservice/InputMethodService.java | 1 + 1 file changed, 1 insertion(+) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 5267aa81bdaf..c5b4d48f0191 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -1323,6 +1323,7 @@ public class InputMethodService extends AbstractInputMethodService { WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); mWindow.getWindow().getAttributes().setFitInsetsTypes(statusBars() | navigationBars()); mWindow.getWindow().getAttributes().setFitInsetsSides(Side.all() & ~Side.BOTTOM); + mWindow.getWindow().getAttributes().receiveInsetsIgnoringZOrder = true; // 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 -- cgit v1.2.3