Loading services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -109,8 +109,14 @@ public: uint32_t consumeSeq; InputEvent* event; std::chrono::time_point start = std::chrono::steady_clock::now(); status_t result = WOULD_BLOCK; while (result == WOULD_BLOCK) { std::chrono::duration elapsed = std::chrono::steady_clock::now() - start; if (elapsed > 10ms) { ALOGE("Waited too long for consumer to produce an event, giving up"); break; } result = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); } Loading Loading @@ -282,12 +288,9 @@ static void benchmarkInjectMotion(benchmark::State& state) { dispatcher->setInputWindows({window}, ADISPLAY_ID_DEFAULT); MotionEvent event = generateMotionEvent(); for (auto _ : state) { MotionEvent event = generateMotionEvent(); // Send ACTION_DOWN event.setAction(AMOTION_EVENT_ACTION_DOWN); event.setDownTime(now()); dispatcher->injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); Loading services/inputflinger/dispatcher/InputDispatcher.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ static bool haveSameToken(const sp<InputWindowHandle>& first, const sp<InputWind return first->getToken() == second->getToken(); } static bool isStaleEvent(nsecs_t currentTime, const EventEntry& entry) { return currentTime - entry.eventTime >= STALE_EVENT_TIMEOUT; } // --- InputDispatcherThread --- class InputDispatcher::InputDispatcherThread : public Thread { Loading Loading @@ -743,10 +747,6 @@ void InputDispatcher::resetPendingAppSwitchLocked(bool handled) { #endif } bool InputDispatcher::isStaleEvent(nsecs_t currentTime, const EventEntry& entry) { return currentTime - entry.eventTime >= STALE_EVENT_TIMEOUT; } bool InputDispatcher::haveCommandsLocked() const { return !mCommandQueue.empty(); } Loading services/inputflinger/dispatcher/InputDispatcher.h +0 −3 Original line number Diff line number Diff line Loading @@ -168,9 +168,6 @@ private: bool isAppSwitchPendingLocked() REQUIRES(mLock); void resetPendingAppSwitchLocked(bool handled) REQUIRES(mLock); // Stale event latency optimization. static bool isStaleEvent(nsecs_t currentTime, const EventEntry& entry); // Blocked event latency optimization. Drops old events when the user intends // to transfer focus to a new application. EventEntry* mNextUnblockedEvent GUARDED_BY(mLock); Loading Loading
services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -109,8 +109,14 @@ public: uint32_t consumeSeq; InputEvent* event; std::chrono::time_point start = std::chrono::steady_clock::now(); status_t result = WOULD_BLOCK; while (result == WOULD_BLOCK) { std::chrono::duration elapsed = std::chrono::steady_clock::now() - start; if (elapsed > 10ms) { ALOGE("Waited too long for consumer to produce an event, giving up"); break; } result = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); } Loading Loading @@ -282,12 +288,9 @@ static void benchmarkInjectMotion(benchmark::State& state) { dispatcher->setInputWindows({window}, ADISPLAY_ID_DEFAULT); MotionEvent event = generateMotionEvent(); for (auto _ : state) { MotionEvent event = generateMotionEvent(); // Send ACTION_DOWN event.setAction(AMOTION_EVENT_ACTION_DOWN); event.setDownTime(now()); dispatcher->injectInputEvent(&event, INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, INJECT_EVENT_TIMEOUT, POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER); Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ static bool haveSameToken(const sp<InputWindowHandle>& first, const sp<InputWind return first->getToken() == second->getToken(); } static bool isStaleEvent(nsecs_t currentTime, const EventEntry& entry) { return currentTime - entry.eventTime >= STALE_EVENT_TIMEOUT; } // --- InputDispatcherThread --- class InputDispatcher::InputDispatcherThread : public Thread { Loading Loading @@ -743,10 +747,6 @@ void InputDispatcher::resetPendingAppSwitchLocked(bool handled) { #endif } bool InputDispatcher::isStaleEvent(nsecs_t currentTime, const EventEntry& entry) { return currentTime - entry.eventTime >= STALE_EVENT_TIMEOUT; } bool InputDispatcher::haveCommandsLocked() const { return !mCommandQueue.empty(); } Loading
services/inputflinger/dispatcher/InputDispatcher.h +0 −3 Original line number Diff line number Diff line Loading @@ -168,9 +168,6 @@ private: bool isAppSwitchPendingLocked() REQUIRES(mLock); void resetPendingAppSwitchLocked(bool handled) REQUIRES(mLock); // Stale event latency optimization. static bool isStaleEvent(nsecs_t currentTime, const EventEntry& entry); // Blocked event latency optimization. Drops old events when the user intends // to transfer focus to a new application. EventEntry* mNextUnblockedEvent GUARDED_BY(mLock); Loading