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

Commit 0d7a4e5c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Uses static top padding for lockscreen notification space" into tm-dev am: fe726093

parents 22bac033 fe726093
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ public class KeyguardClockPositionAlgorithm {
        }
    }

    public float getMinStackScrollerPadding() {
    public float getLockscreenMinStackScrollerPadding() {
        if (mBypassEnabled) {
            return mUnlockedStackScrollerPadding;
        } else if (mIsSplitShade) {
+28 −2
Original line number Diff line number Diff line
@@ -326,6 +326,11 @@ public class NotificationPanelViewController extends PanelViewController {
    private boolean mShouldUseSplitNotificationShade;
    // The bottom padding reserved for elements of the keyguard measuring notifications
    private float mKeyguardNotificationBottomPadding;
    /**
     * The top padding from where notification should start in lockscreen.
     * Should be static also during animations and should match the Y of the first notification.
     */
    private float mKeyguardNotificationTopPadding;
    // Current max allowed keyguard notifications determined by measuring the panel
    private int mMaxAllowedKeyguardNotifications;

@@ -1514,7 +1519,10 @@ public class NotificationPanelViewController extends PanelViewController {
     */
    @VisibleForTesting
    float getSpaceForLockscreenNotifications() {
        float topPadding = mNotificationStackScrollLayoutController.getTopPadding();
        float staticTopPadding = mClockPositionAlgorithm.getLockscreenMinStackScrollerPadding()
                // getMinStackScrollerPadding is from the top of the screen,
                // but we need it from the top of the NSSL.
                - mNotificationStackScrollLayoutController.getTop();

        // Space between bottom of notifications and top of lock icon or udfps background.
        float lockIconPadding = mLockIconViewController.getTop();
@@ -1526,11 +1534,15 @@ public class NotificationPanelViewController extends PanelViewController {

        float bottomPadding = Math.max(lockIconPadding,
                Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding));

        mKeyguardNotificationBottomPadding = bottomPadding;
        mKeyguardNotificationTopPadding = staticTopPadding;

        // To debug the available space, enable debug lines in this class. If you change how the
        // available space is calculated, please also update those lines.
        float availableSpace =
                mNotificationStackScrollLayoutController.getHeight()
                        - topPadding
                        - staticTopPadding
                        - bottomPadding;
        return availableSpace;
    }
@@ -4924,6 +4936,20 @@ public class NotificationPanelViewController extends PanelViewController {
            drawDebugInfo(canvas, (int) mLockIconViewController.getTop(), Color.GRAY,
                    "mLockIconViewController.getTop()");

            if (mKeyguardShowing) {
                // Notifications have the space between those two lines.
                drawDebugInfo(canvas,
                        mNotificationStackScrollLayoutController.getTop() +
                                (int) mKeyguardNotificationTopPadding,
                        Color.RED,
                        "NSSL.getTop() + mKeyguardNotificationTopPadding");

                drawDebugInfo(canvas, mNotificationStackScrollLayoutController.getBottom() -
                                (int) mKeyguardNotificationBottomPadding,
                        Color.RED,
                        "NSSL.getBottom() - mKeyguardNotificationBottomPadding");
            }

            mDebugPaint.setColor(Color.CYAN);
            canvas.drawLine(0, mClockPositionResult.stackScrollerPadding, mView.getWidth(),
                    mNotificationStackScrollLayoutController.getTopPadding(), mDebugPaint);
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
        // WHEN the position algorithm is run
        positionClock();
        // THEN the padding DOESN'T adjust for keyguard status height.
        assertThat(mClockPositionAlgorithm.getMinStackScrollerPadding())
        assertThat(mClockPositionAlgorithm.getLockscreenMinStackScrollerPadding())
                .isEqualTo(mKeyguardStatusBarHeaderHeight);
    }

+3 −3
Original line number Diff line number Diff line
@@ -610,13 +610,13 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        when(mLockIconViewController.getTop()).thenReturn(80f);
        when(mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap)).thenReturn(5);

        // Available space (100 - 10 - 15 = 75)
        // Available space (100 - 0 - 15 = 85)
        when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(100);
        when(mNotificationStackScrollLayoutController.getTopPadding()).thenReturn(10);
        when(mNotificationStackScrollLayoutController.getTop()).thenReturn(0);
        mNotificationPanelViewController.updateResources();

        assertThat(mNotificationPanelViewController.getSpaceForLockscreenNotifications())
                .isEqualTo(75);
                .isEqualTo(85);
    }

    @Test