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

Commit 715a2fef authored by Steve Elliott's avatar Steve Elliott Committed by Android (Google) Code Review
Browse files

Merge "Fix NotifKeyguardViewStateRepo#isPulseExpanding" into main

parents 2da52230 f68c0a15
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -393,7 +393,6 @@ object KeyguardRootViewBinder {
        iconsAppearTranslationPx: Int,
        screenOffAnimationController: ScreenOffAnimationController,
    ) {
        val statusViewMigrated = KeyguardShadeMigrationNssl.isEnabled
        animate().cancel()
        val animatorListener =
            object : AnimatorListenerAdapter() {
@@ -404,13 +403,13 @@ object KeyguardRootViewBinder {
        when {
            !isVisible.isAnimating -> {
                alpha = 1f
                if (!statusViewMigrated) {
                if (!KeyguardShadeMigrationNssl.isEnabled) {
                    translationY = 0f
                }
                visibility = if (isVisible.value) View.VISIBLE else View.INVISIBLE
            }
            newAodTransition() -> {
                animateInIconTranslation(statusViewMigrated)
                animateInIconTranslation()
                if (isVisible.value) {
                    CrossFadeHelper.fadeIn(this, animatorListener)
                } else {
@@ -419,7 +418,7 @@ object KeyguardRootViewBinder {
            }
            !isVisible.value -> {
                // Let's make sure the icon are translated to 0, since we cancelled it above
                animateInIconTranslation(statusViewMigrated)
                animateInIconTranslation()
                CrossFadeHelper.fadeOut(this, animatorListener)
            }
            visibility != View.VISIBLE -> {
@@ -429,13 +428,12 @@ object KeyguardRootViewBinder {
                appearIcons(
                    animate = screenOffAnimationController.shouldAnimateAodIcons(),
                    iconsAppearTranslationPx,
                    statusViewMigrated,
                    animatorListener,
                )
            }
            else -> {
                // Let's make sure the icons are translated to 0, since we cancelled it above
                animateInIconTranslation(statusViewMigrated)
                animateInIconTranslation()
                // We were fading out, let's fade in instead
                CrossFadeHelper.fadeIn(this, animatorListener)
            }
@@ -445,11 +443,10 @@ object KeyguardRootViewBinder {
    private fun View.appearIcons(
        animate: Boolean,
        iconAppearTranslation: Int,
        statusViewMigrated: Boolean,
        animatorListener: Animator.AnimatorListener,
    ) {
        if (animate) {
            if (!statusViewMigrated) {
            if (!KeyguardShadeMigrationNssl.isEnabled) {
                translationY = -iconAppearTranslation.toFloat()
            }
            alpha = 0f
@@ -457,19 +454,19 @@ object KeyguardRootViewBinder {
                .alpha(1f)
                .setInterpolator(Interpolators.LINEAR)
                .setDuration(AOD_ICONS_APPEAR_DURATION)
                .apply { if (statusViewMigrated) animateInIconTranslation() }
                .apply { if (KeyguardShadeMigrationNssl.isEnabled) animateInIconTranslation() }
                .setListener(animatorListener)
                .start()
        } else {
            alpha = 1.0f
            if (!statusViewMigrated) {
            if (!KeyguardShadeMigrationNssl.isEnabled) {
                translationY = 0f
            }
        }
    }

    private fun View.animateInIconTranslation(statusViewMigrated: Boolean) {
        if (!statusViewMigrated) {
    private fun View.animateInIconTranslation() {
        if (!KeyguardShadeMigrationNssl.isEnabled) {
            animate().animateInIconTranslation().setDuration(AOD_ICONS_APPEAR_DURATION).start()
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -1096,7 +1096,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            }

            @Override
            public void onPulseExpansionChanged(boolean expandingChanged) {
            public void onPulseExpansionAmountChanged(boolean expandingChanged) {
                if (mKeyguardBypassController.getBypassEnabled()) {
                    // Position the notifications while dragging down while pulsing
                    requestScrollerTopPaddingUpdate(false /* animate */);
+19 −4
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@ import android.util.FloatProperty
import android.view.animation.Interpolator
import androidx.annotation.VisibleForTesting
import androidx.core.animation.ObjectAnimator
import com.android.systemui.Dumpable
import com.android.app.animation.Interpolators
import com.android.app.animation.InterpolatorsAndroidX
import com.android.systemui.Dumpable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -31,6 +31,7 @@ import com.android.systemui.shade.ShadeExpansionListener
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.shared.NotificationIconContainerRefactor
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
import com.android.systemui.statusbar.phone.DozeParameters
@@ -206,8 +207,15 @@ constructor(
            val nowExpanding = isPulseExpanding()
            val changed = nowExpanding != pulseExpanding
            pulseExpanding = nowExpanding
            if (!NotificationIconContainerRefactor.isEnabled) {
                for (listener in wakeUpListeners) {
                    listener.onPulseExpansionAmountChanged(changed)
                }
            }
            if (changed) {
                for (listener in wakeUpListeners) {
                listener.onPulseExpansionChanged(changed)
                    listener.onPulseExpandingChanged(pulseExpanding)
                }
            }
        }
    }
@@ -620,13 +628,20 @@ constructor(
         *
         * @param expandingChanged if the user has started or stopped expanding
         */
        fun onPulseExpansionChanged(expandingChanged: Boolean) {}
        @Deprecated(
            message = "Use onPulseExpandedChanged instead.",
            replaceWith = ReplaceWith("onPulseExpandedChanged"),
        )
        fun onPulseExpansionAmountChanged(expandingChanged: Boolean) {}

        /**
         * Called when the animator started by [scheduleDelayedDozeAmountAnimation] begins running
         * after the start delay, or after it ends/is cancelled.
         */
        fun onDelayedDozeAmountAnimationRunning(running: Boolean) {}

        /** Called whenever a pulse has started or stopped expanding. */
        fun onPulseExpandingChanged(isPulseExpanding: Boolean) {}
    }

    companion object {
+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ constructor(
    override val isPulseExpanding: Flow<Boolean> = conflatedCallbackFlow {
        val listener =
            object : NotificationWakeUpCoordinator.WakeUpListener {
                override fun onPulseExpansionChanged(expandingChanged: Boolean) {
                    trySend(expandingChanged)
                override fun onPulseExpandingChanged(isPulseExpanding: Boolean) {
                    trySend(isPulseExpanding)
                }
            }
        trySend(wakeUpCoordinator.isPulseExpanding())
+1 −1
Original line number Diff line number Diff line
@@ -608,7 +608,7 @@ public class LegacyNotificationIconAreaControllerImpl implements
    }

    @Override
    public void onPulseExpansionChanged(boolean expandingChanged) {
    public void onPulseExpansionAmountChanged(boolean expandingChanged) {
        if (expandingChanged) {
            updateAodIconsVisibility(true /* animate */, false /* force */);
        }
Loading