Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinderKairos.kt +2 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.kairos.KairosNetwork import com.android.systemui.kairos.MutableState import com.android.systemui.kairos.combine import com.android.systemui.kairos.effect import com.android.systemui.kairos.launchEffect import com.android.systemui.lifecycle.repeatWhenAttachedToWindow import com.android.systemui.lifecycle.repeatWhenWindowIsVisible import com.android.systemui.plugins.DarkIconDispatcher Loading Loading @@ -163,7 +164,7 @@ object MobileIconBinderKairos { repeatWhenWindowIsVisible(view) { logger.logCollectionStarted(view, viewModel) binding.isCollecting = true effect { launchEffect { try { awaitCancellation() } finally { Loading packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt +4 −4 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ interface BuildScope : HasNetwork, StateScope { // TODO: remove disposable handle return? might add more confusion than convenience fun <A> Events<A>.observe( coroutineContext: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle /** Loading Loading @@ -638,7 +638,7 @@ interface BuildScope : HasNetwork, StateScope { * * With each invocation of [block], running effects from the previous invocation are cancelled. */ fun <A> Events<A>.observeLatest(block: suspend EffectScope.(A) -> Unit): DisposableHandle = fun <A> Events<A>.observeLatest(block: EffectScope.(A) -> Unit): DisposableHandle = mapLatestBuild { effect { block(it) } }.observeSync() /** Loading Loading @@ -702,7 +702,7 @@ interface BuildScope : HasNetwork, StateScope { */ fun <A> State<A>.observe( coroutineContext: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle = now.map { sample() }.mergeWith(changes) { _, new -> new }.observe(coroutineContext, block) Loading Loading @@ -769,7 +769,7 @@ fun <A> BuildScope.asyncEvent(block: suspend KairosScope.() -> A): Events<A> = @ExperimentalKairosApi fun BuildScope.effect( context: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.() -> Unit, block: EffectScope.() -> Unit, ): Job = launchScope(context) { now.observe { block() } } /** Loading packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/BuildScopeImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ internal class BuildScopeImpl(val stateScope: StateScopeImpl, val coroutineScope override fun <A> Events<A>.observe( coroutineContext: CoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle { val interceptor = coroutineContext[ContinuationInterceptor] return observeInternal(coroutineContext) { effectScope, output -> Loading packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/InternalScopes.kt +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ internal interface NetworkScope : InitScope { fun scheduleOutput(output: Output<*>) fun scheduleDispatchedOutput(interceptor: ContinuationInterceptor?, block: suspend () -> Unit) fun scheduleDispatchedOutput(interceptor: ContinuationInterceptor?, block: () -> Unit) fun scheduleMuxMover(muxMover: MuxDeferredNode<*, *, *>) Loading packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/Network.kt +2 −3 Original line number Diff line number Diff line Loading @@ -71,8 +71,7 @@ internal class Network( private val deferScopeImpl = DeferScopeImpl() private val stateWrites = ArrayDeque<StateSource<*>>() private val fastOutputs = ArrayDeque<Output<*>>() private val outputsByDispatcher = HashMap<ContinuationInterceptor, ArrayDeque<suspend () -> Unit>>() private val outputsByDispatcher = HashMap<ContinuationInterceptor, ArrayDeque<() -> Unit>>() private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val deactivations = ArrayDeque<PushNode<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() Loading @@ -84,7 +83,7 @@ internal class Network( override fun scheduleDispatchedOutput( interceptor: ContinuationInterceptor?, block: suspend () -> Unit, block: () -> Unit, ) { outputsByDispatcher .computeIfAbsent(interceptor ?: Dispatchers.Unconfined) { ArrayDeque() } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinderKairos.kt +2 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.kairos.KairosNetwork import com.android.systemui.kairos.MutableState import com.android.systemui.kairos.combine import com.android.systemui.kairos.effect import com.android.systemui.kairos.launchEffect import com.android.systemui.lifecycle.repeatWhenAttachedToWindow import com.android.systemui.lifecycle.repeatWhenWindowIsVisible import com.android.systemui.plugins.DarkIconDispatcher Loading Loading @@ -163,7 +164,7 @@ object MobileIconBinderKairos { repeatWhenWindowIsVisible(view) { logger.logCollectionStarted(view, viewModel) binding.isCollecting = true effect { launchEffect { try { awaitCancellation() } finally { Loading
packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt +4 −4 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ interface BuildScope : HasNetwork, StateScope { // TODO: remove disposable handle return? might add more confusion than convenience fun <A> Events<A>.observe( coroutineContext: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle /** Loading Loading @@ -638,7 +638,7 @@ interface BuildScope : HasNetwork, StateScope { * * With each invocation of [block], running effects from the previous invocation are cancelled. */ fun <A> Events<A>.observeLatest(block: suspend EffectScope.(A) -> Unit): DisposableHandle = fun <A> Events<A>.observeLatest(block: EffectScope.(A) -> Unit): DisposableHandle = mapLatestBuild { effect { block(it) } }.observeSync() /** Loading Loading @@ -702,7 +702,7 @@ interface BuildScope : HasNetwork, StateScope { */ fun <A> State<A>.observe( coroutineContext: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle = now.map { sample() }.mergeWith(changes) { _, new -> new }.observe(coroutineContext, block) Loading Loading @@ -769,7 +769,7 @@ fun <A> BuildScope.asyncEvent(block: suspend KairosScope.() -> A): Events<A> = @ExperimentalKairosApi fun BuildScope.effect( context: CoroutineContext = EmptyCoroutineContext, block: suspend EffectScope.() -> Unit, block: EffectScope.() -> Unit, ): Job = launchScope(context) { now.observe { block() } } /** Loading
packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/BuildScopeImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ internal class BuildScopeImpl(val stateScope: StateScopeImpl, val coroutineScope override fun <A> Events<A>.observe( coroutineContext: CoroutineContext, block: suspend EffectScope.(A) -> Unit, block: EffectScope.(A) -> Unit, ): DisposableHandle { val interceptor = coroutineContext[ContinuationInterceptor] return observeInternal(coroutineContext) { effectScope, output -> Loading
packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/InternalScopes.kt +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ internal interface NetworkScope : InitScope { fun scheduleOutput(output: Output<*>) fun scheduleDispatchedOutput(interceptor: ContinuationInterceptor?, block: suspend () -> Unit) fun scheduleDispatchedOutput(interceptor: ContinuationInterceptor?, block: () -> Unit) fun scheduleMuxMover(muxMover: MuxDeferredNode<*, *, *>) Loading
packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/Network.kt +2 −3 Original line number Diff line number Diff line Loading @@ -71,8 +71,7 @@ internal class Network( private val deferScopeImpl = DeferScopeImpl() private val stateWrites = ArrayDeque<StateSource<*>>() private val fastOutputs = ArrayDeque<Output<*>>() private val outputsByDispatcher = HashMap<ContinuationInterceptor, ArrayDeque<suspend () -> Unit>>() private val outputsByDispatcher = HashMap<ContinuationInterceptor, ArrayDeque<() -> Unit>>() private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>() private val deactivations = ArrayDeque<PushNode<*>>() private val outputDeactivations = ArrayDeque<Output<*>>() Loading @@ -84,7 +83,7 @@ internal class Network( override fun scheduleDispatchedOutput( interceptor: ContinuationInterceptor?, block: suspend () -> Unit, block: () -> Unit, ) { outputsByDispatcher .computeIfAbsent(interceptor ?: Dispatchers.Unconfined) { ArrayDeque() } Loading