Remove legacy layer path in screenshot pathway
Legacy path to get layer snapshots is no longer used
and the flag can be removed to clean up the code.
Also renames layer snapshot function variable for better
clarity that the function is not immediately called wherever
declared.
Bug: b/330785038
Test: presubmit
Test: atest SurfaceFlinger_test
Change-Id: I12498f2560de07d69fff93eda901f6b7c072fce6
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 2b4e234..59eb7f5 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -315,39 +315,15 @@
return true;
};
- std::function<std::vector<std::pair<Layer*, sp<LayerFE>>>()> getLayerSnapshots;
- if (mFlinger.mLayerLifecycleManagerEnabled) {
- auto filterFn = [&](const frontend::LayerSnapshot& snapshot,
- bool& outStopTraversal) -> bool {
- const Rect bounds =
- frontend::RequestedLayerState::reduce(Rect(snapshot.geomLayerBounds),
- snapshot.transparentRegionHint);
- const ui::Transform transform = snapshot.geomLayerTransform;
- return layerFilterFn(snapshot.name.c_str(), snapshot.path.id, bounds, transform,
- outStopTraversal);
- };
- getLayerSnapshots =
- mFlinger.getLayerSnapshotsForScreenshots(layerStack, CaptureArgs::UNSET_UID,
- filterFn);
- } else {
- auto traverseLayers = [&](const LayerVector::Visitor& visitor) {
- bool stopLayerFound = false;
- auto filterVisitor = [&](Layer* layer) {
- // We don't want to capture any layers beyond the stop layer
- if (stopLayerFound) return;
-
- if (!layerFilterFn(layer->getDebugName(), layer->getSequence(),
- Rect(layer->getBounds()), layer->getTransform(),
- stopLayerFound)) {
- return;
- }
- visitor(layer);
- };
- mFlinger.traverseLayersInLayerStack(layerStack, CaptureArgs::UNSET_UID, {},
- filterVisitor);
- };
- getLayerSnapshots = RenderArea::fromTraverseLayersLambda(traverseLayers);
- }
+ auto filterFn = [&](const frontend::LayerSnapshot& snapshot, bool& outStopTraversal) -> bool {
+ const Rect bounds = frontend::RequestedLayerState::reduce(Rect(snapshot.geomLayerBounds),
+ snapshot.transparentRegionHint);
+ const ui::Transform transform = snapshot.geomLayerTransform;
+ return layerFilterFn(snapshot.name.c_str(), snapshot.path.id, bounds, transform,
+ outStopTraversal);
+ };
+ auto getLayerSnapshotsFn =
+ mFlinger.getLayerSnapshotsForScreenshots(layerStack, CaptureArgs::UNSET_UID, filterFn);
std::shared_ptr<renderengine::ExternalTexture> buffer = nullptr;
if (mCachedBuffer && mCachedBuffer->getBuffer()->getWidth() == sampledBounds.getWidth() &&
@@ -379,7 +355,7 @@
ui::Dataspace::V0_SRGB,
kHintForSeamlessTransition,
true /* captureSecureLayers */, displayWeak),
- getLayerSnapshots, buffer, kRegionSampling, kGrayscale,
+ getLayerSnapshotsFn, buffer, kRegionSampling, kGrayscale,
kIsProtected, nullptr)
.get();
fenceResult.ok()) {