Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89bdb568 authored by Selim Cinek's avatar Selim Cinek Committed by Automerger Merge Worker
Browse files

Merge "Revert "Fixed the performance of unlocking when dozing"" into sc-v2-dev am: 2ffe5969

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16197804

Change-Id: I9d330db3654a85aa4b29c519e688b4e3b779ef9b
parents 975f6fed 2ffe5969
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -207,11 +207,6 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context,
     */
    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
     * 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.
+2 −23
Original line number Diff line number Diff line
@@ -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.ScrimController
import com.android.systemui.statusbar.phone.panelstate.PanelExpansionListener
@@ -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()
        }
@@ -458,7 +438,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")
        }
    }
+3 −16
Original line number Diff line number Diff line
@@ -335,7 +335,6 @@ public class StatusBar extends SystemUI implements
    }

    private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    private boolean mCallingFadingAwayAfterReveal;
    private StatusBarCommandQueueCallbacks mCommandQueueCallbacks;

    void setWindowState(int state) {
@@ -3098,20 +3097,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();
                }
            }).start();
    }

@@ -4258,7 +4245,7 @@ public class StatusBar extends SystemUI implements
                        + "mStatusBarKeyguardViewManager was null");
                return;
            }
            if (mKeyguardStateController.isKeyguardFadingAway() && !mCallingFadingAwayAfterReveal) {
            if (mKeyguardStateController.isKeyguardFadingAway()) {
                mStatusBarKeyguardViewManager.onKeyguardFadedAway();
            }
        }