mirror of
https://github.com/kalarina-bit/Sparkledns.git
synced 2026-11-22 07:36:09 +00:00
Load blocklists at background thread priority
This commit is contained in:
@@ -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()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user