Refactor of screenshot code on main thread.
Create helper functions to improve readability of what is scheduled on
the SurfaceFlinger main thread. This will allow for cleaner changes in
reducing the calls on the main thread for screenshots. Changes include
some renaming for better clarity.
Bug: b/294936197
Test: presubmit
Test: atest SurfaceFlinger_test
Change-Id: I729b62b3fc1919b5b048b7992b4aead336e87d7f
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index be05797..fdeede1 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -874,13 +874,17 @@
// Boot animation, on/off animations and screen capture
void startBootAnim();
+ bool layersHasProtectedLayer(const std::vector<std::pair<Layer*, sp<LayerFE>>>& layers) const;
+
void captureScreenCommon(RenderAreaFuture, GetLayerSnapshotsFunction, ui::Size bufferSize,
ui::PixelFormat, bool allowProtected, bool grayscale,
const sp<IScreenCaptureListener>&);
- ftl::SharedFuture<FenceResult> captureScreenCommon(
+
+ ftl::SharedFuture<FenceResult> captureScreenshot(
RenderAreaFuture, GetLayerSnapshotsFunction,
const std::shared_ptr<renderengine::ExternalTexture>&, bool regionSampling,
bool grayscale, bool isProtected, const sp<IScreenCaptureListener>&);
+
ftl::SharedFuture<FenceResult> renderScreenImpl(
std::shared_ptr<const RenderArea>, GetLayerSnapshotsFunction,
const std::shared_ptr<renderengine::ExternalTexture>&, bool regionSampling,