From e2b1e5c71765d5b8bc303bbfa6741c0c96e95d44 Mon Sep 17 00:00:00 2001 From: Chris Ye Date: Wed, 10 Mar 2021 22:45:12 -0800 Subject: Introduce Device Controller to InputReader Introduce Device Controller to manage non-evdev devices associated with the input device kernel interface. These devices doesn't interact with inputflinger with input events which requires a mapper to process the raw event with assoicated input sources. Bug: 180342233 Test: atest inputflinger_tests Change-Id: Ib492bb3de889db180c05367bb6a7e7a2e0d78ce7 --- include/input/InputDevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index 2deb99d154..712adfa57b 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -177,6 +177,14 @@ struct InputDeviceLightInfo { int32_t ordinal; }; +struct InputDeviceBatteryInfo { + explicit InputDeviceBatteryInfo(std::string name, int32_t id) : name(name), id(id) {} + // Name string of the battery. + std::string name; + // Battery id + int32_t id; +}; + /* * Describes the characteristics and capabilities of an input device. */ @@ -219,6 +227,7 @@ public: float min, float max, float flat, float fuzz, float resolution); void addMotionRange(const MotionRange& range); void addSensorInfo(const InputDeviceSensorInfo& info); + void addBatteryInfo(const InputDeviceBatteryInfo& info); void addLightInfo(const InputDeviceLightInfo& info); inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } @@ -276,6 +285,8 @@ private: std::unordered_map mSensors; /* Map from light ID to light info */ std::unordered_map mLights; + /* Map from battery ID to battery info */ + std::unordered_map mBatteries; }; /* Types of input device configuration files. */ -- cgit v1.2.3-59-g8ed1b