From eddfe939edcc9b3f4ce73cb6c2de21f588856df8 Mon Sep 17 00:00:00 2001 From: Melody Hsu Date: Tue, 4 Jun 2024 18:10:41 +0000 Subject: 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 --- services/surfaceflinger/RegionSamplingThread.cpp | 44 ++++++------------------ 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'services/surfaceflinger/RegionSamplingThread.cpp') diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 2b4e234604..59eb7f5d4a 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -315,39 +315,15 @@ void RegionSamplingThread::captureSample() { return true; }; - std::function>>()> 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 buffer = nullptr; if (mCachedBuffer && mCachedBuffer->getBuffer()->getWidth() == sampledBounds.getWidth() && @@ -379,7 +355,7 @@ void RegionSamplingThread::captureSample() { ui::Dataspace::V0_SRGB, kHintForSeamlessTransition, true /* captureSecureLayers */, displayWeak), - getLayerSnapshots, buffer, kRegionSampling, kGrayscale, + getLayerSnapshotsFn, buffer, kRegionSampling, kGrayscale, kIsProtected, nullptr) .get(); fenceResult.ok()) { -- cgit v1.2.3-59-g8ed1b