Loading services/inputflinger/tests/InputReader_test.cpp +8 −9 Original line number Original line Diff line number Diff line Loading @@ -409,7 +409,7 @@ class FakeEventHub : public EventHubInterface { KeyedVector<int32_t, Device*> mDevices; KeyedVector<int32_t, Device*> mDevices; std::vector<std::string> mExcludedDevices; std::vector<std::string> mExcludedDevices; List<RawEvent> mEvents GUARDED_BY(mLock); std::vector<RawEvent> mEvents GUARDED_BY(mLock); std::unordered_map<int32_t /*deviceId*/, std::vector<TouchVideoFrame>> mVideoFrames; std::unordered_map<int32_t /*deviceId*/, std::vector<TouchVideoFrame>> mVideoFrames; std::vector<int32_t> mVibrators = {0, 1}; std::vector<int32_t> mVibrators = {0, 1}; Loading Loading @@ -722,16 +722,15 @@ private: mExcludedDevices = devices; mExcludedDevices = devices; } } size_t getEvents(int, RawEvent* buffer, size_t) override { size_t getEvents(int, RawEvent* buffer, size_t bufferSize) override { std::scoped_lock<std::mutex> lock(mLock); std::scoped_lock lock(mLock); if (mEvents.empty()) { return 0; const size_t filledSize = std::min(mEvents.size(), bufferSize); } std::copy(mEvents.begin(), mEvents.begin() + filledSize, buffer); *buffer = *mEvents.begin(); mEvents.erase(mEvents.begin(), mEvents.begin() + filledSize); mEvents.erase(mEvents.begin()); mEventsCondition.notify_all(); mEventsCondition.notify_all(); return 1; return filledSize; } } std::vector<TouchVideoFrame> getVideoFrames(int32_t deviceId) override { std::vector<TouchVideoFrame> getVideoFrames(int32_t deviceId) override { Loading Loading
services/inputflinger/tests/InputReader_test.cpp +8 −9 Original line number Original line Diff line number Diff line Loading @@ -409,7 +409,7 @@ class FakeEventHub : public EventHubInterface { KeyedVector<int32_t, Device*> mDevices; KeyedVector<int32_t, Device*> mDevices; std::vector<std::string> mExcludedDevices; std::vector<std::string> mExcludedDevices; List<RawEvent> mEvents GUARDED_BY(mLock); std::vector<RawEvent> mEvents GUARDED_BY(mLock); std::unordered_map<int32_t /*deviceId*/, std::vector<TouchVideoFrame>> mVideoFrames; std::unordered_map<int32_t /*deviceId*/, std::vector<TouchVideoFrame>> mVideoFrames; std::vector<int32_t> mVibrators = {0, 1}; std::vector<int32_t> mVibrators = {0, 1}; Loading Loading @@ -722,16 +722,15 @@ private: mExcludedDevices = devices; mExcludedDevices = devices; } } size_t getEvents(int, RawEvent* buffer, size_t) override { size_t getEvents(int, RawEvent* buffer, size_t bufferSize) override { std::scoped_lock<std::mutex> lock(mLock); std::scoped_lock lock(mLock); if (mEvents.empty()) { return 0; const size_t filledSize = std::min(mEvents.size(), bufferSize); } std::copy(mEvents.begin(), mEvents.begin() + filledSize, buffer); *buffer = *mEvents.begin(); mEvents.erase(mEvents.begin(), mEvents.begin() + filledSize); mEvents.erase(mEvents.begin()); mEventsCondition.notify_all(); mEventsCondition.notify_all(); return 1; return filledSize; } } std::vector<TouchVideoFrame> getVideoFrames(int32_t deviceId) override { std::vector<TouchVideoFrame> getVideoFrames(int32_t deviceId) override { Loading