Fixed the performance of unlocking when dozing
When unlocking from pulsing, we would go to the keyguard in the middle of the animation. We're now delaying that update until the reveal animation has finished to hide the giant jank of leaving the lockscreen. Test: atest SystemUITests Bug: 197113783 Change-Id: Iebefca3a1810a498654cad0e461532a5d9f7d0af
This commit is contained in:
@@ -207,6 +207,11 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
|
|||||||
*/
|
*/
|
||||||
lateinit var isScrimOpaqueChangedListener: Consumer<Boolean>
|
lateinit var isScrimOpaqueChangedListener: Consumer<Boolean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A runnable to call when the scrim has been fully revealed. This is only invoked once
|
||||||
|
*/
|
||||||
|
var fullyRevealedRunnable: Runnable? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How much of the underlying views are revealed, in percent. 0 means they will be completely
|
* How much of the underlying views are revealed, in percent. 0 means they will be completely
|
||||||
* obscured and 1 means they'll be fully visible.
|
* obscured and 1 means they'll be fully visible.
|
||||||
@@ -218,10 +223,20 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
|
|||||||
|
|
||||||
revealEffect.setRevealAmountOnScrim(value, this)
|
revealEffect.setRevealAmountOnScrim(value, this)
|
||||||
updateScrimOpaque()
|
updateScrimOpaque()
|
||||||
|
maybeTriggerFullyRevealedRunnable()
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun maybeTriggerFullyRevealedRunnable() {
|
||||||
|
if (revealAmount == 1.0f) {
|
||||||
|
fullyRevealedRunnable?.let {
|
||||||
|
it.run()
|
||||||
|
fullyRevealedRunnable = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The [LightRevealEffect] used to manipulate the radial gradient whenever [revealAmount]
|
* The [LightRevealEffect] used to manipulate the radial gradient whenever [revealAmount]
|
||||||
* changes.
|
* changes.
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import com.android.systemui.dagger.SysUISingleton
|
|||||||
import com.android.systemui.dump.DumpManager
|
import com.android.systemui.dump.DumpManager
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
|
|
||||||
import com.android.systemui.statusbar.phone.DozeParameters
|
import com.android.systemui.statusbar.phone.DozeParameters
|
||||||
import com.android.systemui.statusbar.phone.PanelExpansionListener
|
import com.android.systemui.statusbar.phone.PanelExpansionListener
|
||||||
import com.android.systemui.statusbar.phone.ScrimController
|
import com.android.systemui.statusbar.phone.ScrimController
|
||||||
@@ -73,6 +72,10 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
private const val TAG = "DepthController"
|
private const val TAG = "DepthController"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Did we already unblur while dozing?
|
||||||
|
*/
|
||||||
|
private var alreadyUnblurredWhileDozing = false
|
||||||
lateinit var root: View
|
lateinit var root: View
|
||||||
private var blurRoot: View? = null
|
private var blurRoot: View? = null
|
||||||
private var keyguardAnimator: Animator? = null
|
private var keyguardAnimator: Animator? = null
|
||||||
@@ -229,9 +232,11 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
private val keyguardStateCallback = object : KeyguardStateController.Callback {
|
private val keyguardStateCallback = object : KeyguardStateController.Callback {
|
||||||
override fun onKeyguardFadingAwayChanged() {
|
override fun onKeyguardFadingAwayChanged() {
|
||||||
if (!keyguardStateController.isKeyguardFadingAway ||
|
if (!keyguardStateController.isKeyguardFadingAway ||
|
||||||
biometricUnlockController.mode != MODE_WAKE_AND_UNLOCK) {
|
!biometricUnlockController.isWakeAndUnlock) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// When wakeAndUnlocking the screen remains dozing, so we have to manually trigger
|
||||||
|
// the unblur earlier
|
||||||
|
|
||||||
keyguardAnimator?.cancel()
|
keyguardAnimator?.cancel()
|
||||||
keyguardAnimator = ValueAnimator.ofFloat(1f, 0f).apply {
|
keyguardAnimator = ValueAnimator.ofFloat(1f, 0f).apply {
|
||||||
@@ -253,6 +258,7 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
})
|
})
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
|
alreadyUnblurredWhileDozing = statusBarStateController.dozeAmount != 0.0f
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onKeyguardShowingChanged() {
|
override fun onKeyguardShowingChanged() {
|
||||||
@@ -274,10 +280,24 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
if (isDozing) {
|
if (isDozing) {
|
||||||
shadeAnimation.finishIfRunning()
|
shadeAnimation.finishIfRunning()
|
||||||
brightnessMirrorSpring.finishIfRunning()
|
brightnessMirrorSpring.finishIfRunning()
|
||||||
|
|
||||||
|
// unset this for safety, to be ready for the next wakeup
|
||||||
|
alreadyUnblurredWhileDozing = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
||||||
|
if (alreadyUnblurredWhileDozing) {
|
||||||
|
if (linear == 0.0f) {
|
||||||
|
// We finished waking up, let's reset
|
||||||
|
alreadyUnblurredWhileDozing = false
|
||||||
|
} else {
|
||||||
|
// We've already handled the unbluring from the keyguardAnimator above.
|
||||||
|
// if we would continue, we'd play another unzoom / blur animation from the
|
||||||
|
// dozing changing.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased)
|
wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased)
|
||||||
scheduleUpdate()
|
scheduleUpdate()
|
||||||
}
|
}
|
||||||
@@ -435,6 +455,7 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
it.println("blursDisabledForAppLaunch: $blursDisabledForAppLaunch")
|
it.println("blursDisabledForAppLaunch: $blursDisabledForAppLaunch")
|
||||||
it.println("qsPanelExpansion: $qsPanelExpansion")
|
it.println("qsPanelExpansion: $qsPanelExpansion")
|
||||||
it.println("transitionToFullShadeProgress: $transitionToFullShadeProgress")
|
it.println("transitionToFullShadeProgress: $transitionToFullShadeProgress")
|
||||||
|
it.println("alreadyUnblurredWhileDozing: $alreadyUnblurredWhileDozing")
|
||||||
it.println("lastAppliedBlur: $lastAppliedBlur")
|
it.println("lastAppliedBlur: $lastAppliedBlur")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,6 +336,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
|
private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
|
||||||
|
private boolean mCallingFadingAwayAfterReveal;
|
||||||
private StatusBarCommandQueueCallbacks mCommandQueueCallbacks;
|
private StatusBarCommandQueueCallbacks mCommandQueueCallbacks;
|
||||||
|
|
||||||
void setWindowState(int state) {
|
void setWindowState(int state) {
|
||||||
@@ -3120,8 +3121,20 @@ public class StatusBar extends SystemUI implements
|
|||||||
public void fadeKeyguardWhilePulsing() {
|
public void fadeKeyguardWhilePulsing() {
|
||||||
mNotificationPanelViewController.fadeOut(0, FADE_KEYGUARD_DURATION_PULSING,
|
mNotificationPanelViewController.fadeOut(0, FADE_KEYGUARD_DURATION_PULSING,
|
||||||
()-> {
|
()-> {
|
||||||
hideKeyguard();
|
Runnable finishFading = () -> {
|
||||||
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
|
mCallingFadingAwayAfterReveal = false;
|
||||||
|
hideKeyguard();
|
||||||
|
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
|
||||||
|
};
|
||||||
|
if (mLightRevealScrim.getRevealAmount() != 1.0f) {
|
||||||
|
mCallingFadingAwayAfterReveal = true;
|
||||||
|
// We're still revealing the Light reveal, let's only go to keyguard once
|
||||||
|
// that has finished and nothing moves anymore.
|
||||||
|
// Going there introduces lots of jank
|
||||||
|
mLightRevealScrim.setFullyRevealedRunnable(finishFading);
|
||||||
|
} else {
|
||||||
|
finishFading.run();
|
||||||
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4280,7 +4293,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
+ "mStatusBarKeyguardViewManager was null");
|
+ "mStatusBarKeyguardViewManager was null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mKeyguardStateController.isKeyguardFadingAway()) {
|
if (mKeyguardStateController.isKeyguardFadingAway() && !mCallingFadingAwayAfterReveal) {
|
||||||
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
|
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user