Fix ConcurrentModificationException in ServiceNotification
This commit is contained in:
@@ -51,11 +51,13 @@ object ServiceNotification {
|
||||
}
|
||||
|
||||
fun startForeground(service: Service, deviceCounts: Map<String, Int>, inactive: List<String> = emptyList()) {
|
||||
synchronized(this) {
|
||||
deviceCountsMap[service] = deviceCounts
|
||||
if (inactive.isEmpty()) inactiveMap.remove(service) else inactiveMap[service] = inactive
|
||||
service.startForeground(CHANNEL_ID, buildNotification(service))
|
||||
}
|
||||
fun stopForeground(service: Service) {
|
||||
}
|
||||
fun stopForeground(service: Service) = synchronized(this) {
|
||||
deviceCountsMap.remove(service)
|
||||
if (deviceCountsMap.isEmpty()) service.stopForeground(true) else {
|
||||
service.stopForeground(false)
|
||||
|
||||
Reference in New Issue
Block a user