Unified layer capture functions into one function
Cleaned up SurfaceComposerClient layer screenshot functions so there
is only function that takes a screenshot based on layer. It
accepts a LayerCaptureArgs and returns ScreenCaptureResults object.
Test: Layer screenshots in recents
Bug: 162367424
Change-Id: Iadee8024ebe895afb290a0ed798cbf8b637b30dd
diff --git a/services/surfaceflinger/tests/Credentials_test.cpp b/services/surfaceflinger/tests/Credentials_test.cpp
index 166d631..10a517e 100644
--- a/services/surfaceflinger/tests/Credentials_test.cpp
+++ b/services/surfaceflinger/tests/Credentials_test.cpp
@@ -18,7 +18,6 @@
namespace {
const String8 DISPLAY_NAME("Credentials Display Test");
const String8 SURFACE_NAME("Test Surface Name");
-const float FRAME_SCALE = 1.0f;
} // namespace
/**
@@ -272,10 +271,12 @@
setupBackgroundSurface();
sp<GraphicBuffer> outBuffer;
std::function<status_t()> condition = [=]() {
- sp<GraphicBuffer> outBuffer;
- return ScreenshotClient::captureLayers(mBGSurfaceControl->getHandle(),
- ui::Dataspace::V0_SRGB, ui::PixelFormat::RGBA_8888,
- Rect(0, 0, 1, 1), FRAME_SCALE, &outBuffer);
+ LayerCaptureArgs captureArgs;
+ captureArgs.layerHandle = mBGSurfaceControl->getHandle();
+ captureArgs.sourceCrop = {0, 0, 1, 1};
+
+ ScreenCaptureResults captureResults;
+ return ScreenshotClient::captureLayers(captureArgs, captureResults);
};
ASSERT_NO_FATAL_FAILURE(checkWithPrivileges<status_t>(condition, NO_ERROR, PERMISSION_DENIED));
}