diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/InsetsPolicy.java | 18 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java index 24a6f118ad04..4bcba13448e9 100644 --- a/services/core/java/com/android/server/wm/InsetsPolicy.java +++ b/services/core/java/com/android/server/wm/InsetsPolicy.java @@ -258,16 +258,13 @@ class InsetsPolicy { * We also need to exclude certain types of insets source for client within specific windowing * modes. * - * @param attrs the LayoutParams of the target - * @param windowingMode the windowing mode of the target - * @param isAlwaysOnTop is the target always on top + * @param target the target on which the policy is applied * @param state the input inset state containing all the sources * @return The state stripped of the necessary information. */ - InsetsState enforceInsetsPolicyForTarget(WindowManager.LayoutParams attrs, - @WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop, - InsetsState state) { + InsetsState enforceInsetsPolicyForTarget(WindowState target, InsetsState state) { final InsetsState originalState = state; + final WindowManager.LayoutParams attrs = target.getAttrs(); // The caller should not receive the visible insets provided by itself. if (attrs.type == TYPE_INPUT_METHOD) { @@ -316,12 +313,17 @@ class InsetsPolicy { } } + final @WindowConfiguration.WindowingMode int windowingMode = target.getWindowingMode(); if (WindowConfiguration.isFloating(windowingMode) - || (windowingMode == WINDOWING_MODE_MULTI_WINDOW && isAlwaysOnTop)) { + || (windowingMode == WINDOWING_MODE_MULTI_WINDOW && target.isAlwaysOnTop())) { // Keep frames, caption, and IME. int types = WindowInsets.Type.captionBar(); if (windowingMode != WINDOWING_MODE_PINNED) { - types |= WindowInsets.Type.ime(); + if (!Flags.refactorInsetsController() || (mDisplayContent != null + && target == mDisplayContent.getImeInputTarget() + && (WindowInsets.Type.ime() & target.getRequestedVisibleTypes()) != 0)) { + types |= WindowInsets.Type.ime(); + } } final InsetsState newState = new InsetsState(); newState.set(state, types); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index cebe790bb1b9..58723a9aa3d5 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1631,8 +1631,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } final InsetsState rawInsetsState = mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState(); - final InsetsState insetsStateForWindow = insetsPolicy.enforceInsetsPolicyForTarget( - mAttrs, getWindowingMode(), isAlwaysOnTop(), rawInsetsState); + final InsetsState insetsStateForWindow = insetsPolicy.enforceInsetsPolicyForTarget(this, + rawInsetsState); return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow, includeTransient); } |