diff options
3 files changed, 56 insertions, 16 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 4a8fd1b00dde..60bcac376ae3 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -388,6 +388,8 @@ <dimen name="split_shade_notifications_scrim_margin_bottom">0dp</dimen> + <dimen name="shelf_and_lock_icon_overlap">5dp</dimen> + <dimen name="notification_panel_margin_horizontal">0dp</dimen> <dimen name="brightness_mirror_height">48dp</dimen> 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 0b46f07f8e8b..394435dd609f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -389,6 +389,12 @@ public class NotificationPanelViewController extends PanelViewController { private int mLargeScreenShadeHeaderHeight; private int mSplitShadeNotificationsScrimMarginBottom; + /** + * Vertical overlap allowed between the bottom of the notification shelf and + * the top of the lock icon or the under-display fingerprint sensor background. + */ + private int mShelfAndLockIconOverlap; + private final KeyguardClockPositionAlgorithm mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm(); @@ -1081,6 +1087,9 @@ public class NotificationPanelViewController extends PanelViewController { mResources.getDimensionPixelSize( R.dimen.split_shade_notifications_scrim_margin_bottom); + mShelfAndLockIconOverlap = + mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap); + final boolean newShouldUseSplitNotificationShade = LargeScreenUtils.shouldUseSplitNotificationShade(mResources); final boolean splitNotificationShadeChanged = @@ -1466,27 +1475,18 @@ public class NotificationPanelViewController extends PanelViewController { } /** - * @return the maximum keyguard notifications that can fit on the screen + * @return Space available to show notifications on lockscreen. */ @VisibleForTesting - int computeMaxKeyguardNotifications() { - if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) { - return mMaxAllowedKeyguardNotifications; - } + float getSpaceForLockscreenNotifications() { float topPadding = mNotificationStackScrollLayoutController.getTopPadding(); - float shelfIntrinsicHeight = - mNotificationShelfController.getVisibility() == View.GONE - ? 0 - : mNotificationShelfController.getIntrinsicHeight(); - // Padding to add to the bottom of the stack to keep a minimum distance from the top of - // the lock icon. - float lockIconPadding = 0; + // Space between bottom of notifications and top of lock icon or udfps background. + float lockIconPadding = mLockIconViewController.getTop(); if (mLockIconViewController.getTop() != 0) { - final float lockIconTopWithPadding = mLockIconViewController.getTop() - - mResources.getDimensionPixelSize(R.dimen.min_lock_icon_padding); lockIconPadding = mNotificationStackScrollLayoutController.getBottom() - - lockIconTopWithPadding; + - mLockIconViewController.getTop() + - mShelfAndLockIconOverlap; } float bottomPadding = Math.max(lockIconPadding, @@ -1497,9 +1497,26 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.getHeight() - topPadding - bottomPadding; + return availableSpace; + } + + /** + * @return Maximum number of notifications that can fit on keyguard. + */ + @VisibleForTesting + int computeMaxKeyguardNotifications() { + if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) { + return mMaxAllowedKeyguardNotifications; + } + + final float shelfIntrinsicHeight = + mNotificationShelfController.getVisibility() == View.GONE + ? 0 + : mNotificationShelfController.getIntrinsicHeight(); return mNotificationStackSizeCalculator.computeMaxKeyguardNotifications( - mNotificationStackScrollLayoutController.getView(), availableSpace, + mNotificationStackScrollLayoutController.getView(), + getSpaceForLockscreenNotifications(), shelfIntrinsicHeight); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java index cad603c85bbc..8af62624c401 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java @@ -589,6 +589,27 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { } @Test + public void getLockscreenSpaceForNotifications_includesOverlapWithLockIcon() { + when(mResources.getDimensionPixelSize(R.dimen.keyguard_indication_bottom_padding)) + .thenReturn(0); + mNotificationPanelViewController.setAmbientIndicationTop( + /* ambientIndicationTop= */ 0, /* ambientTextVisible */ false); + + // Use lock icon padding (100 - 80 - 5 = 15) as bottom padding + when(mNotificationStackScrollLayoutController.getBottom()).thenReturn(100); + when(mLockIconViewController.getTop()).thenReturn(80f); + when(mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap)).thenReturn(5); + + // Available space (100 - 10 - 15 = 75) + when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(100); + when(mNotificationStackScrollLayoutController.getTopPadding()).thenReturn(10); + mNotificationPanelViewController.updateResources(); + + assertThat(mNotificationPanelViewController.getSpaceForLockscreenNotifications()) + .isEqualTo(75); + } + + @Test public void testSetPanelScrimMinFraction() { mNotificationPanelViewController.setPanelScrimMinFraction(0.5f); verify(mNotificationShadeDepthController).setPanelPullDownMinFraction(eq(0.5f)); |