Merge "Keep lightRevealEffect and lightRevealAmount up to date" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-11-10 19:01:54 +00:00
committed by Android (Google) Code Review
3 changed files with 37 additions and 17 deletions

View File

@@ -2990,7 +2990,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
/** /**
* Register to receive notifications about general keyguard information * Register to receive notifications about general keyguard information
* (see {@link InfoCallback}. * (see {@link KeyguardUpdateMonitorCallback}.
* *
* @param callback The callback to register * @param callback The callback to register
*/ */

View File

@@ -16,6 +16,8 @@
package com.android.systemui.biometrics package com.android.systemui.biometrics
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.content.Context import android.content.Context
import android.graphics.PointF import android.graphics.PointF
@@ -29,7 +31,9 @@ import com.android.settingslib.Utils
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.animation.Interpolators import com.android.systemui.animation.Interpolators
import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.CircleReveal import com.android.systemui.statusbar.CircleReveal
import com.android.systemui.statusbar.LiftReveal
import com.android.systemui.statusbar.LightRevealEffect import com.android.systemui.statusbar.LightRevealEffect
import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.commandline.Command import com.android.systemui.statusbar.commandline.Command
@@ -41,13 +45,10 @@ import com.android.systemui.statusbar.phone.dagger.StatusBarComponent.StatusBarS
import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.util.ViewController import com.android.systemui.util.ViewController
import com.android.systemui.util.leak.RotationUtils
import java.io.PrintWriter import java.io.PrintWriter
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Provider import javax.inject.Provider
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.util.leak.RotationUtils
private const val WAKE_AND_UNLOCK_FADE_DURATION = 180L
/*** /***
* Controls the ripple effect that shows when authentication is successful. * Controls the ripple effect that shows when authentication is successful.
@@ -141,11 +142,12 @@ class AuthRippleController @Inject constructor(
private fun showUnlockedRipple() { private fun showUnlockedRipple() {
notificationShadeWindowController.setForcePluginOpen(true, this) notificationShadeWindowController.setForcePluginOpen(true, this)
val useCircleReveal = circleReveal != null && biometricUnlockController.isWakeAndUnlock
val lightRevealScrim = statusBar.lightRevealScrim val lightRevealScrim = statusBar.lightRevealScrim
if (useCircleReveal) { if (statusBarStateController.isDozing || biometricUnlockController.isWakeAndUnlock) {
lightRevealScrim?.revealEffect = circleReveal!! circleReveal?.let {
startLightRevealScrimOnKeyguardFadingAway = true lightRevealScrim?.revealEffect = it
startLightRevealScrimOnKeyguardFadingAway = true
}
} }
mView.startUnlockedRipple( mView.startUnlockedRipple(
@@ -160,19 +162,29 @@ class AuthRippleController @Inject constructor(
if (keyguardStateController.isKeyguardFadingAway) { if (keyguardStateController.isKeyguardFadingAway) {
val lightRevealScrim = statusBar.lightRevealScrim val lightRevealScrim = statusBar.lightRevealScrim
if (startLightRevealScrimOnKeyguardFadingAway && lightRevealScrim != null) { if (startLightRevealScrimOnKeyguardFadingAway && lightRevealScrim != null) {
val revealAnimator = ValueAnimator.ofFloat(.1f, 1f).apply { ValueAnimator.ofFloat(.1f, 1f).apply {
interpolator = Interpolators.LINEAR_OUT_SLOW_IN interpolator = Interpolators.LINEAR_OUT_SLOW_IN
duration = RIPPLE_ANIMATION_DURATION duration = RIPPLE_ANIMATION_DURATION
startDelay = keyguardStateController.keyguardFadingAwayDelay startDelay = keyguardStateController.keyguardFadingAwayDelay
addUpdateListener { animator -> addUpdateListener { animator ->
if (lightRevealScrim.revealEffect != circleReveal) { if (lightRevealScrim.revealEffect != circleReveal) {
// if the something else took over the reveal, let's do nothing. // if something else took over the reveal, let's do nothing.
return@addUpdateListener return@addUpdateListener
} }
lightRevealScrim.revealAmount = animator.animatedValue as Float lightRevealScrim.revealAmount = animator.animatedValue as Float
} }
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
// Reset light reveal scrim to the default, so the StatusBar
// can handle any subsequent light reveal changes
// (ie: from dozing changes)
if (lightRevealScrim.revealEffect == circleReveal) {
lightRevealScrim.revealEffect = LiftReveal
}
}
})
start()
} }
revealAnimator.start()
startLightRevealScrimOnKeyguardFadingAway = false startLightRevealScrimOnKeyguardFadingAway = false
} }
} }

View File

@@ -230,7 +230,6 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.statusbar.window.StatusBarWindowController; import com.android.systemui.statusbar.window.StatusBarWindowController;
import com.android.systemui.statusbar.window.StatusBarWindowView;
import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.DumpUtilsKt; import com.android.systemui.util.DumpUtilsKt;
import com.android.systemui.util.WallpaperController; import com.android.systemui.util.WallpaperController;
@@ -2385,6 +2384,8 @@ public class StatusBar extends SystemUI implements
} }
if (mLightRevealScrim != null) { if (mLightRevealScrim != null) {
pw.println(
"mLightRevealScrim.getRevealEffect(): " + mLightRevealScrim.getRevealEffect());
pw.println( pw.println(
"mLightRevealScrim.getRevealAmount(): " + mLightRevealScrim.getRevealAmount()); "mLightRevealScrim.getRevealAmount(): " + mLightRevealScrim.getRevealAmount());
} }
@@ -3371,17 +3372,24 @@ public class StatusBar extends SystemUI implements
return; return;
} }
if (wakingUp && mWakefulnessLifecycle.getLastWakeReason() final boolean wakingUpFromPowerButton = wakingUp
== PowerManager.WAKE_REASON_POWER_BUTTON && !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)
|| !wakingUp && mWakefulnessLifecycle.getLastSleepReason() && mWakefulnessLifecycle.getLastWakeReason()
== PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON) { == PowerManager.WAKE_REASON_POWER_BUTTON;
final boolean sleepingFromPowerButton = !wakingUp
&& mWakefulnessLifecycle.getLastSleepReason()
== PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON;
if (wakingUpFromPowerButton || sleepingFromPowerButton) {
mLightRevealScrim.setRevealEffect(mPowerButtonReveal); mLightRevealScrim.setRevealEffect(mPowerButtonReveal);
mLightRevealScrim.setRevealAmount(1f - mStatusBarStateController.getDozeAmount());
} else if (!wakingUp || !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) { } else if (!wakingUp || !(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) {
// If we're going to sleep, but it's not from the power button, use the default reveal. // If we're going to sleep, but it's not from the power button, use the default reveal.
// If we're waking up, only use the default reveal if the biometric controller didn't // If we're waking up, only use the default reveal if the biometric controller didn't
// already set it to the circular reveal because we're waking up from a fingerprint/face // already set it to the circular reveal because we're waking up from a fingerprint/face
// auth. // auth.
mLightRevealScrim.setRevealEffect(LiftReveal.INSTANCE); mLightRevealScrim.setRevealEffect(LiftReveal.INSTANCE);
mLightRevealScrim.setRevealAmount(1f - mStatusBarStateController.getDozeAmount());
} }
} }