From 758777111ab3448bc0b7ab559420f4fafa3231bb Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 27 Feb 2020 12:54:42 -0800 Subject: [PATCH] Improve application startup --- .../java/com/topjohnwu/magisk/core/SplashActivity.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 c4f753b0a..f7cc2ed34 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/SplashActivity.kt @@ -8,6 +8,8 @@ import com.topjohnwu.magisk.core.tasks.patchDTB import com.topjohnwu.magisk.core.utils.Utils import com.topjohnwu.magisk.core.view.Notifications import com.topjohnwu.magisk.core.view.Shortcuts +import com.topjohnwu.magisk.data.network.GithubRawServices +import com.topjohnwu.magisk.extensions.get import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.superuser.Shell @@ -19,20 +21,20 @@ open class SplashActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - Shell.getShell { initAndStart() } + Shell.getShell { Shell.EXECUTOR.execute(this::initAndStart) } } private fun handleRepackage() { val pkg = Config.suManager if (Config.suManager.isNotEmpty() && packageName == BuildConfig.APPLICATION_ID) { Config.suManager = "" - Shell.su("pm uninstall $pkg").submit() + Shell.su("(pm uninstall $pkg)& >/dev/null 2>&1").exec() } if (pkg == packageName) { runCatching { // We are the manager, remove com.topjohnwu.magisk as it could be malware packageManager.getApplicationInfo(BuildConfig.APPLICATION_ID, 0) - Shell.su("pm uninstall " + BuildConfig.APPLICATION_ID).submit() + Shell.su("(pm uninstall ${BuildConfig.APPLICATION_ID})& >/dev/null 2>&1").exec() } } } @@ -47,6 +49,9 @@ open class SplashActivity : Activity() { // Patch DTB partitions if needed patchDTB(this) + // Pre-fetch network stuffs + get() + DONE = true Navigation.start(intent, this) finish()