From 4a1cdbd4e90a71290214f17b94ab65125e64d896 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 16 Apr 2018 11:09:22 -0700 Subject: Fix layering of non-IME target windows in IME-target app in split-screen. In split-screen mode we elevate child windows of the IME target with relative layering to ensure they and the IME can exist above the docked divider while the IME target itself still exists below. For behavior compatibility with O we need to give this same treatment to all windows with the same token as the IME target. Bug: 70811741 Test: Manual. go/wm-smoke. Change-Id: Ife174069ec2571c95d546981d196b7f519bb08ca --- .../java/com/android/server/wm/WindowState.java | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 61ce062d6047..425a2e16d064 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4708,16 +4708,38 @@ class WindowState extends WindowContainer implements WindowManagerP outPoint.offset(-mAttrs.surfaceInsets.left, -mAttrs.surfaceInsets.top); } + boolean needsRelativeLayeringToIme() { + // We only use the relative layering mode in split screen, as part of elevating the IME + // and windows above it's target above the docked divider. + if (!inSplitScreenWindowingMode()) { + return false; + } + + if (isChildWindow()) { + // If we are a child of the input method target we need this promotion. + if (getParentWindow().isInputMethodTarget()) { + return true; + } + } else if (mAppToken != null) { + // Likewise if we share a token with the Input method target and are ordered + // above it but not necessarily a child (e.g. a Dialog) then we also need + // this promotion. + final WindowState imeTarget = mService.mInputMethodTarget; + boolean inTokenWithAndAboveImeTarget = imeTarget != null && imeTarget != this + && imeTarget.mToken == mToken && imeTarget.compareTo(this) <= 0; + return inTokenWithAndAboveImeTarget; + } + return false; + } + @Override void assignLayer(Transaction t, int layer) { // See comment in assignRelativeLayerForImeTargetChild - if (!isChildWindow() - || (!getParentWindow().isInputMethodTarget()) - || !inSplitScreenWindowingMode()) { - super.assignLayer(t, layer); + if (needsRelativeLayeringToIme()) { + getDisplayContent().assignRelativeLayerForImeTargetChild(t, this); return; } - getDisplayContent().assignRelativeLayerForImeTargetChild(t, this); + super.assignLayer(t, layer); } @Override -- cgit v1.2.3-59-g8ed1b