SurfaceFlinger: Consider parent alpha as well

sf: Use layer alpha derived from parent layer

Layer::getAlpha() function derives the plane alpha value for child
layer from its parent layer. This alpha value is passed across all
the composition devices like MDP and GPU for all child layers. But
while clearing the FB region, only child layer alpha is checked
instead of derived alpha value from parent. This causes FB clear to
happen for non opaque layer results in flickering effect. Use derived
alpha value from parent to fix the issue

SF: Consider parent alpha as well in dim layer

Consider parent alpha as well in dim layer during client
composition same as device composition.

Bug: b/110632776
Test: Run sffakehwc_test with new test cases in ChildColorLayerTest
Change-Id: I99f320e0224f77ca1596f08d259d56907f82d6cc
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);