Merge "Don't create CE Layer when EffectLayer has nothing to draw." into tm-dev
diff --git a/services/surfaceflinger/EffectLayer.cpp b/services/surfaceflinger/EffectLayer.cpp
index cc85352..e8c590e 100644
--- a/services/surfaceflinger/EffectLayer.cpp
+++ b/services/surfaceflinger/EffectLayer.cpp
@@ -114,7 +114,13 @@
}
sp<compositionengine::LayerFE> EffectLayer::getCompositionEngineLayerFE() const {
- return asLayerFE();
+ // There's no need to get a CE Layer if the EffectLayer isn't going to draw anything. In that
+ // case, it acts more like a ContainerLayer so returning a null CE Layer makes more sense
+ if (hasSomethingToDraw()) {
+ return asLayerFE();
+ } else {
+ return nullptr;
+ }
}
compositionengine::LayerFECompositionState* EffectLayer::editCompositionState() {