Use null oat dir in root service only

This commit is contained in:
canyie 2023-01-11 23:38:50 +08:00 committed by John Wu
parent e73f87b758
commit 2839978cc1

View File

@ -1,5 +1,7 @@
package com.topjohnwu.magisk.utils;
import android.os.Process;
import java.io.File;
import java.io.IOException;
import java.net.URL;
@ -14,8 +16,8 @@ public class DynamicClassLoader extends BaseDexClassLoader {
}
public DynamicClassLoader(File apk, ClassLoader parent) {
// Set optimizedDirectory to null to bypass DexFile's security checks
super(apk.getPath(), null, null, parent);
// Set optimizedDirectory to null for RootService to bypass DexFile's security checks
super(apk.getPath(), Process.myUid() == 0 ? null : apk.getParentFile(), null, parent);
}
@Override