From 1d9a175ae71160658dcad879ef8c10f379142b59 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Sun, 16 May 2021 08:40:01 -0500 Subject: [PATCH] Fix fluctuating notification height during shade open Fixes: 188206952 Test: manual Change-Id: I32a1861b419264cf45b75e9934a04294c1e11942 --- .../stack/NotificationStackScrollLayout.java | 2 +- .../notification/stack/StackScrollAlgorithm.java | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 3244ff915d873..a804ae6a5cd8e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -1142,7 +1142,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (mQsExpansionFraction <= 0) { final float scrimTopPadding = mAmbientState.isOnKeyguard() ? 0 : mSidePaddings; final float stackEndHeight = Math.max(0f, - getHeight() - getEmptyBottomMargin() - stackY); + getHeight() - getEmptyBottomMargin() - mTopPadding); mAmbientState.setStackEndHeight(stackEndHeight); mAmbientState.setStackHeight( MathUtils.lerp(stackEndHeight * StackScrollAlgorithm.START_FRACTION, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index b2d39a952fe20..eaa8089cae44e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -348,14 +348,14 @@ public class StackScrollAlgorithm { StackScrollAlgorithmState algorithmState, AmbientState ambientState) { - final boolean isShowingShelf = ambientState.getShelf() != null + final boolean showingShelf = ambientState.getShelf() != null && algorithmState.firstViewInShelf != null; - final float stackHeight = ambientState.getStackHeight() - - (isShowingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f); + final float shelfHeight = showingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f; + final float scrimPadding = ambientState.isOnKeyguard() ? 0 : mNotificationScrimPadding; - float stackEndHeight = ambientState.getStackEndHeight() - - (isShowingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f); + final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding; + final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding; return stackHeight / stackEndHeight; } @@ -459,8 +459,7 @@ public class StackScrollAlgorithm { maxViewHeight = algorithmState.viewHeightBeforeShelf; } } - viewState.height = (int) MathUtils.lerp(maxViewHeight * START_FRACTION, maxViewHeight, - expansionFraction); + viewState.height = (int) (maxViewHeight * expansionFraction); } currentYPosition += viewState.height + expansionFraction * mPaddingBetweenElements;