From 9131397dc3fde172b260a5a8e67bd2777ab7637c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Wed, 26 Jan 2022 13:39:04 +0100 Subject: [PATCH] Split shade motion: improve expansion timing In this CL the approach is the following: 1 - Define a minimum content height in NSSL for split shade 2 - Use the minimum height when computing Nssl#getEmptyBottomMargin() 3 - Components (Npvc) that calculate expansion fraction already use Nssl#getEmptyBottomMargin(). Bug: 213585177 Test: Manually Change-Id: Id74531a95300ed093edb21c379b57b4ce6836771 --- packages/SystemUI/res/values/dimens.xml | 7 +++++++ .../stack/NotificationStackScrollLayout.java | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index f94031c73e3c0..b35571c17db76 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -369,6 +369,13 @@ 0dp + + 256dp + 0dp 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 428334369e21e..abf24a07db8a7 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 @@ -202,6 +202,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private int mBottomMargin; private int mBottomInset = 0; private float mQsExpansionFraction; + private final int mSplitShadeMinContentHeight; /** * The algorithm which calculates the properties for our children @@ -583,6 +584,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable .getDefaultColor(); int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height); int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height); + mSplitShadeMinContentHeight = res.getDimensionPixelSize( + R.dimen.nssl_split_shade_min_content_height); mExpandHelper = new ExpandHelper(getContext(), mExpandHelperCallback, minHeight, maxHeight); mExpandHelper.setEventSource(this); @@ -3886,7 +3889,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.COORDINATOR) int getEmptyBottomMargin() { - return Math.max(mMaxLayoutHeight - mContentHeight, 0); + int contentHeight; + if (mShouldUseSplitNotificationShade) { + // When in split shade and there are no notifications, the height can be too low, as + // it is based on notifications bottom, which is lower on split shade. + // Here we prefer to use at least a minimum height defined for split shade. + // Otherwise the expansion motion is too fast. + contentHeight = Math.max(mSplitShadeMinContentHeight, mContentHeight); + } else { + contentHeight = mContentHeight; + } + return Math.max(mMaxLayoutHeight - contentHeight, 0); } @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)