SF: Cleanup Layer membership test
Rather than passing the individual data for the layer (stack id,
primaryOnly flag), pass the entire layer, and have the Output class look
for the right data.
This makes it easier to change the membership logic later if desired.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: Ieccb3986dd4f045b68329825a7e3e05734811cc0
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index cb04e95..a9b1d55 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -219,6 +219,15 @@
(!internalOnly || mState.layerStackInternal);
}
+bool Output::belongsInOutput(const compositionengine::Layer* layer) const {
+ if (!layer) {
+ return false;
+ }
+
+ const auto& layerFEState = layer->getState().frontEnd;
+ return belongsInOutput(layerFEState.layerStackId, layerFEState.internalOnly);
+}
+
compositionengine::OutputLayer* Output::getOutputLayerForLayer(
compositionengine::Layer* layer) const {
for (const auto& outputLayer : mOutputLayersOrderedByZ) {