Merge "Allow overlap between notifications and lock icon" into tm-dev
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -391,6 +391,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();
|
||||
@@ -1104,6 +1110,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 =
|
||||
@@ -1489,27 +1498,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,
|
||||
@@ -1520,9 +1520,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -594,6 +594,27 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
.isNotEqualTo(-1);
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
Reference in New Issue
Block a user