diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 411059de2a20d..206f67ec6751e 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -2449,6 +2449,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp setWindowingMode(windowingMode); } + /** + * See {@code WindowState#applyImeWindowsIfNeeded} for the details that we won't traverse the + * IME window in some cases. + */ boolean forAllImeWindows(ToBooleanFunction callback, boolean traverseTopToBottom) { return mImeWindowsContainer.forAllWindowForce(callback, traverseTopToBottom); } @@ -4566,6 +4570,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private boolean skipImeWindowsDuringTraversal(DisplayContent dc) { // We skip IME windows so they're processed just above their target, except // in split-screen mode where we process the IME containers above the docked divider. + // Note that this method check should align with {@link + // WindowState#applyImeWindowsIfNeeded} in case of any state mismatch. return dc.getImeTarget(IME_TARGET_LAYERING) != null && !dc.getDefaultTaskDisplayArea().isSplitScreenModeActivated(); } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index b40223f6eed79..540035fb6c976 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4842,7 +4842,10 @@ class WindowState extends WindowContainer implements WindowManagerP // directly above it. The exception is if we are in split screen // in which case we process the IME at the DisplayContent level to // ensure it is above the docked divider. - if (isImeLayeringTarget() && !inSplitScreenWindowingMode()) { + // (i.e. Like {@link DisplayContent.ImeContainer#skipImeWindowsDuringTraversal}, the IME + // window will be ignored to traverse when the IME target is still in split-screen mode). + if (isImeLayeringTarget() + && !getDisplayContent().getDefaultTaskDisplayArea().isSplitScreenModeActivated()) { if (getDisplayContent().forAllImeWindows(callback, traverseTopToBottom)) { return true; }