From 56bc4ba7f1e7c036cec995c45b86856c475b5de6 Mon Sep 17 00:00:00 2001 From: Ax333l Date: Sun, 11 Jun 2023 17:52:43 +0200 Subject: [PATCH] fix: run blocking IO operations in the correct context --- app/src/main/java/app/revanced/manager/patcher/Session.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/manager/patcher/Session.kt b/app/src/main/java/app/revanced/manager/patcher/Session.kt index 5a4fdb8..c52d485 100644 --- a/app/src/main/java/app/revanced/manager/patcher/Session.kt +++ b/app/src/main/java/app/revanced/manager/patcher/Session.kt @@ -8,6 +8,8 @@ import app.revanced.patcher.PatcherOptions import app.revanced.patcher.data.Context import app.revanced.patcher.logging.Logger import app.revanced.patcher.patch.Patch +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import java.io.Closeable import java.io.File import java.nio.file.Files @@ -74,7 +76,9 @@ class Session( logger.info("Patched apk saved to $aligned") - Files.move(aligned.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING) + withContext(Dispatchers.IO) { + Files.move(aligned.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING) + } } override fun close() {