summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christian Göllner <chrisgollner@google.com> 2022-01-26 13:39:04 +0100
committer Christian Göllner <chrisgollner@google.com> 2022-01-27 14:30:25 +0100
commit9131397dc3fde172b260a5a8e67bd2777ab7637c (patch)
treed3127f403a2300e621ce110ebb117a34a6485fa4
parent7d8c3ad7072adffc481578147de688714fa3caa5 (diff)
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
-rw-r--r--packages/SystemUI/res/values/dimens.xml7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java15
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index f94031c73e3c..b35571c17db7 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -369,6 +369,13 @@
<!-- The top margin of the panel that holds the list of notifications. -->
<dimen name="notification_panel_margin_top">0dp</dimen>
+ <!-- The minimum content height for the split shade NSSL.
+ It is used because if the height is too small, the expansion motion is too fast.
+ Note that the value of 256dp is more or less a random value and can be changed to tweak
+ the expansion motion.
+ -->
+ <dimen name="nssl_split_shade_min_content_height">256dp</dimen>
+
<!-- The bottom margin of the panel that holds the list of notifications. -->
<dimen name="notification_panel_margin_bottom">0dp</dimen>
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 428334369e21..abf24a07db8a 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)