Fixed a bug when double tapping a notification in the normal shade

This fixes that sometimes holes where created when grabbing the panel while
closing the shade (eg. double tapping) or the notifications did not disappear.
It could also happen when using the clear all button.

Bug: 17969040
Bug: 17899136
Bug: 17961295
Bug: 17551216
Change-Id: Id7aa37bbcbae504039f90686e2bc364d18685205
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index e4a1c27..853628e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -738,8 +738,9 @@
             if (mExpandedOnStart) {
 
                 // We are collapsing the shade, so the first child can get as most as high as the
-                // current height.
-                mFirstChildMaxHeight = mFirstChildWhileExpanding.getActualHeight();
+                // current height or the end value of the animation.
+                mFirstChildMaxHeight = StackStateAnimator.getFinalActualHeight(
+                        mFirstChildWhileExpanding);
             } else {
                 updateFirstChildMaxSizeToMaxHeight();
             }
@@ -801,9 +802,14 @@
         this.mIsExpanded = isExpanded;
     }
 
-    public void notifyChildrenChanged(ViewGroup hostView) {
+    public void notifyChildrenChanged(final ViewGroup hostView) {
         if (mIsExpansionChanging) {
-            updateFirstChildHeightWhileExpanding(hostView);
+            hostView.post(new Runnable() {
+                @Override
+                public void run() {
+                    updateFirstChildHeightWhileExpanding(hostView);
+                }
+            });
         }
     }