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

Commit f98655a3 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Do not enforce that layers with invalid bounds are not focusable

This is a partial revert of ag/16743825.

We previously made this change to expect more strict preconditions for
input windows, but are now running into app-compat issues.

Since it is not essential, we no longer enforce that layers with invalid
bounds are not focusable.

Bug: 225029938
Test: atest libgui_test
Test: manual with affected apps
Change-Id: Ic70eebf991322adc93bd824528d8d87f892d01e1
parent 4e937a33
Loading
Loading
Loading
Loading
+0 −15
Original line number Original line Diff line number Diff line
@@ -984,21 +984,6 @@ TEST_F(InputSurfacesTest, drop_input_policy) {
    EXPECT_EQ(surface->consumeEvent(100), nullptr);
    EXPECT_EQ(surface->consumeEvent(100), nullptr);
}
}


TEST_F(InputSurfacesTest, layer_with_empty_crop_cannot_be_focused) {
    std::unique_ptr<InputSurface> bufferSurface =
            InputSurface::makeBufferInputSurface(mComposerClient, 100, 100);

    bufferSurface->showAt(50, 50, Rect::EMPTY_RECT);

    bufferSurface->requestFocus();
    EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr);

    bufferSurface->showAt(50, 50, Rect::INVALID_RECT);

    bufferSurface->requestFocus();
    EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr);
}

TEST_F(InputSurfacesTest, layer_with_valid_crop_can_be_focused) {
TEST_F(InputSurfacesTest, layer_with_valid_crop_can_be_focused) {
    std::unique_ptr<InputSurface> bufferSurface =
    std::unique_ptr<InputSurface> bufferSurface =
            InputSurface::makeBufferInputSurface(mComposerClient, 100, 100);
            InputSurface::makeBufferInputSurface(mComposerClient, 100, 100);
+0 −1
Original line number Original line Diff line number Diff line
@@ -2177,7 +2177,6 @@ Rect Layer::getInputBounds() const {
void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& screenToDisplay) {
void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& screenToDisplay) {
    Rect tmpBounds = getInputBounds();
    Rect tmpBounds = getInputBounds();
    if (!tmpBounds.isValid()) {
    if (!tmpBounds.isValid()) {
        info.setInputConfig(WindowInfo::InputConfig::NOT_FOCUSABLE, true);
        info.touchableRegion.clear();
        info.touchableRegion.clear();
        // A layer could have invalid input bounds and still expect to receive touch input if it has
        // A layer could have invalid input bounds and still expect to receive touch input if it has
        // replaceTouchableRegionWithCrop. For that case, the input transform needs to be calculated
        // replaceTouchableRegionWithCrop. For that case, the input transform needs to be calculated