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

Commit 82353e99 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Changed BufferLayer's canReceiveInput to check if its hidden by policy

WM does not consider window size or alpha value when setting it as the focused window. However, SF
will check if the window has a buffer and that its alpha is not 0. Because of this difference,
Input Dispatcher will not be able to send input to the window while WM thinks the window is
focused. This will cause apps to stop responding.

While we define what the intended behavior should be, this fix reverts
to previous behavior in P.

Bug: 139494112
Test: adb shell monkey 10000; make sure monkey does not get stuck
Test: check test app from can receive input b/140478820
Change-Id: I4160b49161dd1780713980707a5c911034f414b5
parent d94d56e3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -435,6 +435,9 @@ TEST_F(InputSurfacesTest, input_ignores_transparent_region) {
    surface->expectTap(1, 1);
}

/**
 * TODO(b/139494112) fix tests once we define expected behavior
 *
// Ensure we send the input to the right surface when the surface visibility changes due to the
// first buffer being submitted. ref: b/120839715
TEST_F(InputSurfacesTest, input_respects_buffer_layer_buffer) {
@@ -486,6 +489,7 @@ TEST_F(InputSurfacesTest, input_respects_color_layer_alpha) {
    injectTap(11, 11);
    bgSurface->expectTap(1, 1);
}
*/

TEST_F(InputSurfacesTest, input_respects_container_layer_visiblity) {
    std::unique_ptr<InputSurface> bgSurface = makeSurface(100, 100);
+0 −4
Original line number Diff line number Diff line
@@ -30,8 +30,4 @@ bool ContainerLayer::isVisible() const {
    return false;
}

bool ContainerLayer::canReceiveInput() const {
    return !isHiddenByPolicy();
}

} // namespace android
+0 −2
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ public:
    const char* getType() const override { return "ContainerLayer"; }
    bool isVisible() const override;

    bool canReceiveInput() const override;

    bool isCreatedFromMainThread() const override { return true; }
};

+1 −1
Original line number Diff line number Diff line
@@ -2020,7 +2020,7 @@ std::shared_ptr<compositionengine::Layer> Layer::getCompositionLayer() const {
}

bool Layer::canReceiveInput() const {
    return isVisible();
    return !isHiddenByPolicy();
}

compositionengine::OutputLayer* Layer::findOutputLayerForDisplay(