Tilt scale correction for certain resolutions
"mTiltXScale" does not reflect the resolutions of the tilts of the devices,
so that the AXIS_TILT can be corrupted when a device reports its tilt with
a certain resolution rather than a degree based output.
Test: manual
Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@WacomMfG.corp-partner.google.com>
Change-Id: I35d866a8cd2778a34904229cf8c475b3118b9c2b
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index cbdb1d0..bfdc02c 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -905,6 +905,13 @@
mTiltXScale = M_PI / 180;
mTiltYScale = M_PI / 180;
+ if (mRawPointerAxes.tiltX.resolution) {
+ mTiltXScale = 1.0 / mRawPointerAxes.tiltX.resolution;
+ }
+ if (mRawPointerAxes.tiltY.resolution) {
+ mTiltYScale = 1.0 / mRawPointerAxes.tiltY.resolution;
+ }
+
mOrientedRanges.haveTilt = true;
mOrientedRanges.tilt.axis = AMOTION_EVENT_AXIS_TILT;