diff options
Diffstat (limited to 'services/inputflinger/InputClassifier.cpp')
| -rw-r--r-- | services/inputflinger/InputClassifier.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/services/inputflinger/InputClassifier.cpp b/services/inputflinger/InputClassifier.cpp index cda0e0cdcb..77a0716269 100644 --- a/services/inputflinger/InputClassifier.cpp +++ b/services/inputflinger/InputClassifier.cpp @@ -191,7 +191,7 @@ void MotionClassifier::processEvents() { 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: { @@ -217,7 +217,7 @@ void MotionClassifier::enqueueEvent(ClassifierEvent&& event) { bool eventAdded = mEvents.push(std::move(event)); if (!eventAdded) { // If the queue is full, suspect the HAL is slow in processing the events. - ALOGE("Dropped event with eventTime %" PRId64, event.args->eventTime); + ALOGE("Could not add the event to the queue. Resetting"); reset(); } } @@ -262,6 +262,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); @@ -408,7 +414,6 @@ void InputClassifier::setMotionClassifier( void InputClassifier::dump(std::string& dump) { std::scoped_lock lock(mLock); dump += "Input Classifier State:\n"; - dump += INDENT1 "Motion Classifier:\n"; if (mMotionClassifier) { mMotionClassifier->dump(dump); |