Add a debug flag to convert all touch pointers to stylus
When the sysprop `persist.debug.input.simulate_stylus_with_touch`
is set, all pointers reported by TouchInputMapper will be converted
into stylus pointers.
Changes to the flag will require a reboot to take effect.
Bug: 217741685
Test: manual
Change-Id: I7723be718354872509a9e85beda10acdbe25dd48
diff --git a/services/inputflinger/reader/mapper/MultiTouchInputMapper.h b/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
index 225ad49..b7c3457 100644
--- a/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
@@ -104,6 +104,14 @@
bool hasStylus() const override;
private:
+ // simulate_stylus_with_touch is a debug mode that converts all finger pointers reported by this
+ // mapper's touchscreen into stylus pointers, and adds SOURCE_STYLUS to the input device.
+ // It is used to simulate stylus events for debugging and testing on a device that does not
+ // support styluses. It can be enabled using
+ // "adb shell setprop persist.debug.input.simulate_stylus_with_touch true",
+ // and requires a reboot to take effect.
+ inline bool shouldSimulateStylusWithTouch() const;
+
// If the slot is in use, return the bit id. Return std::nullopt otherwise.
std::optional<int32_t> getActiveBitId(const MultiTouchMotionAccumulator::Slot& inSlot);
MultiTouchMotionAccumulator mMultiTouchMotionAccumulator;