diff options
| author | 2021-03-18 13:53:13 +0000 | |
|---|---|---|
| committer | 2021-03-18 13:53:23 +0000 | |
| commit | 2076ef9768a1b01ea81afafab058aeed94b8b8ef (patch) | |
| tree | 3ccec87f2a79f7b92ed3ad931a9b63e630ddcbfd | |
| parent | 7af6a2e9f4052e7257a6eabe7d83cbb393c59311 (diff) | |
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
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index a785a1ab9f0e..51396dbb8204 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -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) { |