Merge "AuthRipple should always animate lightReveal on auth" into tm-dev

This commit is contained in:
Beverly Tai
2022-04-12 16:52:37 +00:00
committed by Android (Google) Code Review
4 changed files with 16 additions and 9 deletions

View File

@@ -145,6 +145,7 @@ class AuthRippleController @Inject constructor(
val lightRevealScrim = centralSurfaces.lightRevealScrim
if (statusBarStateController.isDozing || biometricUnlockController.isWakeAndUnlock) {
circleReveal?.let {
lightRevealScrim?.revealAmount = 0f
lightRevealScrim?.revealEffect = it
startLightRevealScrimOnKeyguardFadingAway = true
}
@@ -168,7 +169,8 @@ class AuthRippleController @Inject constructor(
startDelay = keyguardStateController.keyguardFadingAwayDelay
addUpdateListener { animator ->
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
}
lightRevealScrim.revealAmount = animator.animatedValue as Float

View File

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

View File

@@ -4404,8 +4404,7 @@ public class CentralSurfaces extends CoreStartable implements
@Override
public void onDozeAmountChanged(float linear, float eased) {
if (mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ANIMATIONS)
&& !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)
&& !mBiometricUnlockController.isWakeAndUnlock()) {
&& !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) {
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.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.statusbar.CircleReveal
import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.StatusBarStateControllerImpl
@@ -85,7 +86,9 @@ class UnlockedScreenOffAnimationController @Inject constructor(
duration = LIGHT_REVEAL_ANIMATION_DURATION
interpolator = Interpolators.LINEAR
addUpdateListener {
lightRevealScrim.revealAmount = it.animatedValue as Float
if (lightRevealScrim.revealEffect !is CircleReveal) {
lightRevealScrim.revealAmount = it.animatedValue as Float
}
if (lightRevealScrim.isScrimAlmostOccludes &&
interactionJankMonitor.isInstrumenting(CUJ_SCREEN_OFF)) {
// ends the instrument when the scrim almost occludes the screen.
@@ -95,9 +98,9 @@ class UnlockedScreenOffAnimationController @Inject constructor(
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationCancel(animation: Animator?) {
lightRevealScrim.revealAmount = 1f
lightRevealAnimationPlaying = false
interactionJankMonitor.cancel(CUJ_SCREEN_OFF)
if (lightRevealScrim.revealEffect !is CircleReveal) {
lightRevealScrim.revealAmount = 1f
}
}
override fun onAnimationEnd(animation: Animator?) {