diff options
author | 2024-09-29 23:55:23 +0000 | |
---|---|---|
committer | 2024-10-06 23:11:33 +0000 | |
commit | 7f1efed1f8fcae76c021bfcea244c4f92844a608 (patch) | |
tree | 25382ef1de8c8d21492436587d7c2567747a4411 /libs/input/Resampler.cpp | |
parent | 5d59a429f0b0954f8183d4931db8417e308efca8 (diff) |
Add check to not resample when resample time equals motion event time
Included SampleTimeEqualsEventTime from TouchResampling_test.cpp into
InputConsumerResampling_test.cpp, and added the missing logic in
LegacyResampler to pass the test.
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerResamplingTest*"
Change-Id: I8ff9a263ea79eed1b814d2b1ce0b7efb5ade584e
Diffstat (limited to 'libs/input/Resampler.cpp')
-rw-r--r-- | libs/input/Resampler.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/input/Resampler.cpp b/libs/input/Resampler.cpp index 328fa684f6..1adff7ba36 100644 --- a/libs/input/Resampler.cpp +++ b/libs/input/Resampler.cpp @@ -249,6 +249,11 @@ void LegacyResampler::resampleMotionEvent(nanoseconds frameTime, MotionEvent& mo const InputMessage* futureSample) { const nanoseconds resampleTime = frameTime - RESAMPLE_LATENCY; + if (resampleTime.count() == motionEvent.getEventTime()) { + LOG_IF(INFO, debugResampling()) << "Not resampled. Resample time equals motion event time."; + return; + } + updateLatestSamples(motionEvent); const std::optional<Sample> sample = (futureSample != nullptr) |