diff options
author | Arthur Hung <arthurhung@google.com> | 2021-11-19 15:11:51 +0000 |
---|---|---|
committer | Arthur Hung <arthurhung@google.com> | 2021-11-22 05:50:47 +0000 |
commit | 49d525aa2a1c4d9291d544f2c46e512038ac46bc (patch) | |
tree | 9dbfb3d1f3cc3d670d3b0bf83749816221a1053a | |
parent | 11595687cb64ef66b390deaf9aca9f891423afd5 (diff) | |
download | native-49d525aa2a1c4d9291d544f2c46e512038ac46bc.tar.gz |
Let touch region empty if the input bounds is empty
If the input bounds is empty, we should let the touch region empty so
it could prevent receiving touch without valid bounds.
Bug: 204747595
Test: atest InputSurfacesTest
Change-Id: Iee59c437a084ca9db6936af7a4852190169518d9
-rw-r--r-- | libs/gui/tests/EndToEndNativeInputTest.cpp | 14 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 2 | ||||
-rw-r--r-- | services/surfaceflinger/tests/WindowInfosListener_test.cpp | 3 |
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 e2f34fabc2..e029e7d7c6 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(); |