Try three times when setting classloader trusted

It may fail because of race, so try more as a temporary workaround
This commit is contained in:
LoveSy 2023-06-25 22:02:00 +08:00
parent 40845b3f74
commit 46558c6bc9
1 changed files with 8 additions and 1 deletions

View File

@ -21,7 +21,14 @@ public class OpenDexFileHooker extends XC_MethodHook {
}
while (classLoader != null) {
if (classLoader == XposedHelpers.class.getClassLoader()) {
HookBridge.setTrusted(param.getResult());
// it may fail because of race, try more
for (int i = 0; i < 3; i++) {
try {
HookBridge.setTrusted(param.getResult());
break;
} catch (SecurityException ignored) {
}
}
return;
} else {
classLoader = classLoader.getParent();