AuthRipple should always animate lightReveal on auth

- AuthRipple animates light reveal even when the
device is going to sleep.
- If another light reveal effect has taken over, then
the auth ripple should immediately cancel its animation
so that subsequent authentications within that time aren't
taken over by a stale animator (and so the stale animator
isn't needlessly animating)
- Before setting the reveal effect to the circle effect,
immediately reset the revealAmount to 0 so we start with
a clean black screen rather than flashing before resetting.
- Add reveal amount to the trace (which will be an int value between
0 and 100, where 0 represents revealAmount=0 and 100 is revealAmount=1f)

Test: manually authenticate with rear FP when device is going to sleep +
repeat
Fixes: 228092241

Change-Id: Iaea613fd542404077dc77bad91e4717188015cb6
This commit is contained in:
Beverly
2022-04-06 14:28:47 +00:00
committed by Beverly Tai
parent dd0a8fb689
commit d0fe039ac2
4 changed files with 16 additions and 9 deletions

View File

@@ -145,6 +145,7 @@ class AuthRippleController @Inject constructor(
val lightRevealScrim = centralSurfaces.lightRevealScrim val lightRevealScrim = centralSurfaces.lightRevealScrim
if (statusBarStateController.isDozing || biometricUnlockController.isWakeAndUnlock) { if (statusBarStateController.isDozing || biometricUnlockController.isWakeAndUnlock) {
circleReveal?.let { circleReveal?.let {
lightRevealScrim?.revealAmount = 0f
lightRevealScrim?.revealEffect = it lightRevealScrim?.revealEffect = it
startLightRevealScrimOnKeyguardFadingAway = true startLightRevealScrimOnKeyguardFadingAway = true
} }
@@ -168,7 +169,8 @@ class AuthRippleController @Inject constructor(
startDelay = keyguardStateController.keyguardFadingAwayDelay startDelay = keyguardStateController.keyguardFadingAwayDelay
addUpdateListener { animator -> addUpdateListener { animator ->
if (lightRevealScrim.revealEffect != circleReveal) { if (lightRevealScrim.revealEffect != circleReveal) {
// if something else took over the reveal, let's do nothing. // if something else took over the reveal, let's cancel ourselves
cancel()
return@addUpdateListener return@addUpdateListener
} }
lightRevealScrim.revealAmount = animator.animatedValue as Float lightRevealScrim.revealAmount = animator.animatedValue as Float

View File

@@ -11,6 +11,7 @@ import android.graphics.PorterDuffColorFilter
import android.graphics.PorterDuffXfermode import android.graphics.PorterDuffXfermode
import android.graphics.RadialGradient import android.graphics.RadialGradient
import android.graphics.Shader import android.graphics.Shader
import android.os.Trace
import android.util.AttributeSet import android.util.AttributeSet
import android.util.MathUtils.lerp import android.util.MathUtils.lerp
import android.view.View import android.view.View
@@ -222,6 +223,8 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
revealEffect.setRevealAmountOnScrim(value, this) revealEffect.setRevealAmountOnScrim(value, this)
updateScrimOpaque() updateScrimOpaque()
Trace.traceCounter(Trace.TRACE_TAG_APP, "light_reveal_amount",
(field * 100).toInt())
invalidate() invalidate()
} }
} }
@@ -355,8 +358,8 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
} }
override fun onDraw(canvas: Canvas?) { override fun onDraw(canvas: Canvas?) {
if (canvas == null || revealGradientWidth <= 0 || revealGradientHeight <= 0 if (canvas == null || revealGradientWidth <= 0 || revealGradientHeight <= 0 ||
|| revealAmount == 0f) { revealAmount == 0f) {
if (revealAmount < 1f) { if (revealAmount < 1f) {
canvas?.drawColor(revealGradientEndColor) canvas?.drawColor(revealGradientEndColor)
} }

View File

@@ -4404,8 +4404,7 @@ public class CentralSurfaces extends CoreStartable implements
@Override @Override
public void onDozeAmountChanged(float linear, float eased) { public void onDozeAmountChanged(float linear, float eased) {
if (mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ANIMATIONS) if (mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ANIMATIONS)
&& !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal) && !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) {
&& !mBiometricUnlockController.isWakeAndUnlock()) {
mLightRevealScrim.setRevealAmount(1f - linear); mLightRevealScrim.setRevealAmount(1f - linear);
} }
} }

View File

@@ -17,6 +17,7 @@ import com.android.systemui.animation.Interpolators
import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.statusbar.CircleReveal
import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.StatusBarStateControllerImpl import com.android.systemui.statusbar.StatusBarStateControllerImpl
@@ -79,7 +80,9 @@ class UnlockedScreenOffAnimationController @Inject constructor(
duration = LIGHT_REVEAL_ANIMATION_DURATION duration = LIGHT_REVEAL_ANIMATION_DURATION
interpolator = Interpolators.LINEAR interpolator = Interpolators.LINEAR
addUpdateListener { addUpdateListener {
if (lightRevealScrim.revealEffect !is CircleReveal) {
lightRevealScrim.revealAmount = it.animatedValue as Float lightRevealScrim.revealAmount = it.animatedValue as Float
}
if (lightRevealScrim.isScrimAlmostOccludes && if (lightRevealScrim.isScrimAlmostOccludes &&
interactionJankMonitor.isInstrumenting(CUJ_SCREEN_OFF)) { interactionJankMonitor.isInstrumenting(CUJ_SCREEN_OFF)) {
// ends the instrument when the scrim almost occludes the screen. // ends the instrument when the scrim almost occludes the screen.
@@ -89,9 +92,9 @@ class UnlockedScreenOffAnimationController @Inject constructor(
} }
addListener(object : AnimatorListenerAdapter() { addListener(object : AnimatorListenerAdapter() {
override fun onAnimationCancel(animation: Animator?) { override fun onAnimationCancel(animation: Animator?) {
if (lightRevealScrim.revealEffect !is CircleReveal) {
lightRevealScrim.revealAmount = 1f lightRevealScrim.revealAmount = 1f
lightRevealAnimationPlaying = false }
interactionJankMonitor.cancel(CUJ_SCREEN_OFF)
} }
override fun onAnimationEnd(animation: Animator?) { override fun onAnimationEnd(animation: Animator?) {