Delay application create
This commit is contained in:
parent
f082d0735c
commit
bc7826ba62
|
|
@ -101,7 +101,6 @@ public class LSPApplication extends ApplicationServiceClient {
|
||||||
|
|
||||||
instance = new LSPApplication();
|
instance = new LSPApplication();
|
||||||
serviceClient = instance;
|
serviceClient = instance;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
disableProfile(context);
|
disableProfile(context);
|
||||||
loadModules(context);
|
loadModules(context);
|
||||||
|
|
@ -113,6 +112,9 @@ public class LSPApplication extends ApplicationServiceClient {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(TAG, "Do hook", e);
|
Log.e(TAG, "Do hook", e);
|
||||||
}
|
}
|
||||||
|
if (isApplicationProxied()) {
|
||||||
|
instance.createOriginalApplication();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disableProfile(Context context) {
|
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();
|
File curProfileFile = new File(profileDir, splitName == null ? "primary.prof" : splitName + ".split.prof").getAbsoluteFile();
|
||||||
Log.d(TAG, "processing " + curProfileFile.getAbsolutePath());
|
Log.d(TAG, "processing " + curProfileFile.getAbsolutePath());
|
||||||
try {
|
try {
|
||||||
|
if (!curProfileFile.canWrite() && Files.size(curProfileFile.toPath()) == 0) {
|
||||||
|
Log.d(TAG, "skip profile " + curProfileFile.getAbsolutePath());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (curProfileFile.exists() && !curProfileFile.delete()) {
|
if (curProfileFile.exists() && !curProfileFile.delete()) {
|
||||||
try (var writer = new FileOutputStream(curProfileFile)) {
|
try (var writer = new FileOutputStream(curProfileFile)) {
|
||||||
Log.d(TAG, "failed to delete, try to clear content " + curProfileFile.getAbsolutePath());
|
Log.d(TAG, "failed to delete, try to clear content " + curProfileFile.getAbsolutePath());
|
||||||
|
|
@ -244,10 +250,6 @@ public class LSPApplication extends ApplicationServiceClient {
|
||||||
|
|
||||||
public LSPApplication() {
|
public LSPApplication() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (isApplicationProxied()) {
|
|
||||||
createOriginalApplication();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isApplicationProxied() {
|
private static boolean isApplicationProxied() {
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,6 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':share')
|
implementation project(':share')
|
||||||
|
implementation 'de.upb.cs.swt:axml:2.1.1'
|
||||||
compileOnly project(":hiddenapi-stubs")
|
compileOnly project(":hiddenapi-stubs")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue