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

Verified Commit 463865fc authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Use thread-safe cow lists

parent c474fce4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -11,9 +11,10 @@ import android.location.Address
import kotlinx.coroutines.launch
import org.microg.nlp.api.Constants.ACTION_GEOCODER_BACKEND
import java.util.ArrayList
import java.util.concurrent.CopyOnWriteArrayList

class GeocodeFuser(private val context: Context, private val root: UnifiedLocationServiceRoot) {
    private val backendHelpers = ArrayList<GeocodeBackendHelper>()
    private val backendHelpers = CopyOnWriteArrayList<GeocodeBackendHelper>()

    suspend fun reset() {
        unbind()
+2 −1
Original line number Diff line number Diff line
@@ -19,10 +19,11 @@ import java.util.Comparator

import org.microg.nlp.api.Constants.ACTION_LOCATION_BACKEND
import org.microg.nlp.api.Constants.LOCATION_EXTRA_OTHER_BACKENDS
import java.util.concurrent.CopyOnWriteArrayList

class LocationFuser(private val context: Context, private val root: UnifiedLocationServiceRoot) {

    private val backendHelpers = ArrayList<LocationBackendHelper>()
    private val backendHelpers = CopyOnWriteArrayList<LocationBackendHelper>()
    private var fusing = false
    private var lastLocationReportTime: Long = 0