diff options
3 files changed, 41 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 19409b1f3636..73759d3a3362 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4927,7 +4927,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // animation on the keyguard but seeing the IME window that originally on the app // which behinds the keyguard. final WindowState imeInputTarget = getImeInputTarget(); - if (imeInputTarget != null && !(imeInputTarget.isDrawn() || imeInputTarget.isVisible())) { + if (imeInputTarget != null + && !(imeInputTarget.isDrawn() || imeInputTarget.isVisibleRequested())) { return false; } return mDisplayContent.forAllImeWindows(callback, traverseTopToBottom); diff --git a/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java index c898119ea991..cdb264222a7e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java @@ -443,6 +443,44 @@ public class InsetsStateControllerTest extends WindowTestsBase { } @Test + public void testUpdateAboveInsetsState_imeTargetOnScreenBehavior() { + final WindowToken imeToken = createTestWindowToken(TYPE_INPUT_METHOD, mDisplayContent); + final WindowState ime = createWindow(null, TYPE_INPUT_METHOD, imeToken, "ime"); + final WindowState app = createTestWindow("app"); + + getController().getSourceProvider(ITYPE_IME).setWindowContainer(ime, null, null); + ime.getControllableInsetProvider().setServerVisible(true); + + app.mActivityRecord.setVisibility(true); + mDisplayContent.setImeLayeringTarget(app); + mDisplayContent.updateImeInputAndControlTarget(app); + + app.setRequestedVisibleTypes(ime(), ime()); + getController().onInsetsModified(app); + assertTrue(ime.getControllableInsetProvider().getSource().isVisible()); + + getController().updateAboveInsetsState(true /* notifyInsetsChange */); + assertNotNull(app.getInsetsState().peekSource(ITYPE_IME)); + verify(app, atLeastOnce()).notifyInsetsChanged(); + + // Expect the app will still get IME insets even when the app was invisible. + // (i.e. app invisible after locking the device) + app.mActivityRecord.setVisible(false); + app.setHasSurface(false); + getController().updateAboveInsetsState(true /* notifyInsetsChange */); + assertNotNull(app.getInsetsState().peekSource(ITYPE_IME)); + verify(app, atLeastOnce()).notifyInsetsChanged(); + + // Expect the app will get IME insets when the app is requesting visible. + // (i.e. app is going to visible when unlocking the device) + app.mActivityRecord.setVisibility(true); + assertTrue(app.isVisibleRequested()); + getController().updateAboveInsetsState(true /* notifyInsetsChange */); + assertNotNull(app.getInsetsState().peekSource(ITYPE_IME)); + verify(app, atLeastOnce()).notifyInsetsChanged(); + } + + @Test public void testDispatchGlobalInsets() { final WindowState navBar = createWindow(null, TYPE_APPLICATION, "navBar"); getController().getSourceProvider(ITYPE_NAVIGATION_BAR).setWindowContainer(navBar, null, diff --git a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java index c548dc3aebd5..eb26415c2b21 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -772,6 +772,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { // Simulating now win1 is being covered by the lockscreen which has no surface, // and then launching an activity win2 with the remote animation win1.mHasSurface = false; + win1.mActivityRecord.setVisibility(false); mDisplayContent.mOpeningApps.add(win2.mActivityRecord); final AnimationAdapter adapter = mController.createRemoteAnimationRecord( win2.mActivityRecord, new Point(50, 100), null, |