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

Commit 1bc46083 authored by Michał Brzeziński's avatar Michał Brzeziński Committed by Automerger Merge Worker
Browse files

Merge "Decreasing notifications height on split shade lockscreen" into...

Merge "Decreasing notifications height on split shade lockscreen" into sc-v2-dev am: 2958d2d2 am: 45807172

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16140647

Change-Id: I6690664c6aca95b90beb5dd18f47584bee7257a6
parents 69c89d57 45807172
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -195,12 +195,21 @@ public class KeyguardClockPositionAlgorithm {
                1.0f /* panelExpansion */, 1.0f /* darkAmount */);
                1.0f /* panelExpansion */, 1.0f /* darkAmount */);
        result.clockAlpha = getClockAlpha(y);
        result.clockAlpha = getClockAlpha(y);
        result.stackScrollerPadding = getStackScrollerPadding(y);
        result.stackScrollerPadding = getStackScrollerPadding(y);
        result.stackScrollerPaddingExpanded = mBypassEnabled ? mUnlockedStackScrollerPadding
        result.stackScrollerPaddingExpanded = getStackScrollerPaddingExpanded();
                : getClockY(1.0f, mDarkAmount) + mKeyguardStatusHeight;
        result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
        result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
        result.clockScale = interpolate(getBurnInScale(), 1.0f, 1.0f - mDarkAmount);
        result.clockScale = interpolate(getBurnInScale(), 1.0f, 1.0f - mDarkAmount);
    }
    }


    private int getStackScrollerPaddingExpanded() {
        if (mBypassEnabled) {
            return mUnlockedStackScrollerPadding;
        } else if (mIsSplitShade) {
            return getClockY(1.0f, mDarkAmount);
        } else {
            return getClockY(1.0f, mDarkAmount) + mKeyguardStatusHeight;
        }
    }

    private int getStackScrollerPadding(int clockYPosition) {
    private int getStackScrollerPadding(int clockYPosition) {
        if (mBypassEnabled) {
        if (mBypassEnabled) {
            return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount);
            return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount);
@@ -212,8 +221,13 @@ public class KeyguardClockPositionAlgorithm {
    }
    }


    public float getMinStackScrollerPadding() {
    public float getMinStackScrollerPadding() {
        return mBypassEnabled ? mUnlockedStackScrollerPadding
        if (mBypassEnabled) {
                : mMinTopMargin + mKeyguardStatusHeight;
            return mUnlockedStackScrollerPadding;
        } else if (mIsSplitShade) {
            return mMinTopMargin;
        } else {
            return mMinTopMargin + mKeyguardStatusHeight;
        }
    }
    }


    private int getExpandedPreferredClockY() {
    private int getExpandedPreferredClockY() {
+24 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
    private KeyguardClockPositionAlgorithm.Result mClockPosition;
    private KeyguardClockPositionAlgorithm.Result mClockPosition;


    private MockitoSession mStaticMockSession;
    private MockitoSession mStaticMockSession;
    private int mNotificationStackHeight;


    private float mPanelExpansion;
    private float mPanelExpansion;
    private int mKeyguardStatusBarHeaderHeight;
    private int mKeyguardStatusBarHeaderHeight;
@@ -263,6 +262,30 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
        assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
        assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
    }
    }


    @Test
    public void notifPaddingExpandedAlignedWithClockInSplitShadeMode() {
        givenLockScreen();
        mIsSplitShade = true;
        mKeyguardStatusHeight = 200;
        // WHEN the position algorithm is run
        positionClock();
        // THEN the padding DOESN'T adjust for keyguard status height.
        assertThat(mClockPosition.stackScrollerPaddingExpanded)
                .isEqualTo(mClockPosition.clockYFullyDozing);
    }

    @Test
    public void notifMinPaddingAlignedWithClockInSplitShadeMode() {
        givenLockScreen();
        mIsSplitShade = true;
        mKeyguardStatusHeight = 200;
        // WHEN the position algorithm is run
        positionClock();
        // THEN the padding DOESN'T adjust for keyguard status height.
        assertThat(mClockPositionAlgorithm.getMinStackScrollerPadding())
                .isEqualTo(mKeyguardStatusBarHeaderHeight);
    }

    @Test
    @Test
    public void notifPositionWithLargeClockOnLockScreen() {
    public void notifPositionWithLargeClockOnLockScreen() {
        // GIVEN on lock screen and clock has a nonzero height
        // GIVEN on lock screen and clock has a nonzero height