crypto: Use a concurrent hashmap for the live devices update logic

This commit is contained in:
Damir Jelić 2021-04-09 13:53:31 +02:00
parent 74a1c226a4
commit 188d2d57c0

View File

@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.crypto
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import java.io.File
import java.util.concurrent.ConcurrentHashMap
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.matrix.android.sdk.api.listeners.ProgressListener
@ -125,7 +126,7 @@ class Device(inner: InnerDevice, machine: InnerMachine) {
}
internal class DeviceUpdateObserver() {
internal val listeners = HashMap<LiveDevice, List<String>>()
internal val listeners = ConcurrentHashMap<LiveDevice, List<String>>()
fun addDeviceUpdateListener(device: LiveDevice) {
listeners.set(device, device.userIds)