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

Commit 970f890f authored by Josh Tsuji's avatar Josh Tsuji Committed by Automerger Merge Worker
Browse files

Merge "Check whether doze is enabled before starting the screen off...

Merge "Check whether doze is enabled before starting the screen off animation." into sc-dev am: ba255e63 am: eb44d300

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

Change-Id: Idc553e56762759e3fa77497e72a66755ccbf0855
parents 5440c206 eb44d300
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -223,8 +223,15 @@ public class DozeParameters implements TunerService.Tunable,
     * then abruptly showing AOD.
     */
    public boolean shouldControlUnlockedScreenOff() {
        return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations()
                && mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation();
        return mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation();
    }

    /**
     * Whether we're capable of controlling the screen off animation if we want to. This isn't
     * possible if AOD isn't even enabled or if the flag is disabled.
     */
    public boolean canControlUnlockedScreenOff() {
        return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations();
    }

    private boolean getBoolean(String propName, int resId) {
+7 −2
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
    private val wakefulnessLifecycle: WakefulnessLifecycle,
    private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
    private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
    private val keyguardStateController: KeyguardStateController
    private val keyguardStateController: KeyguardStateController,
    private val dozeParameters: dagger.Lazy<DozeParameters>
) : WakefulnessLifecycle.Observer {
    private val handler = Handler()

@@ -146,7 +147,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
    }

    override fun onStartedGoingToSleep() {
        if (shouldPlayUnlockedScreenOffAnimation()) {
        if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
            lightRevealAnimationPlaying = true
            lightRevealAnimator.start()

@@ -164,6 +165,10 @@ class UnlockedScreenOffAnimationController @Inject constructor(
     * on the current state of the device.
     */
    fun shouldPlayUnlockedScreenOffAnimation(): Boolean {
        if (!dozeParameters.get().canControlUnlockedScreenOff()) {
            return false
        }

        // We only play the unlocked screen off animation if we are... unlocked.
        if (statusBarStateControllerImpl.state != StatusBarState.SHADE) {
            return false