From baa241a0fcf21f12bc58f3c9b8a0b296ffe8642e Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Thu, 24 Jun 2021 16:44:34 -0400 Subject: [PATCH] Add a gray debug line to NSSL to show the keyguard padding. Bug: 190630151 Test: Disable the keyguard max; add 5 normal notifications on a sargo, see them all draw right up to the gray line. Replace 1 with a conversation (adds a few dp padding) and see the shelf appear. Soo.. seems consistent. Change-Id: Id5f93b7151dd0b1698ceebda9a01c592ba54bb2f --- .../stack/NotificationStackScrollLayout.java | 21 +++++++++++++++++++ ...tificationStackScrollLayoutController.java | 10 +++++++++ .../NotificationPanelViewController.java | 6 ++++++ 3 files changed, 37 insertions(+) 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 35914c0f28fc5..2404d8af9042d 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 @@ -413,6 +413,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private boolean mBackwardScrollable; private NotificationShelf mShelf; private int mMaxDisplayedNotifications = -1; + private float mKeyguardBottomPadding = -1; private int mStatusBarHeight; private int mMinInteractionHeight; private final Rect mClipRect = new Rect(); @@ -738,6 +739,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mDebugPaint.setColor(Color.YELLOW); canvas.drawLine(0, y, getWidth(), y, mDebugPaint); + y = (int) mMaxLayoutHeight; + mDebugPaint.setColor(Color.MAGENTA); + canvas.drawLine(0, y, getWidth(), y, mDebugPaint); + + if (mKeyguardBottomPadding >= 0) { + y = getHeight() - (int) mKeyguardBottomPadding; + mDebugPaint.setColor(Color.GRAY); + canvas.drawLine(0, y, getWidth(), y, mDebugPaint); + } + y = getHeight() - getEmptyBottomMargin(); mDebugPaint.setColor(Color.GREEN); canvas.drawLine(0, y, getWidth(), y, mDebugPaint); @@ -4773,6 +4784,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } + /** + * This is used for debugging only; it will be used to draw the otherwise invisible line which + * NotificationPanelViewController treats as the bottom when calculating how many notifications + * appear on the keyguard. + * Setting a negative number will disable rendering this line. + */ + public void setKeyguardBottomPadding(float keyguardBottomPadding) { + mKeyguardBottomPadding = keyguardBottomPadding; + } + @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setShouldShowShelfOnly(boolean shouldShowShelfOnly) { mShouldShowShelfOnly = shouldShowShelfOnly; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index a92682a76a9ca..a47afb2e82ec7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -1204,6 +1204,16 @@ public class NotificationStackScrollLayoutController { mNotificationListContainer.setMaxDisplayedNotifications(maxNotifications); } + /** + * This is used for debugging only; it will be used to draw the otherwise invisible line which + * NotificationPanelViewController treats as the bottom when calculating how many notifications + * appear on the keyguard. + * Setting a negative number will disable rendering this line. + */ + public void setKeyguardBottomPadding(float keyguardBottomPadding) { + mView.setKeyguardBottomPadding(keyguardBottomPadding); + } + public RemoteInputController.Delegate createDelegate() { return new RemoteInputController.Delegate() { public void setRemoteInputActive(NotificationEntry entry, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 3acdb1ab53288..d4ebe862af7d3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -325,6 +325,8 @@ public class NotificationPanelViewController extends PanelViewController { private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; private final TapAgainViewController mTapAgainViewController; private boolean mShouldUseSplitNotificationShade; + // The bottom padding reserved for elements of the keyguard measuring notifications + private float mKeyguardNotificationBottomPadding; // Current max allowed keyguard notifications determined by measuring the panel private int mMaxAllowedKeyguardNotifications; @@ -1169,9 +1171,12 @@ public class NotificationPanelViewController extends PanelViewController { if (mKeyguardShowing && !mKeyguardBypassController.getBypassEnabled()) { mNotificationStackScrollLayoutController.setMaxDisplayedNotifications( mMaxAllowedKeyguardNotifications); + mNotificationStackScrollLayoutController.setKeyguardBottomPadding( + mKeyguardNotificationBottomPadding); } else { // no max when not on the keyguard mNotificationStackScrollLayoutController.setMaxDisplayedNotifications(-1); + mNotificationStackScrollLayoutController.setKeyguardBottomPadding(-1f); } } @@ -1353,6 +1358,7 @@ public class NotificationPanelViewController extends PanelViewController { float bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding); bottomPadding = Math.max(lockIconPadding, bottomPadding); + mKeyguardNotificationBottomPadding = bottomPadding; float availableSpace = mNotificationStackScrollLayoutController.getHeight()