Do not use raw coordinates in VelocityTracker

In P, we switched VelocityTracker to use raw coordinates when
calculating the velocity. While that helped solve the issues with views
being moved while touched, this has broken some other assumptions in the
view hierarchy. Currently during dispatch, MotionEvent coordinates are
getting adjusted as events are passed to the child views.

One example is a rotated ListView. When setRotation is called on a
ListView, ListView continues to use getYVelocity to determine the fling
speed. However, after the view is rotated, its action is in the
horizontal direction. This causes flings on ListView to not work
properly.

Further analysing the View system api, it appears that the problem could
also occur in such cases as scale, where the view gets increased in
size, and MotionEvents are adjusted accordingly.

This issue could have been solved in the view hierarchy by changing the
assumptions and reworking the VelocityTracker usage. However, that is
deemed infeasible.

The switch to raw coordinates was to resolve the issue when a moving
view is trying to calculate the velocity of the fling. Since that no
longer is possible, we will have to use work-arounds for those use
cases. One such example is the SystemUI use case, in PanelView.java.

Bug: 117921784
Bug: 117475766
Test: Sample app from bug 117475766, flings in the horizontal direction
work properly

Change-Id: If4cd6ace0bbef52521e1bbab8d58d649b295e2b7
1 file changed