Delay application create

This commit is contained in:
LoveSy 2021-06-23 19:33:22 +08:00
parent f082d0735c
commit bc7826ba62
2 changed files with 8 additions and 5 deletions

View File

@ -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() {

View File

@ -51,5 +51,6 @@ android {
dependencies {
implementation project(':share')
implementation 'de.upb.cs.swt:axml:2.1.1'
compileOnly project(":hiddenapi-stubs")
}