Cleanup (#2404)
This commit is contained in:
parent
0b613f7226
commit
c7f39e0e5d
|
|
@ -69,7 +69,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
|
@ -82,7 +81,6 @@ public class ConfigFileManager {
|
|||
static final Path modulePath = basePath.resolve("modules");
|
||||
static final Path daemonApkPath = Paths.get(System.getProperty("java.class.path", null));
|
||||
static final Path managerApkPath = basePath.resolve("manager.apk");
|
||||
static final Path dummyPath = Paths.get("/", UUID.randomUUID().toString());
|
||||
static final File magiskDbPath = new File("/data/adb/magisk.db");
|
||||
private static final Path lockPath = basePath.resolve("lock");
|
||||
private static final Path configDirPath = basePath.resolve("config");
|
||||
|
|
@ -240,7 +238,7 @@ public class ConfigFileManager {
|
|||
return logDirPath.resolve("kmsg.log").toFile();
|
||||
}
|
||||
|
||||
static void getLogs(ParcelFileDescriptor zipFd) {
|
||||
static void getLogs(ParcelFileDescriptor zipFd) throws IllegalStateException {
|
||||
try (var os = new ZipOutputStream(new FileOutputStream(zipFd.getFileDescriptor()))) {
|
||||
var comment = String.format(Locale.ROOT, "LSPosed %s %s (%d)",
|
||||
BuildConfig.BUILD_TYPE, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE);
|
||||
|
|
@ -253,14 +251,16 @@ public class ConfigFileManager {
|
|||
zipAddProcOutput(os, "full.log", "logcat", "-b", "all", "-d");
|
||||
zipAddProcOutput(os, "dmesg.log", "dmesg");
|
||||
var magiskDataDir = Paths.get("/data/adb");
|
||||
Files.list(magiskDataDir.resolve("modules")).forEach(p -> {
|
||||
zipAddFile(os, p, magiskDataDir);
|
||||
zipAddFile(os, p.resolve("module.prop"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("remove"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("disable"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("update"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("sepolicy.rule"), magiskDataDir);
|
||||
});
|
||||
try (var l = Files.list(magiskDataDir.resolve("modules"))) {
|
||||
l.forEach(p -> {
|
||||
zipAddFile(os, p, magiskDataDir);
|
||||
zipAddFile(os, p.resolve("module.prop"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("remove"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("disable"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("update"), magiskDataDir);
|
||||
zipAddFile(os, p.resolve("sepolicy.rule"), magiskDataDir);
|
||||
});
|
||||
}
|
||||
ConfigManager.getInstance().exportScopes(os);
|
||||
} catch (Throwable e) {
|
||||
Log.w(TAG, "get log", e);
|
||||
|
|
@ -332,7 +332,8 @@ public class ConfigFileManager {
|
|||
return memory;
|
||||
}
|
||||
|
||||
private static void readDexes(ZipFile apkFile, List<SharedMemory> preLoadedDexes, boolean obfuscate) {
|
||||
private static void readDexes(ZipFile apkFile, List<SharedMemory> preLoadedDexes,
|
||||
boolean obfuscate) {
|
||||
int secondary = 2;
|
||||
for (var dexFile = apkFile.getEntry("classes.dex"); dexFile != null;
|
||||
dexFile = apkFile.getEntry("classes" + secondary + ".dex"), secondary++) {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ import java.util.ArrayList;
|
|||
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
public class Dex2OatService implements Runnable {
|
||||
public static final String PROP_NAME = "dalvik.vm.dex2oat-flags";
|
||||
public static final String PROP_VALUE = "--inline-max-code-units=0";
|
||||
private static final String TAG = "LSPosedDex2Oat";
|
||||
private static final String WRAPPER32 = "bin/dex2oat32";
|
||||
private static final String WRAPPER64 = "bin/dex2oat64";
|
||||
|
|
|
|||
|
|
@ -218,14 +218,12 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
private void ensureWebViewPermission() {
|
||||
try {
|
||||
var pkgInfo = PackageService.getPackageInfo(BuildConfig.MANAGER_INJECTED_PKG_NAME, 0, 0);
|
||||
File cacheDir = null;
|
||||
if (pkgInfo != null) {
|
||||
cacheDir = new File(HiddenApiBridge.ApplicationInfo_credentialProtectedDataDir(pkgInfo.applicationInfo) + "/cache");
|
||||
var cacheDir = new File(HiddenApiBridge.ApplicationInfo_credentialProtectedDataDir(pkgInfo.applicationInfo) + "/cache");
|
||||
// The cache directory does not exist after `pm clear`
|
||||
cacheDir.mkdirs();
|
||||
ensureWebViewPermission(cacheDir);
|
||||
}
|
||||
|
||||
// The cache directory does not exist after `pm clear`
|
||||
cacheDir.mkdirs();
|
||||
ensureWebViewPermission(cacheDir);
|
||||
} catch (Throwable e) {
|
||||
Log.w(TAG, "cannot ensure webview dir", e);
|
||||
}
|
||||
|
|
@ -530,7 +528,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
|
||||
@Override
|
||||
public boolean dex2oatFlagsLoaded() {
|
||||
return SystemProperties.get(Dex2OatService.PROP_NAME).contains(Dex2OatService.PROP_VALUE);
|
||||
return SystemProperties.get("dalvik.vm.dex2oat-flags").contains("--inline-max-code-units=0");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue