Loading services/inputflinger/BlockingQueue.h +1 −4 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: T pop() { std::unique_lock lock(mLock); android::base::ScopedLockAssertion assumeLock(mLock); mHasElements.wait(lock, [this]{ android::base::ScopedLockAssertion assumeLock(mLock); return !this->mQueue.empty(); }); mHasElements.wait(lock, [this]() REQUIRES(mLock) { return !this->mQueue.empty(); }); T t = std::move(mQueue.front()); mQueue.erase(mQueue.begin()); return t; Loading services/inputflinger/InputClassifier.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ void MotionClassifier::callInputClassifierHal() { case ClassifierEventType::DEVICE_RESET: { const int32_t deviceId = *(event.getDeviceId()); halResponseOk = mService->resetDevice(deviceId).isOk(); setClassification(deviceId, MotionClassification::NONE); clearDeviceState(deviceId); break; } case ClassifierEventType::HAL_RESET: { Loading Loading @@ -321,6 +321,12 @@ void MotionClassifier::updateLastDownTime(int32_t deviceId, nsecs_t downTime) { mClassifications[deviceId] = MotionClassification::NONE; } void MotionClassifier::clearDeviceState(int32_t deviceId) { std::scoped_lock lock(mLock); mClassifications.erase(deviceId); mLastDownTimes.erase(deviceId); } MotionClassification MotionClassifier::classify(const NotifyMotionArgs& args) { if ((args.action & AMOTION_EVENT_ACTION_MASK) == AMOTION_EVENT_ACTION_DOWN) { updateLastDownTime(args.deviceId, args.downTime); Loading Loading @@ -455,6 +461,7 @@ void InputClassifier::serviceDied(uint64_t /*cookie*/, void InputClassifier::dump(std::string& dump) { std::scoped_lock lock(mLock); dump += "Input Classifier State:\n"; dump += StringPrintf(INDENT1 "Deep press: %s\n", deepPressEnabled() ? "enabled" : "disabled"); dump += INDENT1 "Motion Classifier:\n"; if (mMotionClassifier) { Loading services/inputflinger/InputClassifier.h +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,8 @@ private: void updateLastDownTime(int32_t deviceId, nsecs_t downTime); void clearDeviceState(int32_t deviceId); /** * Exit the InputClassifier HAL thread. * Useful for tests to ensure proper cleanup. Loading Loading
services/inputflinger/BlockingQueue.h +1 −4 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: T pop() { std::unique_lock lock(mLock); android::base::ScopedLockAssertion assumeLock(mLock); mHasElements.wait(lock, [this]{ android::base::ScopedLockAssertion assumeLock(mLock); return !this->mQueue.empty(); }); mHasElements.wait(lock, [this]() REQUIRES(mLock) { return !this->mQueue.empty(); }); T t = std::move(mQueue.front()); mQueue.erase(mQueue.begin()); return t; Loading
services/inputflinger/InputClassifier.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ void MotionClassifier::callInputClassifierHal() { case ClassifierEventType::DEVICE_RESET: { const int32_t deviceId = *(event.getDeviceId()); halResponseOk = mService->resetDevice(deviceId).isOk(); setClassification(deviceId, MotionClassification::NONE); clearDeviceState(deviceId); break; } case ClassifierEventType::HAL_RESET: { Loading Loading @@ -321,6 +321,12 @@ void MotionClassifier::updateLastDownTime(int32_t deviceId, nsecs_t downTime) { mClassifications[deviceId] = MotionClassification::NONE; } void MotionClassifier::clearDeviceState(int32_t deviceId) { std::scoped_lock lock(mLock); mClassifications.erase(deviceId); mLastDownTimes.erase(deviceId); } MotionClassification MotionClassifier::classify(const NotifyMotionArgs& args) { if ((args.action & AMOTION_EVENT_ACTION_MASK) == AMOTION_EVENT_ACTION_DOWN) { updateLastDownTime(args.deviceId, args.downTime); Loading Loading @@ -455,6 +461,7 @@ void InputClassifier::serviceDied(uint64_t /*cookie*/, void InputClassifier::dump(std::string& dump) { std::scoped_lock lock(mLock); dump += "Input Classifier State:\n"; dump += StringPrintf(INDENT1 "Deep press: %s\n", deepPressEnabled() ? "enabled" : "disabled"); dump += INDENT1 "Motion Classifier:\n"; if (mMotionClassifier) { Loading
services/inputflinger/InputClassifier.h +2 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,8 @@ private: void updateLastDownTime(int32_t deviceId, nsecs_t downTime); void clearDeviceState(int32_t deviceId); /** * Exit the InputClassifier HAL thread. * Useful for tests to ensure proper cleanup. Loading