[Central Surfaces] Make KeyguardRepository.wakefulness a StateFlow.
In order to remove some CentralSurfaces references (specifically mWakeUpComingFromTouch), it would be useful to be able to query the current wakefulness status from KeyguardRepository. However, since wakefulness is currently just a normal Flow, there's no way to get the current value. Converting this flow into a StateFlow gives us a few benefits: 1) Callers can query the flow for the current value instead of needing to collect on the flow. 2) Only one callback total is added to WakefulnessLifecycle, instead of one callback per flow consumer (14 as of this CL). I believe this should be a no-op, since the wakefulness flow was already emitting the current value when the flow starts, which mimicks StateFlow behavior. Bug: 284485594 Test: atest KeyguardRepositoryImplTest Test: manual: verified via local logging that consumers of `wakefulness` still (1) receive new values at the same times as before; (2) receive the correct values. Specifically verified: - LightRevealScrimRepository.nonBiometricRevealEffect is notified whenever wakefulness changes - FromDozingTransitionInteractor.listenerForDozingToLockscreen is notified whenever wakefulness changes - FromPrimaryBouncerTransitionInteractor.listenForPrimaryBouncerToLockscreenOrOccluded fetches most recent value whenever primaryBouncerShowing state changes Change-Id: I792953dd86b367b26540d408c3af9f83c502ea4d
Loading
Please register or sign in to comment