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

Commit 56b6645a authored by Caitlin Cassidy's avatar Caitlin Cassidy Committed by Android (Google) Code Review
Browse files

Merge "[Status Bar Refactor] 2.2/N: Migrate StatusBar's panelExpansionChanged...

Merge "[Status Bar Refactor] 2.2/N: Migrate StatusBar's panelExpansionChanged callback to the correct listener interface." into sc-v2-dev
parents 3f481ef0 b3a74270
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -329,7 +329,9 @@ class NotificationShadeDepthController @Inject constructor(
    /**
    /**
     * Update blurs when pulling down the shade
     * Update blurs when pulling down the shade
     */
     */
    override fun onPanelExpansionChanged(rawFraction: Float, tracking: Boolean) {
    override fun onPanelExpansionChanged(
        rawFraction: Float, expanded: Boolean, tracking: Boolean
    ) {
        val timestamp = SystemClock.elapsedRealtimeNanos()
        val timestamp = SystemClock.elapsedRealtimeNanos()
        val expansion = MathUtils.saturate(
        val expansion = MathUtils.saturate(
                (rawFraction - panelPullDownMinFraction) / (1f - panelPullDownMinFraction))
                (rawFraction - panelPullDownMinFraction) / (1f - panelPullDownMinFraction))
+1 −1
Original line number Original line Diff line number Diff line
@@ -294,7 +294,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
        this.state = newState
        this.state = newState
    }
    }


    override fun onPanelExpansionChanged(fraction: Float, tracking: Boolean) {
    override fun onPanelExpansionChanged(fraction: Float, expanded: Boolean, tracking: Boolean) {
        val collapsedEnough = fraction <= 0.9f
        val collapsedEnough = fraction <= 0.9f
        if (collapsedEnough != this.collapsedEnoughToHide) {
        if (collapsedEnough != this.collapsedEnoughToHide) {
            val couldShowPulsingHuns = canShowPulsingHuns
            val couldShowPulsingHuns = canShowPulsingHuns
+2 −1
Original line number Original line Diff line number Diff line
@@ -1093,7 +1093,8 @@ public abstract class PanelViewController {
            mBar.panelExpansionChanged(mExpandedFraction, isExpanded());
            mBar.panelExpansionChanged(mExpandedFraction, isExpanded());
        }
        }
        updateVisibility();
        updateVisibility();
        mPanelExpansionStateManager.onPanelExpansionChanged(mExpandedFraction, mTracking);
        mPanelExpansionStateManager.onPanelExpansionChanged(
                mExpandedFraction, isExpanded(), mTracking);
    }
    }


    public boolean isExpanded() {
    public boolean isExpanded() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -272,7 +272,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            }
            }
        });
        });
        panelExpansionStateManager.addListener(
        panelExpansionStateManager.addListener(
                (fraction, tracking) -> setRawPanelExpansionFraction(fraction)
                (fraction, expanded, tracking) -> setRawPanelExpansionFraction(fraction)
        );
        );


        mColors = new GradientColors();
        mColors = new GradientColors();
+11 −11
Original line number Original line Diff line number Diff line
@@ -909,7 +909,7 @@ public class StatusBar extends SystemUI implements
        lockscreenShadeTransitionController.setStatusbar(this);
        lockscreenShadeTransitionController.setStatusbar(this);


        mExpansionChangedListeners = new ArrayList<>();
        mExpansionChangedListeners = new ArrayList<>();
        addExpansionChangedListener(this::onPanelExpansionChanged);
        mPanelExpansionStateManager.addListener(this::onPanelExpansionChanged);


        mBubbleExpandListener =
        mBubbleExpandListener =
                (isExpanding, key) -> mContext.getMainExecutor().execute(() -> {
                (isExpanding, key) -> mContext.getMainExecutor().execute(() -> {
@@ -1158,8 +1158,6 @@ public class StatusBar extends SystemUI implements


        mNotificationIconAreaController.setupShelf(mNotificationShelfController);
        mNotificationIconAreaController.setupShelf(mNotificationShelfController);
        mPanelExpansionStateManager.addListener(mWakeUpCoordinator);
        mPanelExpansionStateManager.addListener(mWakeUpCoordinator);
        mPanelExpansionStateManager.addListener(
                this::dispatchPanelExpansionForKeyguardDismiss);


        mUserSwitcherController.init(mNotificationShadeWindowView);
        mUserSwitcherController.init(mNotificationShadeWindowView);


@@ -1424,15 +1422,15 @@ public class StatusBar extends SystemUI implements




    /**
    /**
     * When swiping up to dismiss the lock screen, the panel expansion goes from 1f to 0f. This
     * When swiping up to dismiss the lock screen, the panel expansion fraction goes from 1f to 0f.
     * results in the clock/notifications/other content disappearing off the top of the screen.
     * This results in the clock/notifications/other content disappearing off the top of the screen.
     *
     *
     * We also use the expansion amount to animate in the app/launcher surface from the bottom of
     * We also use the expansion fraction to animate in the app/launcher surface from the bottom of
     * the screen, 'pushing' off the notifications and other content. To do this, we dispatch the
     * the screen, 'pushing' off the notifications and other content. To do this, we dispatch the
     * expansion amount to the KeyguardViewMediator if we're in the process of dismissing the
     * expansion fraction to the KeyguardViewMediator if we're in the process of dismissing the
     * keyguard.
     * keyguard.
     */
     */
    private void dispatchPanelExpansionForKeyguardDismiss(float expansion, boolean trackingTouch) {
    private void dispatchPanelExpansionForKeyguardDismiss(float fraction, boolean trackingTouch) {
        // Things that mean we're not dismissing the keyguard, and should ignore this expansion:
        // Things that mean we're not dismissing the keyguard, and should ignore this expansion:
        // - Keyguard isn't even visible.
        // - Keyguard isn't even visible.
        // - Keyguard is visible, but can't be dismissed (swiping up will show PIN/password prompt).
        // - Keyguard is visible, but can't be dismissed (swiping up will show PIN/password prompt).
@@ -1451,12 +1449,14 @@ public class StatusBar extends SystemUI implements
                || mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehindOrWillBe()
                || mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehindOrWillBe()
                || mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
                || mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
            mKeyguardStateController.notifyKeyguardDismissAmountChanged(
            mKeyguardStateController.notifyKeyguardDismissAmountChanged(
                    1f - expansion, trackingTouch);
                    1f - fraction, trackingTouch);
        }
        }
    }
    }


    private void onPanelExpansionChanged(float frac, boolean expanded) {
    private void onPanelExpansionChanged(float fraction, boolean expanded, boolean tracking) {
        if (frac == 0 || frac == 1) {
        dispatchPanelExpansionForKeyguardDismiss(fraction, tracking);

        if (fraction == 0 || fraction == 1) {
            if (getNavigationBarView() != null) {
            if (getNavigationBarView() != null) {
                getNavigationBarView().onStatusBarPanelStateChanged();
                getNavigationBarView().onStatusBarPanelStateChanged();
            }
            }
Loading