MCPcopy Create free account
hub / github.com/cinit/TMoe / doInit

Method doInit

app/src/main/java/cc/ioctl/tmoe/startup/StartupHook.java:40–86  ·  view source on GitHub ↗
(ClassLoader rtLoader)

Source from the content-addressed store, hash-verified

38 }
39
40 public void doInit(ClassLoader rtLoader) {
41 // our minSdk is 21 so there is no need to wait for MultiDex to initialize
42 if (sPre1Initialized) {
43 return;
44 }
45 if (rtLoader == null) {
46 throw new AssertionError("StartupHook.doInit: rtLoader == null");
47 }
48 Class<?> applicationClass = null;
49 try {
50 applicationClass = rtLoader.loadClass("org.telegram.messenger.ApplicationLoader");
51 } catch (ClassNotFoundException ignored) {
52 }
53 if (applicationClass == null) {
54 try {
55 applicationClass = rtLoader.loadClass("org.thunderdog.challegram.BaseApplication");
56 } catch (ClassNotFoundException ignored) {
57 }
58 }
59 if (applicationClass == null) {
60 throw new AssertionError("StartupHook.doInit: unable to find ApplicationLoader");
61 }
62 XposedHelpers.findAndHookMethod(applicationClass, "onCreate", new XC_MethodHook(51) {
63 @Override
64 protected void beforeHookedMethod(MethodHookParam param) {
65 Application app = (Application) param.thisObject;
66 if (app == null) {
67 throw new AssertionError("app == null");
68 }
69 NativeLoader.loadAllSharedLibraries(app);
70 if (!NativeLoader.isNativeLibraryLoaded()) {
71 throw new AssertionError("NativeLoader.isNativeLibraryLoaded() == false");
72 }
73 StartupRoutine.execPreStartupInit(app, null, false);
74 }
75
76 @Override
77 protected void afterHookedMethod(MethodHookParam param) {
78 if (sPost2Initialized) {
79 return;
80 }
81 StartupRoutine.execPostStartupInit();
82 sPost2Initialized = true;
83 }
84 });
85 sPre1Initialized = true;
86 }
87}

Callers 1

handleLoadPackageMethod · 0.80

Calls 1

loadClassMethod · 0.45

Tested by

no test coverage detected