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

Commit 850feb3e authored by Hawkwood's avatar Hawkwood
Browse files

Clock centering falls back to lockscreen behavior

It doesn't look like the else case was hit in very many cases before,
but now it's being triggered when moving to/from hubmode. This ensures
the clock doesn't pop back to the center during that transition. I also
refactored the combine clause a bit.

Bug: 409728064
Flag: NONE Minor fix
Test: Manually checked centering behavior
Change-Id: I1f90b5722345adb6bdfd08cc9422cae9c440792d
parent 3c78294a
Loading
Loading
Loading
Loading
+10 −22
Original line number Diff line number Diff line
@@ -176,37 +176,25 @@ constructor(
                    areAnyNotificationsPresent,
                    isAodPromotedNotificationPresent,
                    keyguardInteractor.dozeTransitionModel,
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to == AOD },
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map {
                        it.to == LOCKSCREEN
                    },
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map {
                        it.to == DOZING
                    },
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to },
                    keyguardInteractor.isPulsing,
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to == GONE },
                ) {
                    isShadeLayoutWide,
                    areAnyNotificationsPresent,
                    isAodPromotedNotificationPresent,
                    dozeTransitionModel,
                    startedToAod,
                    startedToLockScreen,
                    startedToDoze,
                    isPulsing,
                    startedToGone ->
                    toKeyguardState,
                    isPulsing ->
                    when {
                        !isShadeLayoutWide -> true
                        // [areAnyNotificationsPresent] also reacts to notification stack in
                        // homescreen
                        // it may cause unnecessary `false` emission when there's notification in
                        // homescreen
                        // but none in lockscreen when going from GONE to AOD / DOZING
                        // use null to skip emitting wrong value
                        startedToGone || startedToDoze -> null
                        startedToLockScreen -> !areAnyNotificationsPresent
                        startedToAod -> !(isPulsing || isAodPromotedNotificationPresent)
                        else -> true
                        // homescreen it may cause unnecessary `false` emission when there's
                        // notification in homescreen but none in lockscreen when going from
                        // GONE to AOD / DOZING use null to skip emitting wrong value
                        toKeyguardState == GONE || toKeyguardState == DOZING -> null
                        toKeyguardState == LOCKSCREEN -> !areAnyNotificationsPresent
                        toKeyguardState == AOD -> !(isPulsing || isAodPromotedNotificationPresent)
                        else -> !areAnyNotificationsPresent
                    }
                }
                .filterNotNull()