Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49d525aa authored by Arthur Hung's avatar Arthur Hung
Browse files

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
parent 11595687
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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(
+2 −0
Original line number Diff line number Diff line
@@ -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;
    }

+2 −1
Original line number Diff line number Diff line
@@ -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();