Expose transform to WindowInfosListenerForTest

Expose transform for WindowInfos so the VD bounds can be properly set
when getting a screenrecord for a specific window.

Bug: 288339794
Test: SurfacePackageFlickerTest on landscape device
Change-Id: Iaeda32e5bcb217b86642940dc590fa02ff6b06b0
This commit is contained in:
Chavi Weingarten
2023-07-17 22:12:30 +00:00
parent aa65577938
commit 18e30fdeb5
2 changed files with 13 additions and 3 deletions

View File

@@ -4235,6 +4235,7 @@ package android.window {
field public final boolean isTrustedOverlay;
field public final boolean isVisible;
field @NonNull public final String name;
field @NonNull public final android.graphics.Matrix transform;
field @NonNull public final android.os.IBinder windowToken;
}

View File

@@ -20,6 +20,7 @@ import android.Manifest;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.InputConfig;
@@ -78,14 +79,21 @@ public class WindowInfosListenerForTest {
*/
public final boolean isVisible;
/**
* Return the transform to get the bounds from display space into window space.
*/
@NonNull
public final Matrix transform;
WindowInfo(@NonNull IBinder windowToken, @NonNull String name, int displayId,
@NonNull Rect bounds, int inputConfig) {
@NonNull Rect bounds, int inputConfig, @NonNull Matrix transform) {
this.windowToken = windowToken;
this.name = name;
this.displayId = displayId;
this.bounds = bounds;
this.isTrustedOverlay = (inputConfig & InputConfig.TRUSTED_OVERLAY) != 0;
this.isVisible = (inputConfig & InputConfig.NOT_VISIBLE) == 0;
this.transform = transform;
}
@Override
@@ -94,7 +102,8 @@ public class WindowInfosListenerForTest {
+ ", frame=" + bounds
+ ", isVisible=" + isVisible
+ ", isTrustedOverlay=" + isTrustedOverlay
+ ", token=" + windowToken;
+ ", token=" + windowToken
+ ", transform=" + transform;
}
}
@@ -155,7 +164,7 @@ public class WindowInfosListenerForTest {
var bounds = new Rect(handle.frameLeft, handle.frameTop, handle.frameRight,
handle.frameBottom);
windowInfos.add(new WindowInfo(handle.getWindowToken(), handle.name, handle.displayId,
bounds, handle.inputConfig));
bounds, handle.inputConfig, handle.transform));
}
return windowInfos;
}