From 0613a61be9463491105eec26921615f21fb4649a Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 5 Nov 2021 20:48:57 +0100 Subject: [PATCH] Revert "Fixed the performance of unlocking when dozing" This reverts commit 4e0c2505640a009dfac0129b841be5ec8c46873b. Reason for revert: b/205193749 Bug: b/205193749 Test: manual Change-Id: I10e18a16ae3d6b8273c8509b5db037c9cc80795a --- .../systemui/statusbar/LightRevealScrim.kt | 15 ----------- .../NotificationShadeDepthController.kt | 25 ++----------------- .../systemui/statusbar/phone/StatusBar.java | 19 +++----------- 3 files changed, 5 insertions(+), 54 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt index 77e329f94a363..03d8e7e03c0fc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt @@ -207,11 +207,6 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, */ lateinit var isScrimOpaqueChangedListener: Consumer - /** - * 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 * obscured and 1 means they'll be fully visible. @@ -223,20 +218,10 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, revealEffect.setRevealAmountOnScrim(value, this) updateScrimOpaque() - maybeTriggerFullyRevealedRunnable() invalidate() } } - private fun maybeTriggerFullyRevealedRunnable() { - if (revealAmount == 1.0f) { - fullyRevealedRunnable?.let { - it.run() - fullyRevealedRunnable = null - } - } - } - /** * The [LightRevealEffect] used to manipulate the radial gradient whenever [revealAmount] * changes. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index 5648741e3caf6..18d91d67ed1eb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -37,6 +37,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.plugins.statusbar.StatusBarStateController 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.PanelExpansionListener import com.android.systemui.statusbar.phone.ScrimController @@ -73,10 +74,6 @@ class NotificationShadeDepthController @Inject constructor( private const val TAG = "DepthController" } - /** - * Did we already unblur while dozing? - */ - private var alreadyUnblurredWhileDozing = false lateinit var root: View private var blurRoot: View? = null private var keyguardAnimator: Animator? = null @@ -233,11 +230,9 @@ class NotificationShadeDepthController @Inject constructor( private val keyguardStateCallback = object : KeyguardStateController.Callback { override fun onKeyguardFadingAwayChanged() { if (!keyguardStateController.isKeyguardFadingAway || - !biometricUnlockController.isWakeAndUnlock) { + biometricUnlockController.mode != MODE_WAKE_AND_UNLOCK) { return } - // When wakeAndUnlocking the screen remains dozing, so we have to manually trigger - // the unblur earlier keyguardAnimator?.cancel() keyguardAnimator = ValueAnimator.ofFloat(1f, 0f).apply { @@ -259,7 +254,6 @@ class NotificationShadeDepthController @Inject constructor( }) start() } - alreadyUnblurredWhileDozing = statusBarStateController.dozeAmount != 0.0f } override fun onKeyguardShowingChanged() { @@ -281,24 +275,10 @@ class NotificationShadeDepthController @Inject constructor( if (isDozing) { shadeAnimation.finishIfRunning() brightnessMirrorSpring.finishIfRunning() - - // unset this for safety, to be ready for the next wakeup - alreadyUnblurredWhileDozing = false } } 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) scheduleUpdate() } @@ -456,7 +436,6 @@ class NotificationShadeDepthController @Inject constructor( it.println("blursDisabledForAppLaunch: $blursDisabledForAppLaunch") it.println("qsPanelExpansion: $qsPanelExpansion") it.println("transitionToFullShadeProgress: $transitionToFullShadeProgress") - it.println("alreadyUnblurredWhileDozing: $alreadyUnblurredWhileDozing") it.println("lastAppliedBlur: $lastAppliedBlur") } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index bc50893d9a64b..c6359393ced9c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -337,7 +337,6 @@ public class StatusBar extends SystemUI implements } private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; - private boolean mCallingFadingAwayAfterReveal; private StatusBarCommandQueueCallbacks mCommandQueueCallbacks; void setWindowState(int state) { @@ -3146,20 +3145,8 @@ public class StatusBar extends SystemUI implements public void fadeKeyguardWhilePulsing() { mNotificationPanelViewController.fadeOut(0, FADE_KEYGUARD_DURATION_PULSING, ()-> { - Runnable finishFading = () -> { - 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(); - } + hideKeyguard(); + mStatusBarKeyguardViewManager.onKeyguardFadedAway(); }).start(); } @@ -4324,7 +4311,7 @@ public class StatusBar extends SystemUI implements + "mStatusBarKeyguardViewManager was null"); return; } - if (mKeyguardStateController.isKeyguardFadingAway() && !mCallingFadingAwayAfterReveal) { + if (mKeyguardStateController.isKeyguardFadingAway()) { mStatusBarKeyguardViewManager.onKeyguardFadedAway(); } }