Fix file permissions for Android 14 (#201)

Dex file should not be writable, otherwise it causes
java.lang.SecurityException.

Here is the related [soucre
code](https://cs.android.com/android/platform/superproject/+/master:art/runtime/native/dalvik_system_DexFile.cc;l=381)
of Android 14.

---------

Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
JingMatrix 2023-06-07 18:11:47 +02:00 committed by GitHub
parent d2b1de7ba5
commit 5d927f1dd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -137,6 +137,7 @@ public class LSPApplication {
Files.copy(is, cacheApkPath); Files.copy(is, cacheApkPath);
} }
} }
cacheApkPath.toFile().setWritable(false);
var mPackages = (Map<?, ?>) XposedHelpers.getObjectField(activityThread, "mPackages"); var mPackages = (Map<?, ?>) XposedHelpers.getObjectField(activityThread, "mPackages");
mPackages.remove(appInfo.packageName); mPackages.remove(appInfo.packageName);