From 87f1c01c4e9ddac9f15cbe76c819a1831b49b0de Mon Sep 17 00:00:00 2001 From: Paul Ramirez Date: Wed, 18 Sep 2024 18:23:14 +0000 Subject: Update InputConsumer_test.cpp to use getFdStateDebug Updated InputConsumer_test.cpp to use getFdStateDebug, and reverted the changes introduced by LooperInterface in InputConsumerNoResampling Bug: 297226446 Flag: EXEMPT refactor Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*" Change-Id: I7621fdf0923e16794142316a126d81e5faf3d708 --- libs/input/InputConsumerNoResampling.cpp | 34 +++----------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'libs/input/InputConsumerNoResampling.cpp') diff --git a/libs/input/InputConsumerNoResampling.cpp b/libs/input/InputConsumerNoResampling.cpp index f33afe75fc..cdbc1869c3 100644 --- a/libs/input/InputConsumerNoResampling.cpp +++ b/libs/input/InputConsumerNoResampling.cpp @@ -46,27 +46,6 @@ using std::chrono::nanoseconds; const bool DEBUG_TRANSPORT_CONSUMER = __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Consumer", ANDROID_LOG_INFO); -/** - * RealLooper is a wrapper of Looper. All the member functions exclusively call the internal looper. - * This class' behavior is the same as Looper. - */ -class RealLooper final : public LooperInterface { -public: - RealLooper(sp looper) : mLooper{looper} {} - - int addFd(int fd, int ident, int events, const sp& callback, - void* data) override { - return mLooper->addFd(fd, ident, events, callback, data); - } - - int removeFd(int fd) override { return mLooper->removeFd(fd); } - - sp getLooper() const override { return mLooper; } - -private: - sp mLooper; -}; - std::unique_ptr createKeyEvent(const InputMessage& msg) { std::unique_ptr event = std::make_unique(); event->initialize(msg.body.key.eventId, msg.body.key.deviceId, msg.body.key.source, @@ -201,12 +180,12 @@ using android::base::Result; // --- InputConsumerNoResampling --- InputConsumerNoResampling::InputConsumerNoResampling(const std::shared_ptr& channel, - std::shared_ptr looper, + sp looper, InputConsumerCallbacks& callbacks, std::unique_ptr resampler) : mChannel{channel}, mLooper{looper}, - mCallbacks(callbacks), + mCallbacks{callbacks}, mResampler{std::move(resampler)}, mFdEvents(0) { LOG_ALWAYS_FATAL_IF(mLooper == nullptr); @@ -218,13 +197,6 @@ InputConsumerNoResampling::InputConsumerNoResampling(const std::shared_ptr& channel, - sp looper, - InputConsumerCallbacks& callbacks, - std::unique_ptr resampler) - : InputConsumerNoResampling(channel, std::make_shared(looper), callbacks, - std::move(resampler)) {} - InputConsumerNoResampling::~InputConsumerNoResampling() { ensureCalledOnLooperThread(__func__); consumeBatchedInputEvents(/*requestedFrameTime=*/std::nullopt); @@ -556,7 +528,7 @@ bool InputConsumerNoResampling::consumeBatchedInputEvents( void InputConsumerNoResampling::ensureCalledOnLooperThread(const char* func) const { sp callingThreadLooper = Looper::getForThread(); - if (callingThreadLooper != mLooper->getLooper()) { + if (callingThreadLooper != mLooper) { LOG(FATAL) << "The function " << func << " can only be called on the looper thread"; } } -- cgit v1.2.3-59-g8ed1b