Use correct keyguard margin clock position algorithm

Test: Check that user-switcher icon does not overlap with status bar on
      tablet
Bug: 180412238
Change-Id: I527e401bc5a66c80f33906d357c30dfea18285a4
This commit is contained in:
Peter Kalauskas
2021-02-23 11:03:39 -08:00
parent c13d22555f
commit 60cccdadfa
2 changed files with 17 additions and 12 deletions

View File

@@ -89,7 +89,8 @@ public class KeyguardClockPositionAlgorithm {
private int mNotificationStackHeight;
/**
* Minimum top margin to avoid overlap with status bar.
* Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
* avatar.
*/
private int mMinTopMargin;
@@ -186,15 +187,15 @@ public class KeyguardClockPositionAlgorithm {
/**
* Sets up algorithm values.
*/
public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight,
int userSwitchHeight, int clockPreferredY, int userSwitchPreferredY,
boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount,
boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon,
float qsExpansion, int cutoutTopInset) {
mMinTopMargin = statusBarMinHeight + (showLockIcon
? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon)
+ userSwitchHeight;
public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
int notificationStackHeight, float panelExpansion, int parentHeight,
int keyguardStatusHeight, int userSwitchHeight, int clockPreferredY,
int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
boolean showLockIcon, float qsExpansion, int cutoutTopInset) {
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(showLockIcon
? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon,
userSwitchHeight);
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
mPanelExpansion = panelExpansion;

View File

@@ -374,6 +374,7 @@ public class NotificationPanelViewController extends PanelViewController {
private ValueAnimator mQsExpansionAnimator;
private FlingAnimationUtils mFlingAnimationUtils;
private int mStatusBarMinHeight;
private int mStatusBarHeaderHeightKeyguard;
private int mNotificationsHeaderCollideDistance;
private float mEmptyDragAmount;
private float mDownX;
@@ -772,6 +773,8 @@ public class NotificationPanelViewController extends PanelViewController {
.setMaxLengthSeconds(0.4f).build();
mStatusBarMinHeight = mResources.getDimensionPixelSize(
com.android.internal.R.dimen.status_bar_height);
mStatusBarHeaderHeightKeyguard = mResources.getDimensionPixelSize(
R.dimen.status_bar_header_height_keyguard);
mQsPeekHeight = mResources.getDimensionPixelSize(R.dimen.qs_peek_height);
mNotificationsHeaderCollideDistance = mResources.getDimensionPixelSize(
R.dimen.header_notifications_collide_distance);
@@ -1069,7 +1072,7 @@ public class NotificationPanelViewController extends PanelViewController {
int totalHeight = mView.getHeight();
int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
int clockPreferredY = mKeyguardStatusViewController.getClockPreferredY(totalHeight);
int userSwitcherPreferredY = mStatusBarMinHeight;
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
.getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
@@ -1078,7 +1081,8 @@ public class NotificationPanelViewController extends PanelViewController {
? mKeyguardQsUserSwitchController.getUserIconHeight()
: (mKeyguardUserSwitcherController != null
? mKeyguardUserSwitcherController.getUserIconHeight() : 0);
mClockPositionAlgorithm.setup(mStatusBarMinHeight, totalHeight - bottomPadding,
mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
totalHeight - bottomPadding,
mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
getExpandedFraction(),
totalHeight,