Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt +93 −78 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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 Loading Loading @@ -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" ) } } } Loading @@ -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 Loading @@ -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, Loading @@ -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, Loading Loading @@ -234,9 +239,7 @@ class AuthRippleController @Inject constructor( mView.startUnlockedRipple( /* end runnable */ Runnable { notificationShadeWindowController.setForcePluginOpen(false, this) } Runnable { notificationShadeWindowController.setForcePluginOpen(false, this) } ) } Loading @@ -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 Loading @@ -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) { Loading @@ -271,7 +277,8 @@ class AuthRippleController @Inject constructor( lightRevealScrimAnimator = null } }) } ) start() } startLightRevealScrimOnKeyguardFadingAway = false Loading @@ -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() { Loading Loading @@ -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() } Loading @@ -351,6 +361,7 @@ class AuthRippleController @Inject constructor( override fun onUiModeChanged() { updateRippleColor() } override fun onThemeChanged() { updateRippleColor() } Loading Loading @@ -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") Loading @@ -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 } Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt +93 −78 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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 Loading Loading @@ -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" ) } } } Loading @@ -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 Loading @@ -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, Loading @@ -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, Loading Loading @@ -234,9 +239,7 @@ class AuthRippleController @Inject constructor( mView.startUnlockedRipple( /* end runnable */ Runnable { notificationShadeWindowController.setForcePluginOpen(false, this) } Runnable { notificationShadeWindowController.setForcePluginOpen(false, this) } ) } Loading @@ -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 Loading @@ -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) { Loading @@ -271,7 +277,8 @@ class AuthRippleController @Inject constructor( lightRevealScrimAnimator = null } }) } ) start() } startLightRevealScrimOnKeyguardFadingAway = false Loading @@ -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() { Loading Loading @@ -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() } Loading @@ -351,6 +361,7 @@ class AuthRippleController @Inject constructor( override fun onUiModeChanged() { updateRippleColor() } override fun onThemeChanged() { updateRippleColor() } Loading Loading @@ -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") Loading @@ -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 } Loading