Add dump to Input Classifier
Currently, the InputClassifier stage that is positioned between
InputReader and InputDispatcher is not accounted for when doing a
'dumpsys input'. But that stage may contain important information about
the operation and the InputClassifier HAL. Add the dump(..) command to
both InputClassifier and MotionClassifier.
Test: dumpsys input and inspect the resulting text
Next, crash the InputClassifier HAL (killall android.hardware.input.classifier@1.0-service
Then again 'dumpsys input' to check that the HAL status is 'not
responding'
Bug: 117935272
Change-Id: Ie7ddca2e355e094f93236a9bc667faad7a99ee70
diff --git a/services/inputflinger/InputClassifier.h b/services/inputflinger/InputClassifier.h
index cb46494..4b9dae2 100644
--- a/services/inputflinger/InputClassifier.h
+++ b/services/inputflinger/InputClassifier.h
@@ -70,6 +70,11 @@
virtual MotionClassification classify(const NotifyMotionArgs& args) = 0;
virtual void reset() = 0;
virtual void reset(const NotifyDeviceResetArgs& args) = 0;
+
+ /**
+ * Dump the state of the motion classifier
+ */
+ virtual void dump(std::string& dump) = 0;
};
/**
@@ -77,6 +82,12 @@
* Provides classification to events.
*/
class InputClassifierInterface : public virtual RefBase, public InputListenerInterface {
+public:
+ /**
+ * Dump the state of the input classifier.
+ * This method may be called on any thread (usually by the input manager).
+ */
+ virtual void dump(std::string& dump) = 0;
protected:
InputClassifierInterface() { }
virtual ~InputClassifierInterface() { }
@@ -110,6 +121,8 @@
virtual void reset() override;
virtual void reset(const NotifyDeviceResetArgs& args) override;
+ virtual void dump(std::string& dump) override;
+
private:
// The events that need to be sent to the HAL.
BlockingQueue<ClassifierEvent> mEvents;
@@ -186,6 +199,8 @@
virtual void notifySwitch(const NotifySwitchArgs* args) override;
virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) override;
+ virtual void dump(std::string& dump) override;
+
private:
std::unique_ptr<MotionClassifierInterface> mMotionClassifier = nullptr;
// The next stage to pass input events to