mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Fix ConcurrentModificationException on BackgroundDetectionObserver
This commit is contained in:
parent
35325db407
commit
b847d8cf36
1 changed files with 2 additions and 1 deletions
|
@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.util
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver
|
import androidx.lifecycle.DefaultLifecycleObserver
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import java.util.concurrent.CopyOnWriteArraySet
|
||||||
|
|
||||||
internal interface BackgroundDetectionObserver : DefaultLifecycleObserver {
|
internal interface BackgroundDetectionObserver : DefaultLifecycleObserver {
|
||||||
val isInBackground: Boolean
|
val isInBackground: Boolean
|
||||||
|
@ -37,7 +38,7 @@ internal class DefaultBackgroundDetectionObserver : BackgroundDetectionObserver
|
||||||
override var isInBackground: Boolean = true
|
override var isInBackground: Boolean = true
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private val listeners = LinkedHashSet<BackgroundDetectionObserver.Listener>()
|
private val listeners = CopyOnWriteArraySet<BackgroundDetectionObserver.Listener>()
|
||||||
|
|
||||||
override fun register(listener: BackgroundDetectionObserver.Listener) {
|
override fun register(listener: BackgroundDetectionObserver.Listener) {
|
||||||
listeners.add(listener)
|
listeners.add(listener)
|
||||||
|
|
Loading…
Reference in a new issue