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

Commit 08a97163 authored by Arthur Hung's avatar Arthur Hung Committed by Android (Google) Code Review
Browse files

Merge "Check BufferLayer's alpha value when canReceiveInput"

parents f0026e65 fb2ebce3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -569,7 +569,7 @@ TEST_F(InputSurfacesTest, input_ignores_buffer_layer_buffer) {
    bufferSurface->expectTap(1, 1);
}

TEST_F(InputSurfacesTest, input_ignores_buffer_layer_alpha) {
TEST_F(InputSurfacesTest, input_respects_buffer_layer_alpha) {
    std::unique_ptr<InputSurface> bgSurface = makeSurface(100, 100);
    std::unique_ptr<BlastInputSurface> bufferSurface =
            BlastInputSurface::makeBlastInputSurface(mComposerClient, 100, 100);
@@ -584,7 +584,7 @@ TEST_F(InputSurfacesTest, input_ignores_buffer_layer_alpha) {
    bufferSurface->doTransaction([](auto &t, auto &sc) { t.setAlpha(sc, 0.0); });

    injectTap(11, 11);
    bufferSurface->expectTap(1, 1);
    bgSurface->expectTap(1, 1);
}

TEST_F(InputSurfacesTest, input_ignores_color_layer_alpha) {
+4 −0
Original line number Diff line number Diff line
@@ -111,6 +111,10 @@ bool BufferLayer::isOpaque(const Layer::State& s) const {
    return ((s.flags & layer_state_t::eLayerOpaque) != 0) || getOpacityForFormat(getPixelFormat());
}

bool BufferLayer::canReceiveInput() const {
    return !isHiddenByPolicy() && (mBufferInfo.mBuffer == nullptr || getAlpha() > 0.0f);
}

bool BufferLayer::isVisible() const {
    return !isHiddenByPolicy() && getAlpha() > 0.0f &&
            (mBufferInfo.mBuffer != nullptr || mSidebandStream != nullptr);
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public:
    void useEmptyDamage() override;

    bool isOpaque(const Layer::State& s) const override;
    bool canReceiveInput() const override;

    // isVisible - true if this layer is visible, false otherwise
    bool isVisible() const override;