Fix SurfaceControl#captureLayers when the layer is boundless
- Return an error if the client tries to screenshot a boundless layer without
specifying a crop. Otherwise the client will get a screenshot of 0x0.
- Use the crop in addition to the buffer size when determining the bounds of
the captured layer. This will enable us to capture container layers and color
layers that have a crop specified.
Fixes: 141326137
Test: atest SurfaceFlinger_test
Test: go/wm-smoke
Change-Id: Ibba4c01ad2d6739caee0d85b8d9c2d236fbf0ce0
diff --git a/services/surfaceflinger/tests/utils/TransactionUtils.h b/services/surfaceflinger/tests/utils/TransactionUtils.h
index 22df255..2c63da0 100644
--- a/services/surfaceflinger/tests/utils/TransactionUtils.h
+++ b/services/surfaceflinger/tests/utils/TransactionUtils.h
@@ -136,6 +136,11 @@
}
}
+ static void fillSurfaceRGBA8(const sp<SurfaceControl>& sc, const Color& color,
+ bool unlock = true) {
+ fillSurfaceRGBA8(sc, color.r, color.g, color.b, unlock);
+ }
+
// Fill an RGBA_8888 formatted surface with a single color.
static void fillSurfaceRGBA8(const sp<SurfaceControl>& sc, uint8_t r, uint8_t g, uint8_t b,
bool unlock = true) {