From f40af50d736796850a7d151d787eb7cf7e038942 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Mon, 24 Apr 2023 11:26:59 +0900 Subject: [PATCH] Expose invisible windows from WindowInfosListenerForTest This is useful for tests that adds an transparent overlay and wait for its readiness. Bug: 226803477 Test: CtsWindowManagerDeviceTestCases:SurfaceControlViewHostTests CtsWindowManagerDeviceTestCases:WindowInputTests Change-Id: I59ede5a38b729c756abc32fd682ef2d132098533 --- core/api/test-current.txt | 1 + core/java/android/window/WindowInfosListenerForTest.java | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/api/test-current.txt b/core/api/test-current.txt index ae63816945e18..5f2387ae5274b 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -4156,6 +4156,7 @@ package android.window { public static class WindowInfosListenerForTest.WindowInfo { field @NonNull public final android.graphics.Rect bounds; field public final boolean isTrustedOverlay; + field public final boolean isVisible; field @NonNull public final String name; field @NonNull public final android.os.IBinder windowToken; } diff --git a/core/java/android/window/WindowInfosListenerForTest.java b/core/java/android/window/WindowInfosListenerForTest.java index 01e577fc5c6af..cfbeeffb91a6f 100644 --- a/core/java/android/window/WindowInfosListenerForTest.java +++ b/core/java/android/window/WindowInfosListenerForTest.java @@ -68,12 +68,18 @@ public class WindowInfosListenerForTest { */ public final boolean isTrustedOverlay; + /** + * True if the window is visible. + */ + public final boolean isVisible; + WindowInfo(@NonNull IBinder windowToken, @NonNull String name, @NonNull Rect bounds, int inputConfig) { this.windowToken = windowToken; this.name = name; this.bounds = bounds; this.isTrustedOverlay = (inputConfig & InputConfig.TRUSTED_OVERLAY) != 0; + this.isVisible = (inputConfig & InputConfig.NOT_VISIBLE) == 0; } } @@ -131,9 +137,6 @@ public class WindowInfosListenerForTest { private static List buildWindowInfos(InputWindowHandle[] windowHandles) { var windowInfos = new ArrayList(windowHandles.length); for (var handle : windowHandles) { - if ((handle.inputConfig & InputConfig.NOT_VISIBLE) != 0) { - continue; - } var bounds = new Rect(handle.frameLeft, handle.frameTop, handle.frameRight, handle.frameBottom); windowInfos.add(new WindowInfo(handle.getWindowToken(), handle.name, bounds,