Capture layer and children when calling takeSurfaceControlScreenshot

When calling UiAutomationConnection.takeSurfaceControlScreenshot, it
should capture the requested SurfaceControl and its children. The
current code only captures the children. Therefore, call setChildrenOnly
with false to ensure it captures the parent, as well.

Test: ASurfaceControlTest
Bug: 185390632
Change-Id: I62707f808934177c8db05485ac28559982b8c607
This commit is contained in:
chaviw
2021-05-04 14:32:48 -05:00
parent 3c865b129a
commit 80bb00b977

View File

@@ -220,7 +220,9 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
final long identity = Binder.clearCallingIdentity();
try {
captureBuffer = SurfaceControl.captureLayers(
new SurfaceControl.LayerCaptureArgs.Builder(surfaceControl).build());
new SurfaceControl.LayerCaptureArgs.Builder(surfaceControl)
.setChildrenOnly(false)
.build());
} finally {
Binder.restoreCallingIdentity(identity);
}