diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 6 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 863e3ca3bc28..573ff2ff9963 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2547,7 +2547,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (DEBUG_INPUT_METHOD) { Slog.i(TAG_WM, "isVisibleRequestedOrAdding " + this + ": " - + isVisibleRequestedOrAdding()); + + isVisibleRequestedOrAdding() + " isVisible: " + (isVisible() + && mActivityRecord != null && mActivityRecord.isVisible())); if (!isVisibleRequestedOrAdding()) { Slog.i(TAG_WM, " mSurfaceController=" + mWinAnimator.mSurfaceController + " relayoutCalled=" + mRelayoutCalled @@ -2562,7 +2563,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } } } - return isVisibleRequestedOrAdding(); + return isVisibleRequestedOrAdding() + || (isVisible() && mActivityRecord != null && mActivityRecord.isVisible()); } private final class DeadWindowEventReceiver extends InputEventReceiver { diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java index ca2b4aebc736..ec8ec2b31918 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java @@ -252,6 +252,11 @@ public class WindowStateTests extends WindowTestsBase { assertFalse(appWindow.canBeImeTarget()); appWindow.mActivityRecord.setWindowingMode(initialMode); + // Verify that app window can still be IME target as long as it is visible (even if + // it is going to become invisible). + appWindow.mActivityRecord.mVisibleRequested = false; + assertTrue(appWindow.canBeImeTarget()); + // Make windows invisible appWindow.hide(false /* doAnimation */, false /* requestAnim */); imeWindow.hide(false /* doAnimation */, false /* requestAnim */); |