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

Commit 10d4771d authored by Andreas Miko's avatar Andreas Miko
Browse files

Make AOD transitions more calm

- Disable unfurling of notifications and alpha blend them instead
- Fix alpha blend of notifications when there is a pulsing notification active
- Make notification icons animate in/out
- Fix alpha blend of LockIconView
- Make KeyguardBottomArea fade out
- Add new flag NEW_AOD_TRANSITION

Spec: https://direct.googleplex.com/#/spec/285230003
Bug: b/290738624
Test: atest NotificationStackScrollLayoutTest StackScrollAlgorithmTest
Change-Id: If44c2088598c4a5bb954149c412050c6cb1a1f54
parent 39da75ad
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@ package com.android.keyguard;

import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;

import static com.android.keyguard.LockIconView.ICON_FINGERPRINT;
import static com.android.keyguard.LockIconView.ICON_LOCK;
import static com.android.keyguard.LockIconView.ICON_UNLOCK;
import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
import static com.android.systemui.flags.Flags.DOZING_MIGRATION_1;
import static com.android.systemui.flags.Flags.LOCKSCREEN_WALLPAPER_DREAM_ENABLED;
import static com.android.systemui.flags.Flags.NEW_AOD_TRANSITION;
import static com.android.systemui.flags.Flags.ONE_WAY_HAPTICS_API_MIGRATION;
import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow;

@@ -97,6 +99,8 @@ public class LockIconViewController implements Dumpable {
    private static final VibrationAttributes TOUCH_VIBRATION_ATTRIBUTES =
            VibrationAttributes.createForUsage(VibrationAttributes.USAGE_TOUCH);

    private static final long FADE_OUT_DURATION_MS = 250L;

    private final long mLongPressTimeout;
    @NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    @NonNull private final KeyguardViewController mKeyguardViewController;
@@ -386,6 +390,16 @@ public class LockIconViewController implements Dumpable {
            mView.updateIcon(ICON_LOCK, true);
            mView.setContentDescription(mLockedLabel);
            mView.setVisibility(View.VISIBLE);
        } else if (mIsDozing && mFeatureFlags.isEnabled(NEW_AOD_TRANSITION)) {
            mView.animate()
                    .alpha(0f)
                    .setDuration(FADE_OUT_DURATION_MS)
                    .withEndAction(() -> {
                        mView.clearIcon();
                        mView.setVisibility(View.INVISIBLE);
                        mView.setContentDescription(null);
                    })
                    .start();
        } else {
            mView.clearIcon();
            mView.setVisibility(View.INVISIBLE);
+4 −0
Original line number Diff line number Diff line
@@ -180,6 +180,10 @@ object Flags {
    @JvmField
    val LIGHT_REVEAL_MIGRATION = unreleasedFlag("light_reveal_migration", teamfood = false)

    // TODO(b/301915812): Tracking Bug
    @JvmField
    val NEW_AOD_TRANSITION = unreleasedFlag("new_aod_transition", teamfood = false)

    /** Flag to control the migration of face auth to modern architecture. */
    // TODO(b/262838215): Tracking bug
    @JvmField val FACE_AUTH_REFACTOR = unreleasedFlag("face_auth_refactor", teamfood = true)
+8 −3
Original line number Diff line number Diff line
@@ -132,7 +132,14 @@ object KeyguardQuickAffordanceViewBinder {
        vibratorHelper: VibratorHelper?,
    ) {
        if (!viewModel.isVisible) {
            view.isInvisible = true
            view.alpha = 1f
            view
                    .animate()
                    .alpha(0f)
                    .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN)
                    .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS)
                    .withEndAction { view.isInvisible = true }
                    .start()
            return
        }

@@ -140,11 +147,9 @@ object KeyguardQuickAffordanceViewBinder {
            view.isVisible = true
            if (viewModel.animateReveal) {
                view.alpha = 0f
                view.translationY = view.height / 2f
                view
                    .animate()
                    .alpha(1f)
                    .translationY(0f)
                    .setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN)
                    .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS)
                    .start()
+32 −17
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.demomode.DemoMode
import com.android.systemui.demomode.DemoModeController
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags.NEW_AOD_TRANSITION
import com.android.systemui.flags.ViewRefactorFlag
import com.android.systemui.plugins.DarkIconDispatcher
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -88,7 +89,7 @@ constructor(
    private val bubblesOptional: Optional<Bubbles>,
    demoModeController: DemoModeController,
    darkIconDispatcher: DarkIconDispatcher,
    featureFlags: FeatureFlags,
    private val featureFlags: FeatureFlags,
    private val statusBarWindowController: StatusBarWindowController,
    private val screenOffAnimationController: ScreenOffAnimationController,
    private val shelfIconsViewModel: NotificationIconContainerShelfViewModel,
@@ -294,10 +295,13 @@ constructor(
        var animate = true
        if (!bypassController.bypassEnabled) {
            animate = dozeParameters.alwaysOn && !dozeParameters.displayNeedsBlanking
            // We only want the appear animations to happen when the notifications get fully hidden,
            if (!featureFlags.isEnabled(NEW_AOD_TRANSITION)) {
                // We only want the appear animations to happen when the notifications get fully
                // hidden,
                // since otherwise the unhide animation overlaps
                animate = animate and isFullyHidden
            }
        }
        updateAodIconsVisibility(animate, false /* force */)
        updateAodNotificationIcons()
        updateAodIconColors()
@@ -650,6 +654,15 @@ constructor(
            aodIconsVisible = visible
            aodIcons!!.animate().cancel()
            if (animate) {
                if (featureFlags.isEnabled(NEW_AOD_TRANSITION)) {
                    // Let's make sure the icon are translated to 0, since we cancelled it above
                    animateInAodIconTranslation()
                    if (aodIconsVisible) {
                        CrossFadeHelper.fadeIn(aodIcons)
                    } else {
                        CrossFadeHelper.fadeOut(aodIcons)
                    }
                } else {
                    val wasFullyInvisible = aodIcons!!.visibility != View.VISIBLE
                    if (aodIconsVisible) {
                        if (wasFullyInvisible) {
@@ -658,7 +671,8 @@ constructor(
                            aodIcons!!.alpha = 1.0f
                            appearAodIcons()
                        } else {
                        // Let's make sure the icon are translated to 0, since we cancelled it above
                            // Let's make sure the icon are translated to 0, since we cancelled it
                            // above
                            animateInAodIconTranslation()
                            // We were fading out, let's fade in instead
                            CrossFadeHelper.fadeIn(aodIcons)
@@ -668,6 +682,7 @@ constructor(
                        animateInAodIconTranslation()
                        CrossFadeHelper.fadeOut(aodIcons)
                    }
                }
            } else {
                aodIcons!!.alpha = 1.0f
                aodIcons!!.translationY = 0f
+1 −0
Original line number Diff line number Diff line
@@ -772,6 +772,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    /**
     * @return if the view is in heads up state, i.e either still heads upped or it's disappearing.
     */
    @Override
    public boolean isHeadsUpState() {
        return mIsHeadsUp || mHeadsupDisappearRunning;
    }
Loading