Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60cccdad authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

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
parent c13d2255
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -89,7 +89,8 @@ public class KeyguardClockPositionAlgorithm {
    private int mNotificationStackHeight;
    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;
    private int mMinTopMargin;


@@ -186,15 +187,15 @@ public class KeyguardClockPositionAlgorithm {
    /**
    /**
     * Sets up algorithm values.
     * Sets up algorithm values.
     */
     */
    public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight,
    public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
            float panelExpansion, int parentHeight, int keyguardStatusHeight,
            int notificationStackHeight, float panelExpansion, int parentHeight,
            int userSwitchHeight, int clockPreferredY, int userSwitchPreferredY,
            int keyguardStatusHeight, int userSwitchHeight, int clockPreferredY,
            boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount,
            int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
            boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon,
            float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
            float qsExpansion, int cutoutTopInset) {
            boolean showLockIcon, float qsExpansion, int cutoutTopInset) {
        mMinTopMargin = statusBarMinHeight + (showLockIcon
        mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(showLockIcon
                ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon)
                        ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon,
                + userSwitchHeight;
                userSwitchHeight);
        mMaxShadeBottom = maxShadeBottom;
        mMaxShadeBottom = maxShadeBottom;
        mNotificationStackHeight = notificationStackHeight;
        mNotificationStackHeight = notificationStackHeight;
        mPanelExpansion = panelExpansion;
        mPanelExpansion = panelExpansion;
+6 −2
Original line number Original line Diff line number Diff line
@@ -374,6 +374,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private ValueAnimator mQsExpansionAnimator;
    private ValueAnimator mQsExpansionAnimator;
    private FlingAnimationUtils mFlingAnimationUtils;
    private FlingAnimationUtils mFlingAnimationUtils;
    private int mStatusBarMinHeight;
    private int mStatusBarMinHeight;
    private int mStatusBarHeaderHeightKeyguard;
    private int mNotificationsHeaderCollideDistance;
    private int mNotificationsHeaderCollideDistance;
    private float mEmptyDragAmount;
    private float mEmptyDragAmount;
    private float mDownX;
    private float mDownX;
@@ -772,6 +773,8 @@ public class NotificationPanelViewController extends PanelViewController {
                .setMaxLengthSeconds(0.4f).build();
                .setMaxLengthSeconds(0.4f).build();
        mStatusBarMinHeight = mResources.getDimensionPixelSize(
        mStatusBarMinHeight = mResources.getDimensionPixelSize(
                com.android.internal.R.dimen.status_bar_height);
                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);
        mQsPeekHeight = mResources.getDimensionPixelSize(R.dimen.qs_peek_height);
        mNotificationsHeaderCollideDistance = mResources.getDimensionPixelSize(
        mNotificationsHeaderCollideDistance = mResources.getDimensionPixelSize(
                R.dimen.header_notifications_collide_distance);
                R.dimen.header_notifications_collide_distance);
@@ -1069,7 +1072,7 @@ public class NotificationPanelViewController extends PanelViewController {
            int totalHeight = mView.getHeight();
            int totalHeight = mView.getHeight();
            int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
            int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
            int clockPreferredY = mKeyguardStatusViewController.getClockPreferredY(totalHeight);
            int clockPreferredY = mKeyguardStatusViewController.getClockPreferredY(totalHeight);
            int userSwitcherPreferredY = mStatusBarMinHeight;
            int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
            boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
            boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
            final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
            final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
                    .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
                    .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
@@ -1078,7 +1081,8 @@ public class NotificationPanelViewController extends PanelViewController {
                    ? mKeyguardQsUserSwitchController.getUserIconHeight()
                    ? mKeyguardQsUserSwitchController.getUserIconHeight()
                    : (mKeyguardUserSwitcherController != null
                    : (mKeyguardUserSwitcherController != null
                            ? mKeyguardUserSwitcherController.getUserIconHeight() : 0);
                            ? mKeyguardUserSwitcherController.getUserIconHeight() : 0);
            mClockPositionAlgorithm.setup(mStatusBarMinHeight, totalHeight - bottomPadding,
            mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
                    totalHeight - bottomPadding,
                    mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
                    mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
                    getExpandedFraction(),
                    getExpandedFraction(),
                    totalHeight,
                    totalHeight,