am f92a1fdb: Fixed a bug where notifications shadows were blinking out

* commit 'f92a1fdb77311149189ae17244adc51017b89c1e':
  Fixed a bug where notifications shadows were blinking out
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index ccec759..71baf57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -374,7 +374,11 @@
     }
 
     private void updateClipping() {
-        mClipRect.set(0, mClipTopOptimization, getWidth(), getActualHeight());
+        int top = mClipTopOptimization;
+        if (top >= getActualHeight()) {
+            top = getActualHeight() - 1;
+        }
+        mClipRect.set(0, top, getWidth(), getActualHeight());
         setClipBounds(mClipRect);
     }
 
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 5d2e5b7..82064a7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -413,7 +413,9 @@
         ExpandableNotificationRow topHeadsUpEntry = ambientState.getTopHeadsUpEntry();
 
         int childCount = algorithmState.visibleChildren.size();
-        int numberOfElementsCompletelyIn = (int) algorithmState.itemsInTopStack;
+        int numberOfElementsCompletelyIn = algorithmState.partialInTop == 1.0f
+                ? algorithmState.lastTopStackIndex
+                : (int) algorithmState.itemsInTopStack;
         for (int i = 0; i < childCount; i++) {
             ExpandableView child = algorithmState.visibleChildren.get(i);
             StackViewState childViewState = resultState.getViewStateForView(child);