Native support for rotary encoder high-res scroll
Test: atest RotaryEncoderInputMapperTest
Test: atest VirtualRotaryEncoderTest
Flag: android.companion.virtualdevice.flags.high_resolution_scroll
Bug: 320328752
Change-Id: Iac9092597010582bd3f55e51ee63e9eb9c8d9433
diff --git a/include/input/Input.h b/include/input/Input.h
index 17672d1..77d7448 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -196,11 +196,11 @@
#define MAX_POINTER_ID 31
/*
- * Number of high resolution mouse scroll units for one detent (mouse wheel click), as defined in
+ * Number of high resolution scroll units for one detent (scroll wheel click), as defined in
* evdev. This is relevant when an input device is emitting REL_WHEEL_HI_RES or REL_HWHEEL_HI_RES
* events.
*/
-constexpr int32_t kEvdevMouseHighResScrollUnitsPerDetent = 120;
+constexpr int32_t kEvdevHighResScrollUnitsPerDetent = 120;
/*
* Declare a concrete type for the NDK's input event forward declaration.
diff --git a/include/input/VirtualInputDevice.h b/include/input/VirtualInputDevice.h
index 9fbae73..dabe45c 100644
--- a/include/input/VirtualInputDevice.h
+++ b/include/input/VirtualInputDevice.h
@@ -129,6 +129,9 @@
VirtualRotaryEncoder(android::base::unique_fd fd);
virtual ~VirtualRotaryEncoder() override;
bool writeScrollEvent(float scrollAmount, std::chrono::nanoseconds eventTime);
+
+private:
+ int32_t mAccumulatedHighResScrollAmount;
};
} // namespace android