Fully removed the bottom stack

Moved the ambient notifications into the shelf
instead of having them behave with their own
physics. Previously the ambient notifications
were stuck in the old world behind the shelf,
but this doesn't make sense anymore.

This also fixed a bug where the notifications were
wrongly positioned on the lockscreen since the shelf
counted as a view that wasn't gone.

Test: add low-priority notifications, observe scrolling
Bug: 32437839
Change-Id: I3921ea9f80a06f1b6330315423b012174269ac8e
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
index 6f9e2e5..26f74ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
@@ -36,7 +36,7 @@
     private ActivatableNotificationView mActivatedChild;
     private float mOverScrollTopAmount;
     private float mOverScrollBottomAmount;
-    private int mShelfIndex = -1;
+    private int mSpeedBumpIndex = -1;
     private boolean mDark;
     private boolean mHideSensitive;
     private HeadsUpManager mHeadsUpManager;
@@ -51,6 +51,7 @@
     private int mZDistanceBetweenElements;
     private int mBaseZHeight;
     private int mMaxLayoutHeight;
+    private ActivatableNotificationView mLastVisibleBackgroundChild;
 
     public AmbientState(Context context) {
         reload(context);
@@ -62,8 +63,7 @@
     public void reload(Context context) {
         mZDistanceBetweenElements = Math.max(1, context.getResources()
                 .getDimensionPixelSize(R.dimen.z_distance_between_notifications));
-        mBaseZHeight = (StackScrollAlgorithm.MAX_ITEMS_IN_BOTTOM_STACK + 1)
-                * mZDistanceBetweenElements;
+        mBaseZHeight = 4 * mZDistanceBetweenElements;
     }
 
     /**
@@ -153,12 +153,12 @@
         return top ? mOverScrollTopAmount : mOverScrollBottomAmount;
     }
 
-    public int getShelfIndex() {
-        return mShelfIndex;
+    public int getSpeedBumpIndex() {
+        return mSpeedBumpIndex;
     }
 
-    public void setShelfIndex(int shelfIndex) {
-        mShelfIndex = shelfIndex;
+    public void setSpeedBumpIndex(int shelfIndex) {
+        mSpeedBumpIndex = shelfIndex;
     }
 
     public void setHeadsUpManager(HeadsUpManager headsUpManager) {
@@ -228,4 +228,17 @@
     public void setLayoutMaxHeight(int maxLayoutHeight) {
         mMaxLayoutHeight = maxLayoutHeight;
     }
+
+    /**
+     * Sets the last visible view of the host layout, that has a background, i.e the very last
+     * view in the shade, without the clear all button.
+     */
+    public void setLastVisibleBackgroundChild(
+            ActivatableNotificationView lastVisibleBackgroundChild) {
+        mLastVisibleBackgroundChild = lastVisibleBackgroundChild;
+    }
+
+    public ActivatableNotificationView getLastVisibleBackgroundChild() {
+        return mLastVisibleBackgroundChild;
+    }
 }