diff --git a/app/src/main/java/org/lsposed/lspatch/loader/LSPApplication.java b/app/src/main/java/org/lsposed/lspatch/loader/LSPApplication.java index 9b7585f..80ae1e8 100644 --- a/app/src/main/java/org/lsposed/lspatch/loader/LSPApplication.java +++ b/app/src/main/java/org/lsposed/lspatch/loader/LSPApplication.java @@ -101,7 +101,6 @@ public class LSPApplication extends ApplicationServiceClient { instance = new LSPApplication(); serviceClient = instance; - try { disableProfile(context); loadModules(context); @@ -113,6 +112,9 @@ public class LSPApplication extends ApplicationServiceClient { } catch (Throwable e) { Log.e(TAG, "Do hook", e); } + if (isApplicationProxied()) { + instance.createOriginalApplication(); + } } public static void disableProfile(Context context) { @@ -142,6 +144,10 @@ public class LSPApplication extends ApplicationServiceClient { File curProfileFile = new File(profileDir, splitName == null ? "primary.prof" : splitName + ".split.prof").getAbsoluteFile(); Log.d(TAG, "processing " + curProfileFile.getAbsolutePath()); try { + if (!curProfileFile.canWrite() && Files.size(curProfileFile.toPath()) == 0) { + Log.d(TAG, "skip profile " + curProfileFile.getAbsolutePath()); + continue; + } if (curProfileFile.exists() && !curProfileFile.delete()) { try (var writer = new FileOutputStream(curProfileFile)) { Log.d(TAG, "failed to delete, try to clear content " + curProfileFile.getAbsolutePath()); @@ -244,10 +250,6 @@ public class LSPApplication extends ApplicationServiceClient { public LSPApplication() { super(); - - if (isApplicationProxied()) { - createOriginalApplication(); - } } private static boolean isApplicationProxied() { diff --git a/appstub/build.gradle b/appstub/build.gradle index a24c6f9..db21a89 100644 --- a/appstub/build.gradle +++ b/appstub/build.gradle @@ -51,5 +51,6 @@ android { dependencies { implementation project(':share') + implementation 'de.upb.cs.swt:axml:2.1.1' compileOnly project(":hiddenapi-stubs") }