From ba31c6b62576ba02cf47ff9657de7d90be6cdf9e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 14 Jul 2020 02:37:52 -0700 Subject: [PATCH] Use coroutines instead of raw executors --- .../java/com/topjohnwu/magisk/core/SplashActivity.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt b/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt index 080d13a67..2d8a8033e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt @@ -12,6 +12,9 @@ import com.topjohnwu.magisk.data.network.GithubRawServices import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.superuser.Shell +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch open class SplashActivity : Activity() { @@ -22,7 +25,9 @@ open class SplashActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { setTheme(R.style.SplashTheme) super.onCreate(savedInstanceState) - Shell.getShell { Shell.EXECUTOR.execute(this::initAndStart) } + GlobalScope.launch(Dispatchers.IO) { + initAndStart() + } } private fun handleRepackage() { @@ -41,6 +46,9 @@ open class SplashActivity : Activity() { } private fun initAndStart() { + // Pre-initialize root shell + Shell.getShell() + Config.initialize() handleRepackage() Notifications.setup(this)