Add support for lazy conditions
Conditions now define a start strategy, which determines how they are run. START_EAGERLY is how conditions function today, it starts the condition immediately and doesn't stop it. START_LAZILY will wait to start the condition until the previous one has emitted a value which did not short-circuit. For AND operand, this means the previous condition must have emitted true. For OR operand, it would be false. START_WHEN_NEEDED is similar to lazy, but will also cancel the condition when not needed. This can be used for expensive conditions, such as the low light condition, since it keeps the lowlight sensor on. Bug: 278875229 Test: atest CombinedConditionTest Change-Id: Ie81f74357f1d37c771fa91d097fef85ab11fa604
Loading
Please register or sign in to comment