mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 10:05:23 +00:00
Minor changes
This commit is contained in:
parent
b7fc15d399
commit
2414d5d7f5
@ -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<String>()
|
||||
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user