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
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index 2deb99d..712adfa 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -177,6 +177,14 @@
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 @@
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 @@
std::unordered_map<InputDeviceSensorType, InputDeviceSensorInfo> mSensors;
/* Map from light ID to light info */
std::unordered_map<int32_t, InputDeviceLightInfo> mLights;
+ /* Map from battery ID to battery info */
+ std::unordered_map<int32_t, InputDeviceBatteryInfo> mBatteries;
};
/* Types of input device configuration files. */