History log of /frameworks/native/libs/input/VelocityTracker.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e7d4775275efeca0caf7ec9106fa5b38057f2233 03-Mar-2018 Siarhei Vishniakou <svv@google.com> Rename a constant in VelocityTracker

Constant "SECONDS_PER_NANO" was incorrectly named.

Test: presubmit, no functional change was made
Change-Id: I9e7a70c078499cd22655a47f47c0fae8684511e7
/frameworks/native/libs/input/VelocityTracker.cpp
2bc43cadc2cca889229b210f9938e815997d728b 01-Feb-2018 Siarhei Vishniakou <svv@google.com> Use raw coordinates in VelocityTracker

Currently, VelocityTracker uses the "default" motionevent coordinates in
order to estimate the liftoff velocity of a pointer. When a view
receives a MotionEvent, the coordinates are getting adjusted relative to
the top left corner of the view. In a situation where a view itself is
moving while the user is interacting with the screen, and the view is
trying to estimate the fling velocity for a finger, this would cause
velocitytracker to use dynamic view coordinates. When these dynamically
adjusted coordinates are used in VelocityTracker, the resulting estimate
no longer accurately represents the liftoff velocity of a finger, since
the received data does not have a common origin.

Instead of using the offset-adjusted coordinates of a MotionEvent, use
the raw coordinates that are relative to the display itself and
independent of the view hierarchy.

Bug: 72263561
Test: m -j inputflinger_tests_InputReader_test
inputflinger_tests_InputDispatcher_test libinput_tests_InputChannel_test
libinput_tests_InputEvent_test
libinput_tests_InputPublisherAndConsumer_test
libinput_tests_VelocityTracker_test && adb push
out/target/product/$TARGET_PRODUCT/data/nativetest64/*
/data/nativetest64/
then run the tests on the device.
When "impulse" strategy is enabled, the velocitytracker test fails
because the flings need to be re-recorded.
Also manual fling in Google Maps (one and two finger), youtube, settings.

Change-Id: Id4d152dae00c2e6a342a71f5c89cbb5426c169ff
/frameworks/native/libs/input/VelocityTracker.cpp
e63cbba080c9298a9b964f74d40fd2cb96873bb4 22-Jan-2018 Siarhei Vishniakou <svv@google.com> Revert back to lsq2 velocity strategy

Switch back to lsq2 while the bugreports for the impulse velocity
tracker strategy are investigated.

Bug: 72263561
Test: this is a revert
Change-Id: I6a2399d91f8c0225df8b90fb452a54aa42fe6894
/frameworks/native/libs/input/VelocityTracker.cpp
7e78b9e0b77b4ccbda27ef93ee683c186b050d82 12-Jan-2018 Siarhei Vishniakou <svv@google.com> Switch to impulse VelocityTracker strategy

Switch from lsq2 to impulse strategy for VelocityTracker.

Bug: 69069303
Test: flings in SystemUI and Google Maps with 1 and 2 fingers on both
Pixel 2 and Pixel 2 XL devices.
VelocityTracker_test currently fails 8 pre-recorded flings on Pixel, and
will be updated after this change has soaked in dogfood. The flings will
need to be re-recorded. Currently, in all 8 instances the reported
velocity is more than 20% smaller in magnitude than expected velocity.
m -j inputflinger_tests_InputReader_test
inputflinger_tests_InputDispatcher_test libinput_tests_InputChannel_test
libinput_tests_InputEvent_test
libinput_tests_InputPublisherAndConsumer_test
libinput_tests_VelocityTracker_test && adb push
out/target/product/$TARGET_PRODUCT/data/nativetest64/*
/data/nativetest64/
Then run test binaries on the device.

Change-Id: I952fdfdc4ecd21cdfa50ec388af7f98d1b0d8cbe
/frameworks/native/libs/input/VelocityTracker.cpp
899c2aa1b8c7b576ddb7949ec4448956d7c5bc2c 09-Nov-2017 Siarhei Vishniakou <svv@google.com> Revert to lsq2 VelocityTracker strategy

The impulse implementation causes high velocity
at liftoff on some hardware. Reverting back to lsq2
for now.

Bug: 35412046
Fixes: 69069303
Test: use Google Maps with 2 fingers with both strategies
Change-Id: I7138fa12468303aa3885f4731bbdacbf5c7ce3a8
/frameworks/native/libs/input/VelocityTracker.cpp
13e4bdc8fc3c9cede83a1e99251235006226f67d 02-Nov-2017 Siarhei Vishniakou <svv@google.com> Switch to ImpulseVelocityTracker fling strategy.

The current default VelocityTrackerStrategy is lsq2,
which is using second-order least squares fits to
calculate the fling velocity. However, that strategy
has a few shortcomings, which should be fixed by the
impulse strategy.

Bug: 64680775
Bug: 35412046
Test: /data/nativetest/libinput_tests/VelocityTracker_test
(test will be fixed after this CL ends by re-recording some of the
flings that fail due to the implementation change of the
impulse strategy)

Change-Id: Ib4d70bc3c88892f01d29bc1cb8f5802ace938d45
/frameworks/native/libs/input/VelocityTracker.cpp
219aec37372d9db514591126feb6f6ac7441442a 05-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Different previous velocity calculation"
97b5e18ddf25d9f0e4eec85f0e0e80487d7fca14 01-Sep-2017 Siarhei Vishniakou <svv@google.com> Different previous velocity calculation

Instead of using the instantaneous velocity as the value for the
v[i-1], use the velocity equivalent of the energy accumulated so
far. This should act as a kind of a low-pass filter, and results
in lower velocity values than the current version of the algorithm.

Bug: 35412046
Test: native and CTS
1) /data/nativetest64/libinput_tests/VelocityTracker_test
This test currently fails, and we may need to modify the
expected velocity values to get it to pass with this version
of the algorithm
2) bit CtsViewTestCases:.VelocityTrackerTest
This test passes

Change-Id: I358cfd8161ec3d423a4f3126c9bcec6de1020490
/frameworks/native/libs/input/VelocityTracker.cpp
d4b607ef71cf2d76206151ce321239cad40cdd68 13-Jun-2017 Siarhei Vishniakou <svv@google.com> Native test for VelocityTracker

Adding VelocityTracker native tests for checking
the velocity output for certain inputs. Adding two types of
test cases:
1) Generated manually. These are simple test cases like linear
motion, repeated coordinates, etc.
2) Generated by recording an actual fling. Used
to reproduce the swordfish fling bug referenced below.
3) Recorded flings on sailfish for additional tests.
Currently, the make target for the test is
libinput_tests_VelocityTracker_test.

Bug: 35412046
Test: adb shell /data/nativetest64/libinput_tests/VelocityTracker_test
Change-Id: I2f71100f8dc6216667b0698270a27c98cd401565
/frameworks/native/libs/input/VelocityTracker.cpp
4cd4009e811d3117d642607fc70485f26ce2bb63 15-Aug-2017 Siarhei Vishniakou <svv@google.com> Switch back to lsq2 VelocityTracker strategy.

The impulse VelocityTracker strategy is over-estimating
certain injected input events, used for SystemUI jank
performance tests. The current regression is caused by a combination of
improperly spaced input events and the high sensitivity of the new
strategy to that portion of the motion.

Bug: 64680775
Test: bit CtsViewTestCases:.VelocityTrackerTest
Change-Id: I4b387dcc4a13fe4295ee208490c49b2763a6bd19
/frameworks/native/libs/input/VelocityTracker.cpp
00a4ea970bab16ef5675e866cd856a0d9919f0c5 08-Jun-2017 Siarhei Vishniakou <svv@google.com> New impulse-based VelocityTracker strategy.

New velocity calculation strategy for VelocityTracker.
The strategy models the phone screen as a physical object
that gets pushed by the finger. Upon liftoff, the total
work done on the object (past 100ms of data and at most
20 most recent samples) is considered to be kinetic energy,
which gets converted into equivalent velocity.
Works well with "bad" data - unclean touch liftoff,
repeated coordinates. Time-shift invariant. Performance
otherwise similar to the current default strategy,
quadratic unweighted least squares.

Bug: 35412046
Test: Recorded bad scroll event on swordfish, this fixes the
fling in the wrong direction. Also tested common usecase
scenarios on sailfish, no regressions observed. Similar
velocity values to lsq2 strategy.

Change-Id: Ib439db0ce3b4fe84f59cf66683eae0b5df7776eb
/frameworks/native/libs/input/VelocityTracker.cpp
986678fc37edfee2b0d1a9120146a9310216c55a 04-Aug-2017 Siarhei Vishniakou <svv@google.com> Merge "Faster unweighted 2nd degree least squares algo."
ec2727e9835be89263ca1170ad62dbaba0980737 06-Jul-2017 Siarhei Vishniakou <svv@google.com> Convert String8 to std::string

String8 is deprecated.

Test: m -j and uncomment DEBUG flags
in VelocityTracker to view coordinates
in logcat.

Change-Id: I968685765f06418be73fbb8ad2747a1fe8ed324e
/frameworks/native/libs/input/VelocityTracker.cpp
7b9d189574fdf530df9c2e30e4fd799c9a25e6b4 06-Jul-2017 Siarhei Vishniakou <svv@google.com> Fix SIGABRT caused by integer sanitizer.

Test: m -j and use flings in settings menu.
Change-Id: I7c15c610ed2d74b128a2924c097fb7dc351ea5f4
/frameworks/native/libs/input/VelocityTracker.cpp
489d38e219a0f8ba35f9d4e1a9ebee0b4d62ca3e 16-Jun-2017 Siarhei Vishniakou <svv@google.com> Faster unweighted 2nd degree least squares algo.

Speed up the default velocity computation that uses
unweighted second degree least squares approach.
Only calculate the linear coefficient, single loop
with O(n) complexity. About 2x speedup.

Test: dumped the original and the new values while
flinging settings. Observed nearly identical
velocity results (less than 0.1% difference).
Also ran CTS test:
tools/cts-tradefed run cts -t android.view.cts.VelocityTrackerTest -m
CtsViewTestCases --skip-system-status-check
com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker

Change-Id: I7ddbd85a092f44e8d4b5f109c386af5dd589d249
/frameworks/native/libs/input/VelocityTracker.cpp
389ddbad52b32beeee6d3f361145b7431bae3536 22-Sep-2015 Dan Austin <danielaustin@google.com> Enable multiple benign overflow conditions.

In VelocityTracker.cpp, there are multiple loops in which loop
termination occurs when the value becomes zero. These termination
conditions are all written value-- > 0, which, since value is
unsigned, result in an integer overflow condition when value is 0.
These loop were refactored to eliminate these conditions.

Bug: 24171356
Change-Id: Ie44940cfef8a122ee1aff59c021274ba39a368bf
/frameworks/native/libs/input/VelocityTracker.cpp
5912f95d26f77d2b6df13e1f2672e48e3f9b871c 02-Jul-2013 Jeff Brown <jeffbrown@google.com> Move input library code from frameworks/base.

Change-Id: I4983db61b53e28479fc90d9211fafff68f7f49a6
/frameworks/native/libs/input/VelocityTracker.cpp