Use coroutines instead of raw executors

This commit is contained in:
topjohnwu 2020-07-14 02:37:52 -07:00
parent cad189d2dc
commit ba31c6b625

View File

@ -12,6 +12,9 @@ import com.topjohnwu.magisk.data.network.GithubRawServices
import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.ktx.get
import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.magisk.model.navigation.Navigation
import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.Shell
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
open class SplashActivity : Activity() { open class SplashActivity : Activity() {
@ -22,7 +25,9 @@ open class SplashActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.SplashTheme) setTheme(R.style.SplashTheme)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
Shell.getShell { Shell.EXECUTOR.execute(this::initAndStart) } GlobalScope.launch(Dispatchers.IO) {
initAndStart()
}
} }
private fun handleRepackage() { private fun handleRepackage() {
@ -41,6 +46,9 @@ open class SplashActivity : Activity() {
} }
private fun initAndStart() { private fun initAndStart() {
// Pre-initialize root shell
Shell.getShell()
Config.initialize() Config.initialize()
handleRepackage() handleRepackage()
Notifications.setup(this) Notifications.setup(this)