diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/src/main/java/com/topjohnwu/magisk/core/App.kt index a224c2836..b1f998589 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/App.kt @@ -7,7 +7,7 @@ import android.content.Context import android.content.res.Configuration import android.os.Bundle import com.topjohnwu.magisk.DynAPK -import com.topjohnwu.magisk.core.utils.IODispatcherExecutor +import com.topjohnwu.magisk.core.utils.DispatcherExecutor import com.topjohnwu.magisk.core.utils.RootRegistry import com.topjohnwu.magisk.core.utils.ShellInit import com.topjohnwu.magisk.core.utils.updateConfig @@ -16,6 +16,7 @@ import com.topjohnwu.magisk.ktx.unwrap import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.internal.UiThreadHandler import com.topjohnwu.superuser.ipc.RootService +import kotlinx.coroutines.Dispatchers import timber.log.Timber import kotlin.system.exitProcess @@ -44,7 +45,7 @@ open class App() : Application() { .setFlags(Shell.FLAG_MOUNT_MASTER) .setInitializers(ShellInit::class.java) .setTimeout(2)) - Shell.EXECUTOR = IODispatcherExecutor() + Shell.EXECUTOR = DispatcherExecutor(Dispatchers.IO) // Some context magic val app: Application diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/IODispatcherExecutor.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt similarity index 85% rename from app/src/main/java/com/topjohnwu/magisk/core/utils/IODispatcherExecutor.kt rename to app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt index 938a519bc..6b2dbbad7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/IODispatcherExecutor.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt @@ -5,10 +5,10 @@ import java.util.concurrent.AbstractExecutorService import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit -class IODispatcherExecutor : AbstractExecutorService() { +class DispatcherExecutor(dispatcher: CoroutineDispatcher) : AbstractExecutorService() { private val job = SupervisorJob() - private val scope = CoroutineScope(job + Dispatchers.IO) + private val scope = CoroutineScope(job + dispatcher) private val latch = CountDownLatch(1) init {