diff --git a/buildSrc/src/main/java/Codegen.kt b/buildSrc/src/main/java/Codegen.kt index 017316437..f2a8abd9c 100644 --- a/buildSrc/src/main/java/Codegen.kt +++ b/buildSrc/src/main/java/Codegen.kt @@ -76,9 +76,6 @@ fun genKeyData(keysDir: File, outSrc: File) { fun genStubManifest(srcDir: File, outDir: File): String { outDir.deleteRecursively() - val mainPkgDir = File(outDir, "com/topjohnwu/magisk") - mainPkgDir.mkdirs() - fun String.ind(level: Int) = replaceIndentByMargin(" ".repeat(level)) val cmpList = mutableListOf() @@ -195,7 +192,7 @@ fun genStubManifest(srcDir: File, outDir: File): String { val clzName = genCmpName() val (pkg, name) = clzName.split('.') val pkgDir = File(outDir, pkg) - pkgDir.mkdir() + pkgDir.mkdirs() PrintStream(File(pkgDir, "$name.java")).use { it.println("package $pkg;") it.println("public class $name extends com.topjohnwu.magisk.$type {}") @@ -220,6 +217,7 @@ fun genStubManifest(srcDir: File, outDir: File): String { fun genEncryptedResources(res: InputStream, outDir: File) { val mainPkgDir = File(outDir, "com/topjohnwu/magisk") + mainPkgDir.mkdirs() // Generate iv and key val iv = ByteArray(16) diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt index 1091bf881..e2373f27c 100644 --- a/buildSrc/src/main/java/Setup.kt +++ b/buildSrc/src/main/java/Setup.kt @@ -188,8 +188,6 @@ fun Project.setupStub() { val apkTmp = File("${apk}.tmp") val genManifestTask = tasks.register("generate${variantCapped}ObfuscatedManifest") { - inputs.property("versionCode", Config.versionCode) - outputs.file(manifest) doLast { val xml = genStubManifest(templateDir, outSrcDir) manifest.parentFile.mkdirs() diff --git a/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java b/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java index 3514bcb9b..644d93238 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java @@ -108,11 +108,11 @@ public class DynLoad { int flags = PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES | PackageManager.GET_PROVIDERS | PackageManager.GET_RECEIVERS; + var pm = context.getPackageManager(); final PackageInfo info; try { - info = context.getPackageManager() - .getPackageInfo(context.getPackageName(), flags); + info = pm.getPackageInfo(context.getPackageName(), flags); } catch (PackageManager.NameNotFoundException e) { // Impossible throw new RuntimeException(e); @@ -122,8 +122,7 @@ public class DynLoad { final var cl = loadApk(context); if (cl != null) try { - var pkgInfo = context.getPackageManager() - .getPackageArchiveInfo(apk.getPath(), flags); + var pkgInfo = pm.getPackageArchiveInfo(apk.getPath(), flags); cl.updateComponentMap(info, pkgInfo); var appInfo = pkgInfo.applicationInfo;