Classifier: Ping the HAL from monitor() instead of dump()
The input dump should not be affected by the state of the HAL.
Previously, we were pinging the HAL duing a dump, which means the
dumpsys would fail if the HAL is stuck.
Instead, we ping the HAL duing the monitor() call so that a HAL that is
stuck can be more easiliy identified.
Bug: 237347585
Test: manual, flash device
Change-Id: I050bacc5510f10b788232e156ea91d505d841b55
diff --git a/services/inputflinger/InputClassifier.h b/services/inputflinger/InputClassifier.h
index 56cf760..9b31a3c 100644
--- a/services/inputflinger/InputClassifier.h
+++ b/services/inputflinger/InputClassifier.h
@@ -78,9 +78,14 @@
virtual void reset(const NotifyDeviceResetArgs& args) = 0;
/**
- * Dump the state of the motion classifier
+ * Dump the state of the motion classifier.
*/
virtual void dump(std::string& dump) = 0;
+
+ /**
+ * Called by the heartbeat to ensure the HAL is still processing normally.
+ */
+ virtual void monitor() = 0;
};
/**
@@ -96,7 +101,7 @@
*/
virtual void dump(std::string& dump) = 0;
- /* Called by the heatbeat to ensures that the classifier has not deadlocked. */
+ /** Called by the heartbeat to ensure that the classifier has not deadlocked. */
virtual void monitor() = 0;
InputClassifierInterface() { }
@@ -155,13 +160,14 @@
virtual void reset(const NotifyDeviceResetArgs& args) override;
virtual void dump(std::string& dump) override;
+ virtual void monitor() override;
private:
friend class MotionClassifierTest; // to create MotionClassifier with a test HAL implementation
explicit MotionClassifier(
std::shared_ptr<aidl::android::hardware::input::processor::IInputProcessor> service);
- // The events that need to be sent to the HAL.
+ /** The events that need to be sent to the HAL. */
BlockingQueue<ClassifierEvent> mEvents;
/**
* Add an event to the queue mEvents.