OSDN Git Service

Fixed race condition regarding first child max height
authorSelim Cinek <cinek@google.com>
Mon, 28 Apr 2014 18:23:30 +0000 (20:23 +0200)
committerSelim Cinek <cinek@google.com>
Mon, 28 Apr 2014 18:27:32 +0000 (20:27 +0200)
The scroller could crash due to a race condition when updating
the maxheight of the first view.

Bug: 14295010
Change-Id: I911c724a26c8624e2326118e3b392ee675001bc6

packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java

index d9e7f66..8757d57 100644 (file)
@@ -542,9 +542,13 @@ public class StackScrollAlgorithm {
                                 public void onLayoutChange(View v, int left, int top, int right,
                                         int bottom, int oldLeft, int oldTop, int oldRight,
                                         int oldBottom) {
-                                    mFirstChildMaxHeight = getMaxAllowedChildHeight(
-                                            mFirstChildWhileExpanding);
-                                    mFirstChildWhileExpanding.removeOnLayoutChangeListener(this);
+                                    if (mFirstChildWhileExpanding != null) {
+                                        mFirstChildMaxHeight = getMaxAllowedChildHeight(
+                                                mFirstChildWhileExpanding);
+                                    } else {
+                                        mFirstChildMaxHeight = 0;
+                                    }
+                                    v.removeOnLayoutChangeListener(this);
                                 }
                             });
                 } else {