FIx issue:

https://issuetracker.google.com/issues/183024999

There's a performance issue during continually scroll listview when listview in Fling state .
Consider such scene as blew:
1.Listview holds a lots of data
2.mTouchMode in TOUCH_MODE_FLING state.
3.Touch Event delivery down event to listview , mTouchMode change to TOUCH_MODE_SCROLL , post checkFlyWheel(40ms timeout). move event make checkFlywheel.endFling()  delay  to execute  , before endFling() satisfied to execute up event occured, flingrunnable.start() will post a extra FlingRunnable in onTouchUp().

Finally Choreographer.CallbackQueue will get more and more FlingRunnable animation callback when keep repeating  above steps#3, Choreographer#doFrame#animation will  execute FlingRunnbale N times per frame , it will greater than vsync period cause jank (N means repeat steps#3 times). 

Solution:
Remove unnecessary FlingRunnable before add FlingRunnable.

Change-Id: I2cbab9171ffbaad87a8908eef09f813cf89ad85a
This commit is contained in:
Tang Ding
2021-03-18 13:53:13 +00:00
parent 7af6a2e9f4
commit 2076ef9768

View File

@@ -4679,6 +4679,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
mTouchMode = TOUCH_MODE_FLING;
mSuppressIdleStateChangeCall = false;
removeCallbacks(this);
postOnAnimation(this);
if (PROFILE_FLINGING) {