Fix infinite loop problem in AnimationHandler
AnimationHandler.doAnimationFrame() iterates on a list that may be changed during the course of the lopp, especially when Battery Saver is enabled, or animators have zero duration, coupled with user code launching new animators when old ones end. The fix is to iterate through the old size of the list, and avoid processing new animators in the current frame. Bug: 37376806 Keyboard doesn't come up when battery saver is turned on on Android O Test: manual Change-Id: I40ca1d849e6f337779c23edbab22d80760c22f9b
This commit is contained in:
@@ -136,7 +136,8 @@ public class AnimationHandler {
|
||||
|
||||
private void doAnimationFrame(long frameTime) {
|
||||
long currentTime = SystemClock.uptimeMillis();
|
||||
for (int i = 0; i < mAnimationCallbacks.size(); i++) {
|
||||
final int size = mAnimationCallbacks.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
final AnimationFrameCallback callback = mAnimationCallbacks.get(i);
|
||||
if (callback == null) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user