summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2022-06-17 19:23:57 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-06-17 19:23:57 +0000
commit40b4671c26fe889f89c5536f7c46296edcb3c402 (patch)
treebbd06f66d085805fe2fd8ac0fe616d8ceae4f79f
parent532c4fbaf5276167b82088d8d0b6de57dae9e755 (diff)
parente79e811a50cf3074c1c8a2df302697ed941859e7 (diff)
Merge "Do not set insets changed for invisible window" into tm-dev am: e79e811a50
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18912001 Change-Id: I581857d6c8e8b93dbc7cc1582ba1acb921f7c3ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java9
2 files changed, 12 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 3bb40b03a0a5..4c32edc6d709 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -884,7 +884,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* {@link InsetsStateController#notifyInsetsChanged}.
*/
boolean isReadyToDispatchInsetsState() {
- return isVisibleRequested() && mFrozenInsetsState == null;
+ final boolean visible = shouldCheckTokenVisibleRequested()
+ ? isVisibleRequested() : isVisible();
+ return visible && mFrozenInsetsState == null;
}
void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation,
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 e8f343e73256..20935f1d199e 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -927,6 +927,15 @@ public class WindowStateTests extends WindowTestsBase {
assertTrue(app.isReadyToDispatchInsetsState());
mDisplayContent.getInsetsStateController().notifyInsetsChanged();
verify(app).notifyInsetsChanged();
+
+ // Verify that invisible non-activity window won't dispatch insets changed.
+ final WindowState overlay = createWindow(null, TYPE_APPLICATION_OVERLAY, "overlay");
+ makeWindowVisible(overlay);
+ assertTrue(overlay.isReadyToDispatchInsetsState());
+ overlay.mHasSurface = false;
+ assertFalse(overlay.isReadyToDispatchInsetsState());
+ mDisplayContent.getInsetsStateController().notifyInsetsChanged();
+ assertFalse(overlay.getWindowFrames().hasInsetsChanged());
}
@UseTestDisplay(addWindows = {W_INPUT_METHOD, W_ACTIVITY})