summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Philip Quinn <pquinn@google.com> 2023-09-18 13:35:54 -0700
committer Philip Quinn <pquinn@google.com> 2023-09-20 11:58:16 -0700
commit59fa9123e1deffa5fbac958399fa76f5be187bea (patch)
treef4096a0b0e4364f0159c989dbd55fa6310f3c703
parent66c6aed217ec262dbe72d2afa064592edad1eda0 (diff)
Copy tilt/orientation from last real event.
Until these values are predicted, and for parity with Jetpack, reuse the tilt and orientation from the last real event. Bug: 291789258 Test: predicted MotionEvents have tilt/orientation of the last event Change-Id: I34a203652bfa20b3f42806cbd04eb8e076379bc2
-rw-r--r--libs/input/MotionPredictor.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/input/MotionPredictor.cpp b/libs/input/MotionPredictor.cpp
index c8d1da7b1f..412931bc41 100644
--- a/libs/input/MotionPredictor.cpp
+++ b/libs/input/MotionPredictor.cpp
@@ -205,6 +205,13 @@ std::unique_ptr<MotionEvent> MotionPredictor::predict(nsecs_t timestamp) {
coords.setAxisValue(AMOTION_EVENT_AXIS_X, predictedPoint.x);
coords.setAxisValue(AMOTION_EVENT_AXIS_Y, predictedPoint.y);
coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, predictedPressure[i]);
+ // Copy forward tilt and orientation from the last event until they are predicted
+ // (b/291789258).
+ coords.setAxisValue(AMOTION_EVENT_AXIS_TILT,
+ event.getAxisValue(AMOTION_EVENT_AXIS_TILT, 0));
+ coords.setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION,
+ event.getRawPointerCoords(0)->getAxisValue(
+ AMOTION_EVENT_AXIS_ORIENTATION));
predictionTime += mModel->config().predictionInterval;
if (i == 0) {