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

Commit ab193b33 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reformat file before making actual functional change" into main

parents c7467ba2 9fd26dfb
Loading
Loading
Loading
Loading
+93 −78
Original line number Diff line number Diff line
@@ -62,13 +62,15 @@ import javax.inject.Provider
/**
 * Controls two ripple effects:
 * 1. Unlocked ripple: shows when authentication is successful
 *   2. UDFPS dwell ripple: shows when the user has their finger down on the UDFPS area and reacts
 *   to errors and successes
 * 2. UDFPS dwell ripple: shows when the user has their finger down on the UDFPS area and reacts to
 *    errors and successes
 *
 * The ripple uses the accent color of the current theme.
 */
@SysUISingleton
class AuthRippleController @Inject constructor(
class AuthRippleController
@Inject
constructor(
    private val sysuiContext: Context,
    private val authController: AuthController,
    private val configurationController: ConfigurationController,
@@ -92,8 +94,7 @@ class AuthRippleController @Inject constructor(
    KeyguardStateController.Callback,
    WakefulnessLifecycle.Observer {

    @VisibleForTesting
    internal var startLightRevealScrimOnKeyguardFadingAway = false
    @VisibleForTesting internal var startLightRevealScrimOnKeyguardFadingAway = false
    var lightRevealScrimAnimator: ValueAnimator? = null
    var fingerprintSensorLocation: Point? = null
    private var faceSensorLocation: Point? = null
@@ -147,9 +148,11 @@ class AuthRippleController @Inject constructor(
                if (biometricSourceType != null) {
                    showUnlockRippleInternal(biometricSourceType)
                } else {
                    logger.log(TAG,
                    logger.log(
                        TAG,
                        LogLevel.ERROR,
                            "Unexpected scenario where biometricSourceType is null")
                        "Unexpected scenario where biometricSourceType is null"
                    )
                }
            }
        }
@@ -176,8 +179,8 @@ class AuthRippleController @Inject constructor(

    private fun showUnlockRippleInternal(biometricSourceType: BiometricSourceType) {
        val keyguardNotShowing = !keyguardStateController.isShowing
        val unlockNotAllowed = !keyguardUpdateMonitor
                .isUnlockingWithBiometricAllowed(biometricSourceType)
        val unlockNotAllowed =
            !keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(biometricSourceType)
        if (keyguardNotShowing || unlockNotAllowed) {
            logger.notShowingUnlockRipple(keyguardNotShowing, unlockNotAllowed)
            return
@@ -187,7 +190,8 @@ class AuthRippleController @Inject constructor(
        if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
            fingerprintSensorLocation?.let {
                mView.setFingerprintSensorLocation(it, udfpsRadius)
                circleReveal = CircleReveal(
                circleReveal =
                    CircleReveal(
                        it.x,
                        it.y,
                        0,
@@ -202,7 +206,8 @@ class AuthRippleController @Inject constructor(
        } else if (biometricSourceType == BiometricSourceType.FACE) {
            faceSensorLocation?.let {
                mView.setSensorLocation(it)
                circleReveal = CircleReveal(
                circleReveal =
                    CircleReveal(
                        it.x,
                        it.y,
                        0,
@@ -234,9 +239,7 @@ class AuthRippleController @Inject constructor(

        mView.startUnlockedRipple(
            /* end runnable */
            Runnable {
                notificationShadeWindowController.setForcePluginOpen(false, this)
            }
            Runnable { notificationShadeWindowController.setForcePluginOpen(false, this) }
        )
    }

@@ -248,7 +251,8 @@ class AuthRippleController @Inject constructor(
        if (keyguardStateController.isKeyguardFadingAway) {
            if (startLightRevealScrimOnKeyguardFadingAway) {
                lightRevealScrimAnimator?.cancel()
                lightRevealScrimAnimator = ValueAnimator.ofFloat(.1f, 1f).apply {
                lightRevealScrimAnimator =
                    ValueAnimator.ofFloat(.1f, 1f).apply {
                        interpolator = Interpolators.LINEAR_OUT_SLOW_IN
                        duration = RIPPLE_ANIMATION_DURATION
                        startDelay = keyguardStateController.keyguardFadingAwayDelay
@@ -260,9 +264,11 @@ class AuthRippleController @Inject constructor(
                            }
                            lightRevealScrim.revealAmount = animator.animatedValue as Float
                        }
                    addListener(object : AnimatorListenerAdapter() {
                        addListener(
                            object : AnimatorListenerAdapter() {
                                override fun onAnimationEnd(animation: Animator) {
                            // Reset light reveal scrim to the default, so the CentralSurfaces
                                    // Reset light reveal scrim to the default, so the
                                    // CentralSurfaces
                                    // can handle any subsequent light reveal changes
                                    // (ie: from dozing changes)
                                    if (lightRevealScrim.revealEffect == circleReveal) {
@@ -271,7 +277,8 @@ class AuthRippleController @Inject constructor(

                                    lightRevealScrimAnimator = null
                                }
                    })
                            }
                        )
                        start()
                    }
                startLightRevealScrimOnKeyguardFadingAway = false
@@ -297,8 +304,9 @@ class AuthRippleController @Inject constructor(
    }

    private fun updateRippleColor() {
        mView.setLockScreenColor(Utils.getColorAttrDefaultColor(sysuiContext,
                R.attr.wallpaperTextColorAccent))
        mView.setLockScreenColor(
            Utils.getColorAttrDefaultColor(sysuiContext, R.attr.wallpaperTextColorAccent)
        )
    }

    private fun showDwellRipple() {
@@ -331,9 +339,11 @@ class AuthRippleController @Inject constructor(
                biometricSourceType: BiometricSourceType,
                acquireInfo: Int
            ) {
            if (biometricSourceType == BiometricSourceType.FINGERPRINT &&
                if (
                    biometricSourceType == BiometricSourceType.FINGERPRINT &&
                        BiometricFingerprintConstants.shouldDisableUdfpsDisplayMode(acquireInfo) &&
                    acquireInfo != BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_GOOD) {
                        acquireInfo != BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_GOOD
                ) {
                    // received an 'acquiredBad' message, so immediately retract
                    mView.retractDwellRipple()
                }
@@ -351,6 +361,7 @@ class AuthRippleController @Inject constructor(
            override fun onUiModeChanged() {
                updateRippleColor()
            }

            override fun onThemeChanged() {
                updateRippleColor()
            }
@@ -402,9 +413,11 @@ class AuthRippleController @Inject constructor(
                when (args[0]) {
                    "dwell" -> {
                        showDwellRipple()
                        pw.println("lock screen dwell ripple: " +
                        pw.println(
                            "lock screen dwell ripple: " +
                                "\n\tsensorLocation=$fingerprintSensorLocation" +
                                "\n\tudfpsRadius=$udfpsRadius")
                                "\n\tudfpsRadius=$udfpsRadius"
                        )
                    }
                    "fingerprint" -> {
                        pw.println("fingerprint ripple sensorLocation=$fingerprintSensorLocation")
@@ -416,9 +429,11 @@ class AuthRippleController @Inject constructor(
                        showUnlockRippleInternal(BiometricSourceType.FACE)
                    }
                    "custom" -> {
                        if (args.size != 3 ||
                        if (
                            args.size != 3 ||
                                args[1].toFloatOrNull() == null ||
                            args[2].toFloatOrNull() == null) {
                                args[2].toFloatOrNull() == null
                        ) {
                            invalidCommand(pw)
                            return
                        }