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

Commit d19d707e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add compile checks to EndToEndNativeInputTest" into main

parents 686b965e bf98a575
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ cc_test {
    cppflags: [
        "-Wall",
        "-Werror",
        "-Wno-extra",
        "-Wextra",
        "-Wthread-safety",
        "-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_BQ_SETFRAMERATE=true",
    ],

+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

#define LOG_TAG "BLASTBufferQueue_test"

#pragma clang diagnostic ignored "-Wsign-compare"
#pragma clang diagnostic ignored "-Wthread-safety"

#include <gui/BLASTBufferQueue.h>

#include <android/hardware/graphics/common/1.2/types.h>
@@ -476,7 +479,7 @@ TEST_F(BLASTBufferQueueTest, TripleBuffering) {
        ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf));
        allocated.push_back({slot, fence});
    }
    for (int i = 0; i < allocated.size(); i++) {
    for (size_t i = 0; i < allocated.size(); i++) {
        igbProducer->cancelBuffer(allocated[i].first, allocated[i].second);
    }

+3 −4
Original line number Diff line number Diff line
@@ -119,8 +119,7 @@ TEST_F(BufferQueueTest, DISABLED_BufferQueueInAnotherProcess) {
    }

    sp<IServiceManager> serviceManager = defaultServiceManager();
    sp<IBinder> binderProducer =
        serviceManager->getService(PRODUCER_NAME);
    sp<IBinder> binderProducer = serviceManager->waitForService(PRODUCER_NAME);
    mProducer = interface_cast<IGraphicBufferProducer>(binderProducer);
    EXPECT_TRUE(mProducer != nullptr);
    sp<IBinder> binderConsumer =
@@ -1114,7 +1113,7 @@ TEST_F(BufferQueueTest, TestDiscardFreeBuffers) {

    // Check onBuffersDiscarded is called with correct slots
    auto buffersDiscarded = pl->getDiscardedSlots();
    ASSERT_EQ(buffersDiscarded.size(), 1);
    ASSERT_EQ(buffersDiscarded.size(), 1u);
    ASSERT_EQ(buffersDiscarded[0], releasedSlot);

    // Check no free buffers in dump
@@ -1239,7 +1238,7 @@ TEST_F(BufferQueueTest, TestConsumerDetachProducerListener) {
    ASSERT_EQ(OK, mConsumer->detachBuffer(item.mSlot));

    // Check whether the slot from IProducerListener is same to the detached slot.
    ASSERT_EQ(pl->getDetachedSlots().size(), 1);
    ASSERT_EQ(pl->getDetachedSlots().size(), 1u);
    ASSERT_EQ(pl->getDetachedSlots()[0], slots[1]);

    // Dequeue another buffer.
+4 −4
Original line number Diff line number Diff line
@@ -116,10 +116,10 @@ TEST_F(DisplayedContentSamplingTest, SampleCollectionCoherentWithSupportMask) {
    EXPECT_EQ(OK, status);
    if (stats.numFrames <= 0) return;

    if (componentMask & (0x1 << 0)) EXPECT_NE(0, stats.component_0_sample.size());
    if (componentMask & (0x1 << 1)) EXPECT_NE(0, stats.component_1_sample.size());
    if (componentMask & (0x1 << 2)) EXPECT_NE(0, stats.component_2_sample.size());
    if (componentMask & (0x1 << 3)) EXPECT_NE(0, stats.component_3_sample.size());
    if (componentMask & (0x1 << 0)) EXPECT_NE(0u, stats.component_0_sample.size());
    if (componentMask & (0x1 << 1)) EXPECT_NE(0u, stats.component_1_sample.size());
    if (componentMask & (0x1 << 2)) EXPECT_NE(0u, stats.component_2_sample.size());
    if (componentMask & (0x1 << 3)) EXPECT_NE(0u, stats.component_3_sample.size());
}

} // namespace android
+8 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include <memory>

#include <android-base/thread_annotations.h>
#include <android/gui/BnWindowInfosReportedListener.h>
#include <android/keycodes.h>
#include <android/native_window.h>
@@ -78,21 +79,22 @@ static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s;
class SynchronousWindowInfosReportedListener : public gui::BnWindowInfosReportedListener {
public:
    binder::Status onWindowInfosReported() override {
        std::lock_guard<std::mutex> lock{mMutex};
        std::scoped_lock lock{mLock};
        mWindowInfosReported = true;
        mConditionVariable.notify_one();
        return binder::Status::ok();
    }

    void wait() {
        std::unique_lock<std::mutex> lock{mMutex};
        mConditionVariable.wait(lock, [&] { return mWindowInfosReported; });
        std::unique_lock lock{mLock};
        android::base::ScopedLockAssertion assumeLocked(mLock);
        mConditionVariable.wait(lock, [&]() REQUIRES(mLock) { return mWindowInfosReported; });
    }

private:
    std::mutex mMutex;
    std::mutex mLock;
    std::condition_variable mConditionVariable;
    bool mWindowInfosReported{false};
    bool mWindowInfosReported GUARDED_BY(mLock){false};
};

class InputSurface {
@@ -250,7 +252,7 @@ public:
        EXPECT_EQ(0, mev->getFlags() & VERIFIED_MOTION_EVENT_FLAGS);
    }

    void expectKey(uint32_t keycode) {
    void expectKey(int32_t keycode) {
        InputEvent *ev = consumeEvent();
        ASSERT_NE(ev, nullptr);
        ASSERT_EQ(InputEventType::KEY, ev->getType());
Loading