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

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

Merge "Properly fixing expansion state in lockscreen to shade transition" into...

Merge "Properly fixing expansion state in lockscreen to shade transition" into tm-qpr-dev am: b8b70b0a am: 66f4ed26

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



Change-Id: Ic297f822a1ea724d2836d0d914bb1bd42ea97690
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 18caf443 66f4ed26
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -309,9 +309,12 @@ public class KeyguardClockPositionAlgorithm {
     */
     */
    private float getClockAlpha(int y) {
    private float getClockAlpha(int y) {
        float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f, mDarkAmount)));
        float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f, mDarkAmount)));
        if (!mIsSplitShade) {
            // in split shade QS are always expanded so this factor shouldn't apply
            float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
            float qsAlphaFactor = MathUtils.saturate(mQsExpansion / 0.3f);
            qsAlphaFactor = 1f - qsAlphaFactor;
            qsAlphaFactor = 1f - qsAlphaFactor;
            alphaKeyguard *= qsAlphaFactor;
            alphaKeyguard *= qsAlphaFactor;
        }
        alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
        alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
        return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
        return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
    }
    }
+19 −8
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
import static com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManagerKt.STATE_CLOSED;
import static com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManagerKt.STATE_CLOSED;
@@ -2703,8 +2704,8 @@ public class NotificationPanelViewController extends PanelViewController {
    }
    }


    private float calculateNotificationsTopPadding() {
    private float calculateNotificationsTopPadding() {
        if (mSplitShadeEnabled && !mKeyguardShowing) {
        if (mSplitShadeEnabled) {
            return 0;
            return mKeyguardShowing ? getKeyguardNotificationStaticPadding() : 0;
        }
        }
        if (mKeyguardShowing && (mQsExpandImmediate
        if (mKeyguardShowing && (mQsExpandImmediate
                || mIsExpanding && mQsExpandedWhenExpandingStarted)) {
                || mIsExpanding && mQsExpandedWhenExpandingStarted)) {
@@ -2778,6 +2779,9 @@ public class NotificationPanelViewController extends PanelViewController {
            mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
            mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
        }
        }


        if (mSplitShadeEnabled) {
            updateQsExpansionForLockscreenToShadeTransition(pxAmount);
        }
        float endPosition = 0;
        float endPosition = 0;
        if (pxAmount > 0.0f) {
        if (pxAmount > 0.0f) {
            if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
            if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
@@ -2817,6 +2821,18 @@ public class NotificationPanelViewController extends PanelViewController {
        updateQsExpansion();
        updateQsExpansion();
    }
    }


    private void updateQsExpansionForLockscreenToShadeTransition(float pxAmount) {
        float qsExpansion = 0;
        if (pxAmount > 0.0f) {
            qsExpansion = MathUtils.lerp(mQsMinExpansionHeight, mQsMaxExpansionHeight,
                    mLockscreenShadeTransitionController.getQSDragProgress());
        }
        // SHADE_LOCKED means transition is over and we don't want further updates
        if (mBarState != SHADE_LOCKED) {
            setQsExpansion(qsExpansion);
        }
    }

    /**
    /**
     * Notify the panel that the pulse expansion has finished and that we're going to the full
     * Notify the panel that the pulse expansion has finished and that we're going to the full
     * shade
     * shade
@@ -3020,7 +3036,7 @@ public class NotificationPanelViewController extends PanelViewController {
        }
        }
        int maxHeight;
        int maxHeight;
        if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
        if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
                || mPulsing) {
                || mPulsing || mSplitShadeEnabled) {
            maxHeight = calculatePanelHeightQsExpanded();
            maxHeight = calculatePanelHeightQsExpanded();
        } else {
        } else {
            maxHeight = calculatePanelHeightShade();
            maxHeight = calculatePanelHeightShade();
@@ -4769,11 +4785,6 @@ public class NotificationPanelViewController extends PanelViewController {
                    duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
                    duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
                }
                }
                mKeyguardStatusBarViewController.animateKeyguardStatusBarOut(startDelay, duration);
                mKeyguardStatusBarViewController.animateKeyguardStatusBarOut(startDelay, duration);
                if (mSplitShadeEnabled) {
                    // temporary workaround for QS height not being updated during lockscreen to
                    // shade transition
                    setQsExpanded(true);
                }
                updateQSMinHeight();
                updateQSMinHeight();
            } else if (oldState == StatusBarState.SHADE_LOCKED
            } else if (oldState == StatusBarState.SHADE_LOCKED
                    && statusBarState == KEYGUARD) {
                    && statusBarState == KEYGUARD) {
+16 −4
Original line number Original line Diff line number Diff line
@@ -266,7 +266,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
    @Test
    @Test
    public void clockPositionedDependingOnMarginInSplitShade() {
    public void clockPositionedDependingOnMarginInSplitShade() {
        setSplitShadeTopMargin(400);
        setSplitShadeTopMargin(400);
        mClockPositionAlgorithm.loadDimens(mResources);
        givenLockScreen();
        givenLockScreen();
        mIsSplitShade = true;
        mIsSplitShade = true;
        // WHEN the position algorithm is run
        // WHEN the position algorithm is run
@@ -294,7 +293,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
    public void notifPaddingAccountsForMultiUserSwitcherInSplitShade() {
    public void notifPaddingAccountsForMultiUserSwitcherInSplitShade() {
        setSplitShadeTopMargin(100);
        setSplitShadeTopMargin(100);
        mUserSwitchHeight = 150;
        mUserSwitchHeight = 150;
        mClockPositionAlgorithm.loadDimens(mResources);
        givenLockScreen();
        givenLockScreen();
        mIsSplitShade = true;
        mIsSplitShade = true;
        // WHEN the position algorithm is run
        // WHEN the position algorithm is run
@@ -307,7 +305,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
    public void clockDoesntAccountForMultiUserSwitcherInSplitShade() {
    public void clockDoesntAccountForMultiUserSwitcherInSplitShade() {
        setSplitShadeTopMargin(100);
        setSplitShadeTopMargin(100);
        mUserSwitchHeight = 150;
        mUserSwitchHeight = 150;
        mClockPositionAlgorithm.loadDimens(mResources);
        givenLockScreen();
        givenLockScreen();
        mIsSplitShade = true;
        mIsSplitShade = true;
        // WHEN the position algorithm is run
        // WHEN the position algorithm is run
@@ -382,10 +379,24 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
        mQsExpansion = 1;
        mQsExpansion = 1;
        // WHEN the clock position algorithm is run
        // WHEN the clock position algorithm is run
        positionClock();
        positionClock();
        // THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
        // THEN the clock is transparent.
        assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
        assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
    }
    }


    @Test
    public void clockNotHiddenWhenQsIsExpandedInSplitShade() {
        // GIVEN on the split lock screen with QS expansion
        givenLockScreen();
        mIsSplitShade = true;
        setSplitShadeTopMargin(100);
        mQsExpansion = 1;

        // WHEN the clock position algorithm is run
        positionClock();

        assertThat(mClockPosition.clockAlpha).isEqualTo(1);
    }

    @Test
    @Test
    public void clockPositionMinimizesBurnInMovementToAvoidUdfpsOnAOD() {
    public void clockPositionMinimizesBurnInMovementToAvoidUdfpsOnAOD() {
        // GIVEN a center aligned clock
        // GIVEN a center aligned clock
@@ -524,6 +535,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
    private void setSplitShadeTopMargin(int value) {
    private void setSplitShadeTopMargin(int value) {
        when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
        when(mResources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin))
                .thenReturn(value);
                .thenReturn(value);
        mClockPositionAlgorithm.loadDimens(mResources);
    }
    }


    private void givenHighestBurnInOffset() {
    private void givenHighestBurnInOffset() {