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

Commit 72d72900 authored by Evan Laird's avatar Evan Laird Committed by Android (Google) Code Review
Browse files

Merge "[mobile] wrap the get-or-create block in a `synchronized`" into main

parents ccff0482 fa2501b0
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -355,10 +355,12 @@ constructor(
        getOrCreateRepoForSubId(subId)

    private fun getOrCreateRepoForSubId(subId: Int) =
        synchronized(subIdRepositoryCache) {
            subIdRepositoryCache[subId]?.get()
                ?: createRepositoryForSubId(subId).also {
                    subIdRepositoryCache[subId] = WeakReference(it)
                }
        }

    override val mobileIsDefault: StateFlow<Boolean> =
        connectivityRepository.defaultConnections