Fixed a flicker when expanding quicksettings on the lockscreen

The notifications flickered open when expanding quicksettings
on the lockscreen.

Test: add notifications (>4) expand quicksettings
Bug: 32437839
Change-Id: I12359ec374b281cb11816c7259c78715aedded43
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 9a3dbc8..6f9e2e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
@@ -50,6 +50,7 @@
     private NotificationShelf mShelf;
     private int mZDistanceBetweenElements;
     private int mBaseZHeight;
+    private int mMaxLayoutHeight;
 
     public AmbientState(Context context) {
         reload(context);
@@ -185,7 +186,7 @@
     }
 
     public int getInnerHeight() {
-        return Math.max(mLayoutHeight - mTopPadding, mLayoutMinHeight);
+        return Math.max(Math.min(mLayoutHeight, mMaxLayoutHeight) - mTopPadding, mLayoutMinHeight);
     }
 
     public boolean isShadeExpanded() {
@@ -223,4 +224,8 @@
     public NotificationShelf getShelf() {
         return mShelf;
     }
+
+    public void setLayoutMaxHeight(int maxLayoutHeight) {
+        mMaxLayoutHeight = maxLayoutHeight;
+    }
 }