For some reason we can finish the widget update broadcast twice. (#112)

I can't yet determine why this race-condition occurs, due to the forced timeout, it shouldn't be due to exceeding the receiver ANR window...
This commit is contained in:
Matthias Urhahn
2023-03-11 13:01:15 +01:00
committed by GitHub
parent 7e6ee274d8
commit ad78a0570c
2 changed files with 13 additions and 2 deletions
@@ -0,0 +1,10 @@
import android.content.BroadcastReceiver
import eu.darken.capod.common.debug.logging.log
fun BroadcastReceiver.PendingResult.finish2(): Boolean = try {
finish()
true
} catch (e: IllegalStateException) {
log { "BroadcastReceiver.PendingResult.finish() failed: $e" }
false
}