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

Commit 98b21a0b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I48eafb5a,I4d7d79b4,I1611c616,If1b79600,I534bcb7f, ... into main

* changes:
  [kairos] Remove unneeded sub-scopes for KairosActivatables
  [kairos] cache switch-off event for TransactionScope.now
  [kairos] drop Output upstream ref on death
  [kairos] cache upstream patches node for MuxPrompt
  [kairos] Cache derived State as field in viewmodel
  [kairos] Cache end events for state scopes
  [kairos] Optimize internal map wrappers
parents 30f73993 6ae18017
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.systemui.kairos.TransactionScope
import com.android.systemui.kairos.activateSpec
import com.android.systemui.kairos.effect
import com.android.systemui.kairos.launchKairosNetwork
import com.android.systemui.kairos.launchScope
import dagger.Binds
import dagger.Module
import dagger.multibindings.ClassKey
@@ -197,7 +196,7 @@ private constructor(
        appScope.launch {
            unwrappedNetwork.activateSpec {
                for (activatable in activatables.get()) {
                    launchScope { activatable.run { activate() } }
                    activatable.run { activate() }
                }
                effect { started.complete(Unit) }
            }
+2 −2
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ constructor(
    private val context: Context,
) : KairosBuilder by kairosBuilder() {

    val activeSubscriptionId: State<Int?>
        get() = interactor.activeDataIconInteractor.map { it?.subscriptionId }
    val activeSubscriptionId: State<Int?> =
        interactor.activeDataIconInteractor.map { it?.subscriptionId }

    val subscriptionIds: KairosState<List<Int>> =
        interactor.filteredSubscriptions.map { subscriptions ->
+5 −1
Original line number Diff line number Diff line
@@ -318,6 +318,10 @@ private fun EvalScope.reenterBuildScope(
) =
    BuildScopeImpl(
        stateScope =
            StateScopeImpl(evalScope = this, endSignalLazy = outerScope.stateScope.endSignalLazy),
            StateScopeImpl(
                evalScope = this,
                endSignalLazy = outerScope.stateScope.endSignalLazy,
                endSignalOnceLazy = outerScope.stateScope.endSignalOnceLazy,
            ),
        coroutineScope,
    )
+2 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ internal class EvalScopeImpl(networkScope: NetworkScope, deferScope: DeferScope)

    override val now: Events<Unit> by lazy {
        var result by EventsLoop<Unit>()
        val switchOff = result.mapCheap { emptyEvents }
        result =
            StateInit(
                    constInit(
@@ -58,7 +59,7 @@ internal class EvalScopeImpl(networkScope: NetworkScope, deferScope: DeferScope)
                            "now",
                            "now",
                            this,
                            { result.mapCheap { emptyEvents }.init.connect(evalScope = this) },
                            { switchOff.init.connect(evalScope = this) },
                            CompletableLazy(
                                EventsInit(
                                    constInit(
+3 −5
Original line number Diff line number Diff line
@@ -320,14 +320,12 @@ internal inline fun <A> switchPromptImplSingle(
    crossinline getStorage: EvalScope.() -> EventsImpl<A>,
    crossinline getPatches: EvalScope.() -> EventsImpl<EventsImpl<A>>,
): EventsImpl<A> {
    val patches =
        mapImpl(getPatches) { newEvents, _ -> singleOf(Maybe.present(newEvents)).asIterable() }
    val switchPromptImpl =
        switchPromptImpl(
            getStorage = { singleOf(getStorage()).asIterable() },
            getPatches = {
                mapImpl(getPatches) { newEvents, _ ->
                    singleOf(Maybe.present(newEvents)).asIterable()
                }
            },
            getPatches = { patches },
            storeFactory = SingletonMapK.Factory(),
        )
    return mapImpl({ switchPromptImpl }) { map, logIndent ->
Loading