Fix null classloader
This commit is contained in:
parent
bfd4fb12d0
commit
5a16a34cd8
|
|
@ -182,7 +182,16 @@ public class LSPApplication extends ApplicationServiceClient {
|
||||||
}
|
}
|
||||||
Log.i(TAG, "hooked app initialized: " + appLoadedApk);
|
Log.i(TAG, "hooked app initialized: " + appLoadedApk);
|
||||||
|
|
||||||
return (Context) XposedHelpers.callStaticMethod(Class.forName("android.app.ContextImpl"), "createAppContext", activityThread, stubLoadedApk);
|
var context = (Context) XposedHelpers.callStaticMethod(Class.forName("android.app.ContextImpl"), "createAppContext", activityThread, stubLoadedApk);
|
||||||
|
if (config.appComponentFactory != null) {
|
||||||
|
try {
|
||||||
|
context.getClassLoader().loadClass(config.appComponentFactory);
|
||||||
|
} catch (ClassNotFoundException e) { // This will happen on some strange shells like 360
|
||||||
|
Log.w(TAG, "Original AppComponentFactory not found: " + config.appComponentFactory);
|
||||||
|
appInfo.appComponentFactory = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return context;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(TAG, "createLoadedApk", e);
|
Log.e(TAG, "createLoadedApk", e);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,7 @@ public class LSPatch {
|
||||||
var pair = ManifestParser.parseManifestFile(is);
|
var pair = ManifestParser.parseManifestFile(is);
|
||||||
if (pair == null)
|
if (pair == null)
|
||||||
throw new PatchError("Failed to parse AndroidManifest.xml");
|
throw new PatchError("Failed to parse AndroidManifest.xml");
|
||||||
appComponentFactory = pair.appComponentFactory == null ? "" : pair.appComponentFactory;
|
appComponentFactory = pair.appComponentFactory;
|
||||||
|
|
||||||
logger.d("original appComponentFactory class: " + appComponentFactory);
|
logger.d("original appComponentFactory class: " + appComponentFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue