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
Loading
Please register or sign in to comment