Merge "SurfaceFlinger: Consider parent alpha as well"
diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp
index bf4a859..884aedd 100644
--- a/services/surfaceflinger/ColorLayer.cpp
+++ b/services/surfaceflinger/ColorLayer.cpp
@@ -68,8 +68,7 @@
 }
 
 bool ColorLayer::isVisible() const {
-    const Layer::State& s(getDrawingState());
-    return !isHiddenByPolicy() && s.color.a;
+    return !isHiddenByPolicy() && getAlpha() > 0.0f;
 }
 
 void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 63e058a..2d6d470 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3214,7 +3214,8 @@
                 case HWC2::Composition::SolidColor: {
                     const Layer::State& state(layer->getDrawingState());
                     if (layer->getClearClientTarget(displayId) && !firstLayer &&
-                        layer->isOpaque(state) && (state.color.a == 1.0f) && hasClientComposition) {
+                        layer->isOpaque(state) && (layer->getAlpha() == 1.0f) &&
+                        hasClientComposition) {
                         // never clear the very first layer since we're
                         // guaranteed the FB is already cleared
                         layer->clearWithOpenGL(renderArea);