summaryrefslogtreecommitdiff
path: root/include/input/InputDevice.h
diff options
context:
space:
mode:
author Yeabkal Wubshit <yeabkal@google.com> 2024-01-24 12:47:00 -0800
committer Yeabkal Wubshit <yeabkal@google.com> 2024-02-01 12:36:56 -0800
commitb1b96db1eb56bd0df2bdf78d3922e10d65d08925 (patch)
treecf926df32ac232d15580f6a576f1e229df96c7ae /include/input/InputDevice.h
parent02c971640a149401a97960019a7236e6212ccf40 (diff)
Support for InputDevice ViewBehavior
This change creates a struct within InputDeviceInfo to hold View related behaviors of an input device. Currently, a single behavior is supported: device.viewBehavior_smoothScroll. This can be specified in an IDC file to hint clients of the InputDevice that they should animate scrolls for motion events generated by the InputDevice. Bug: 246946631 Test: add property in IDC, check API returns expected value Test: atest frameworks/native/services/inputflinger/tests/InputReader_test.cpp Change-Id: Ibe373cadc40d2a08116e787b744dd30812638edb
Diffstat (limited to 'include/input/InputDevice.h')
-rw-r--r--include/input/InputDevice.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index b7751f704a..57b659d9ee 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -75,6 +75,17 @@ struct InputDeviceIdentifier {
bool operator!=(const InputDeviceIdentifier&) const = default;
};
+/**
+ * Holds View related behaviors for an InputDevice.
+ */
+struct InputDeviceViewBehavior {
+ /**
+ * The smooth scroll behavior that applies for all source/axis, if defined by the device.
+ * Empty optional if the device has not specified the default smooth scroll behavior.
+ */
+ std::optional<bool> shouldSmoothScroll;
+};
+
/* Types of input device sensors. Keep sync with core/java/android/hardware/Sensor.java */
enum class InputDeviceSensorType : int32_t {
ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER,
@@ -266,7 +277,8 @@ public:
void initialize(int32_t id, int32_t generation, int32_t controllerNumber,
const InputDeviceIdentifier& identifier, const std::string& alias,
- bool isExternal, bool hasMic, int32_t associatedDisplayId);
+ bool isExternal, bool hasMic, int32_t associatedDisplayId,
+ InputDeviceViewBehavior viewBehavior = {{}});
inline int32_t getId() const { return mId; }
inline int32_t getControllerNumber() const { return mControllerNumber; }
@@ -298,6 +310,8 @@ public:
return mKeyboardLayoutInfo;
}
+ inline const InputDeviceViewBehavior& getViewBehavior() const { return mViewBehavior; }
+
inline void setKeyCharacterMap(const std::shared_ptr<KeyCharacterMap> value) {
mKeyCharacterMap = value;
}
@@ -359,6 +373,8 @@ private:
std::unordered_map<int32_t, InputDeviceLightInfo> mLights;
/* Map from battery ID to battery info */
std::unordered_map<int32_t, InputDeviceBatteryInfo> mBatteries;
+ /** The View related behaviors for the device. */
+ InputDeviceViewBehavior mViewBehavior;
};
/* Types of input device configuration files. */