Store layer snapshot in LayerRenderArea
Accessing the layer snapshot from a RenderArea lessens the
dependency on getting the layer snapshot from SF's
mLayerSnapshotBuilder, which needs to run on the main thread.
Bug: b/294936197
Test: atest SurfaceFlinger_test
Change-Id: I7c2a77a432ddae3f7bdd39311a3a505aa8f763d6
diff --git a/services/surfaceflinger/RenderArea.h b/services/surfaceflinger/RenderArea.h
index 18a5304..e8d20af 100644
--- a/services/surfaceflinger/RenderArea.h
+++ b/services/surfaceflinger/RenderArea.h
@@ -4,6 +4,8 @@
#include <ui/Transform.h>
#include <functional>
+
+#include "FrontEnd/LayerSnapshot.h"
#include "Layer.h"
namespace android {
@@ -82,6 +84,10 @@
// capture operation.
virtual sp<Layer> getParentLayer() const { return nullptr; }
+ // If this is a LayerRenderArea, return the layer snapshot
+ // of the root layer of the capture operation
+ virtual const frontend::LayerSnapshot* getLayerSnapshot() const { return nullptr; }
+
// Returns whether the render result may be used for system animations that
// must preserve the exact colors of the display.
bool getHintForSeamlessTransition() const { return mHintForSeamlessTransition; }