Load simulate_stylus_with_touch on touchscreen reconfiguration
Query the sysprop value when the touchscreen is reconfigured
so that the debug property can be applied at runtime.
Bug: 309036663
Test: manual, adb shell setprop debug.input.simulate_stylus_with_touch true
Change-Id: I7e59669c92783f442c3290dcf445cda2bb3f69c6
diff --git a/services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp b/services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp
index 9c87c62..2dd05f5 100644
--- a/services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp
@@ -131,7 +131,7 @@
bumpGeneration();
}
}
- if (shouldSimulateStylusWithTouch() && outPointer.toolType == ToolType::FINGER) {
+ if (mShouldSimulateStylusWithTouch && outPointer.toolType == ToolType::FINGER) {
outPointer.toolType = ToolType::STYLUS;
}
@@ -177,6 +177,18 @@
mMultiTouchMotionAccumulator.finishSync();
}
+std::list<NotifyArgs> MultiTouchInputMapper::reconfigure(nsecs_t when,
+ const InputReaderConfiguration& config,
+ ConfigurationChanges changes) {
+ const bool simulateStylusWithTouch =
+ sysprop::InputProperties::simulate_stylus_with_touch().value_or(false);
+ if (simulateStylusWithTouch != mShouldSimulateStylusWithTouch) {
+ mShouldSimulateStylusWithTouch = simulateStylusWithTouch;
+ bumpGeneration();
+ }
+ return TouchInputMapper::reconfigure(when, config, changes);
+}
+
void MultiTouchInputMapper::configureRawPointerAxes() {
TouchInputMapper::configureRawPointerAxes();
@@ -211,14 +223,7 @@
bool MultiTouchInputMapper::hasStylus() const {
return mStylusMtToolSeen || mTouchButtonAccumulator.hasStylus() ||
- shouldSimulateStylusWithTouch();
-}
-
-bool MultiTouchInputMapper::shouldSimulateStylusWithTouch() const {
- static const bool SIMULATE_STYLUS_WITH_TOUCH =
- sysprop::InputProperties::simulate_stylus_with_touch().value_or(false);
- return SIMULATE_STYLUS_WITH_TOUCH &&
- mParameters.deviceType == Parameters::DeviceType::TOUCH_SCREEN;
+ mShouldSimulateStylusWithTouch;
}
} // namespace android