summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Hung <arthurhung@google.com>2021-11-30 02:07:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-11-30 02:07:16 +0000
commitd0896e2d109a04451566e68a5c7ebb4c10b3113d (patch)
treea0653e982c6af883ab66a27c0c51cdbea2026df9
parentf2cf7639a80206c43c83cf6076998b45f4feb24b (diff)
parent49d525aa2a1c4d9291d544f2c46e512038ac46bc (diff)
downloadnative-d0896e2d109a04451566e68a5c7ebb4c10b3113d.tar.gz
Merge "Let touch region empty if the input bounds is empty" into sc-v2-dev
-rw-r--r--libs/gui/tests/EndToEndNativeInputTest.cpp14
-rw-r--r--services/surfaceflinger/Layer.cpp2
-rw-r--r--services/surfaceflinger/tests/WindowInfosListener_test.cpp3
3 files changed, 18 insertions, 1 deletions
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index 78a8b429c1..5daef0df28 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -931,6 +931,20 @@ TEST_F(InputSurfacesTest, strict_unobscured_input_cropped_window) {
EXPECT_EQ(surface->consumeEvent(100), nullptr);
}
+TEST_F(InputSurfacesTest, ignore_touch_region_with_zero_sized_blast) {
+ std::unique_ptr<InputSurface> surface = makeSurface(100, 100);
+
+ std::unique_ptr<BlastInputSurface> bufferSurface =
+ BlastInputSurface::makeBlastInputSurface(mComposerClient, 0, 0);
+
+ surface->showAt(100, 100);
+ bufferSurface->mInputInfo.touchableRegion.orSelf(Rect(0, 0, 200, 200));
+ bufferSurface->showAt(100, 100, Rect::EMPTY_RECT);
+
+ injectTap(101, 101);
+ surface->expectTap(1, 1);
+}
+
TEST_F(InputSurfacesTest, drop_input_policy) {
std::unique_ptr<InputSurface> surface = makeSurface(100, 100);
surface->doTransaction(
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 80c61b90f8..4d804fa670 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2213,6 +2213,8 @@ void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& toNonRotat
info.frameRight = 0;
info.frameBottom = 0;
info.transform.reset();
+ info.touchableRegion = Region();
+ info.flags = WindowInfo::Flag::NOT_TOUCH_MODAL | WindowInfo::Flag::NOT_FOCUSABLE;
return;
}
diff --git a/services/surfaceflinger/tests/WindowInfosListener_test.cpp b/services/surfaceflinger/tests/WindowInfosListener_test.cpp
index 89228d55e5..15b79be06c 100644
--- a/services/surfaceflinger/tests/WindowInfosListener_test.cpp
+++ b/services/surfaceflinger/tests/WindowInfosListener_test.cpp
@@ -110,11 +110,12 @@ TEST_F(WindowInfosListenerTest, WindowInfoChanged) {
sp<SurfaceControl> surfaceControl =
mClient->createSurface(String8(name.c_str()), 100, 100, PIXEL_FORMAT_RGBA_8888,
ISurfaceComposerClient::eFXSurfaceBufferState);
-
+ const Rect crop(0, 0, 100, 100);
Transaction()
.setLayerStack(surfaceControl, 0)
.show(surfaceControl)
.setLayer(surfaceControl, INT32_MAX - 1)
+ .setCrop(surfaceControl, crop)
.setInputWindowInfo(surfaceControl, windowInfo)
.apply();