Check BufferLayer's alpha value when canReceiveInput
For BufferLayer, the alpha value will affect the final present result.
However, in previous behavior, it only checked the policy flag, that
could cause the transparent surface can still recevie the touch if WM
side didn't hide the surface properly and the alpha value becomes to 0.
To fix this, we have to check the alpha value if the buffer is exist.
Bug: 201647070
Bug: 200837970
Test: atest InputSurfacesTest
Test: adb shell monkey 10000; make sure monkey does not get stuck
Change-Id: I54090811286654062d613cf1e0a637214d1e8c5d
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index 16208a7..d9beb23 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -569,7 +569,7 @@
bufferSurface->expectTap(1, 1);
}
-TEST_F(InputSurfacesTest, input_ignores_buffer_layer_alpha) {
+TEST_F(InputSurfacesTest, input_respects_buffer_layer_alpha) {
std::unique_ptr<InputSurface> bgSurface = makeSurface(100, 100);
std::unique_ptr<BlastInputSurface> bufferSurface =
BlastInputSurface::makeBlastInputSurface(mComposerClient, 100, 100);
@@ -584,7 +584,7 @@
bufferSurface->doTransaction([](auto &t, auto &sc) { t.setAlpha(sc, 0.0); });
injectTap(11, 11);
- bufferSurface->expectTap(1, 1);
+ bgSurface->expectTap(1, 1);
}
TEST_F(InputSurfacesTest, input_ignores_color_layer_alpha) {