Add a buffer to smooth mouse scroll acceleration

Sometimes a bluetooth mouse will send multiple scroll events in quick
succession when in reality they were generated more slowly. This can
cause a large spike in scroll velocity. We already make sure that we use
a minimum time delta between events when calculating scroll velocity,
but the issue is still noticieable. Increasing this time delta can help,
but degrades scroll acceleration when the user intends to scorll fast.

In this CL, we add a small buffer of scroll events that we use to
calculate scroll velocity for the purpose of scroll acceleration.  This
allows us to accelerate scrolls appropriately when the user is
consistently scrolling quickly, without spurious spikes in acceleration
when we receive batched bluetooth events.

BUG=b:232137263
TEST=manual testing, check for degredation in unittests and
touchpad-tests, add touchpad-tests regression test.

Cq-Depend: chromium:5159508
Change-Id: I4b72fc0a2649dfc6628008668484e624f335a5e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/5159108
Reviewed-by: Kenneth Albanowski <kenalba@google.com>
Commit-Queue: Sean O'Brien <seobrien@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Torsha Banerjee <torsha@google.com>
Tested-by: Sean O'Brien <seobrien@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
4 files changed