summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2021-12-08 21:24:05 -0800
committer Evan Rosky <erosky@google.com> 2021-12-29 13:44:12 -0800
commit4c4ba205cf59301adcb13ec7ea719a74b22ae693 (patch)
treeab745451f5a08401d6326287cdc5f92d91d62513
parent6489e997ac4fd9761da3b54bbbedc778eec66887 (diff)
Visible activity can be an ime target
While an activity is still visible, it is still an ime target even if it is going away. This fixes the problem with shell transitions where IME is detached from the live tile while entering recents. During recents, the the recents activity is on-top but has canBeImeTarget() -> false. The IME code then searches for the next-highest ImeTarget candidate. Since the live-tile activity is still visible, it should be the next candidate. Bug: 193565597 Test: open app and open IME. Go to recents. IME should be attached to app atest WindowStateTests Change-Id: I197359e2c21da4c4f1dedaaa43fd1ca76a135ce8
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java6
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java5
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 f6729c552cc3..a55f66d72685 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 */);