From e50208e18fbca420a9c594ca928a957d6c7bb368 Mon Sep 17 00:00:00 2001 From: kai-city <1830170041@qq.com> Date: Sun, 23 May 2021 23:45:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=9C=A8Android11=E4=B8=8A?= =?UTF-8?q?dex=E7=9A=84=E5=82=A8=E5=AD=98=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blackdex/data/BlackDexConfiguration.kt | 23 ++++++++++++++++ .../top/niunaijun/blackdex/util/FileUtil.kt | 27 ------------------- 2 files changed, 23 insertions(+), 27 deletions(-) delete mode 100644 app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt diff --git a/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt b/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt index 62fba09..a9bd5c4 100644 --- a/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt +++ b/app/src/main/java/top/niunaijun/blackdex/data/BlackDexConfiguration.kt @@ -2,6 +2,9 @@ package top.niunaijun.blackdex.data import android.content.Context import top.niunaijun.blackbox.app.configuration.ClientConfiguration +import top.niunaijun.blackbox.utils.FileUtils +import top.niunaijun.blackbox.utils.compat.BuildCompat +import java.io.File /** * @@ -10,9 +13,29 @@ import top.niunaijun.blackbox.app.configuration.ClientConfiguration * @CreateDate: 2021/5/23 14:04 */ class BlackDexConfiguration(private val context: Context) : ClientConfiguration() { + + companion object { + fun getDexDumpDir(context: Context): String { + return if (BuildCompat.isR()) { + val dump = File(context.externalCacheDir?.parentFile?.parentFile?.parentFile?.parentFile, "Download/dexDump") + FileUtils.mkdirs(dump) + dump.absolutePath + } else { + val dump = File(context.externalCacheDir?.parentFile, "dump") + FileUtils.mkdirs(dump) + dump.absolutePath + } + } + } + + private val dir = getDexDumpDir(context) + override fun getHostPackageName(): String { return context.packageName } + override fun getDexDumpDir(): String { + return dir + } } \ No newline at end of file diff --git a/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt b/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt deleted file mode 100644 index c78a117..0000000 --- a/app/src/main/java/top/niunaijun/blackdex/util/FileUtil.kt +++ /dev/null @@ -1,27 +0,0 @@ -package top.niunaijun.blackdex.util - -import top.niunaijun.blackbox.BlackBoxCore -import top.niunaijun.blackbox.utils.FileUtils -import top.niunaijun.blackbox.utils.compat.BuildCompat -import java.io.File - -/** - * - * @Description: - * @Author: wukaicheng - * @CreateDate: 2021/5/23 14:54 - */ -object FileUtil { - - fun getDexDumpDir(): String { - if (BuildCompat.isR()) { - val dump = File(BlackBoxCore.getContext().externalCacheDir?.parentFile?.parentFile?.parentFile, "Download/dexDump") - FileUtils.mkdirs(dump) - return dump.absolutePath - }else{ - val dump = File(BlackBoxCore.getContext().externalCacheDir?.parentFile, "dump") - FileUtils.mkdirs(dump) - return dump.absolutePath - } - } -} \ No newline at end of file