Load blocklists at background thread priority

This commit is contained in:
2026-10-25 12:19:49 +02:00
parent fa6398c40e
commit 4e99ef1211
@@ -3,6 +3,7 @@ package cc.skysparkle.sparkledns
import android.app.Application import android.app.Application
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build
import android.os.Process
import java.io.File import java.io.File
import java.io.PrintWriter import java.io.PrintWriter
import java.io.StringWriter import java.io.StringWriter
@@ -15,6 +16,8 @@ class SparkleApp : Application() {
// Reads what the first screen needs before it asks, so its first frame does not wait on storage // Reads what the first screen needs before it asks, so its first frame does not wait on storage
Prefs(this).providerId Prefs(this).providerId
CrashLog.preload(this) CrashLog.preload(this)
// Lists can hold millions of entries; loading them should not take CPU from the first frames
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND)
runCatching { Blocklist.reload(this) } runCatching { Blocklist.reload(this) }
}, "startup-load").start() }, "startup-load").start()
} }