Last active
September 13, 2024 09:09
-
-
Save Forgo7ten/001dfe796a3b7116fcd188f8e5913a12 to your computer and use it in GitHub Desktop.
roysue分享的xposed万能代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 被hook的app的包名 | |
String hookedPackageName = "com.xekvhaDYe.androie"; | |
// app里面的Activity | |
String hookedActivityName = "com.xekvhaDYu.android.a.MainActivity"; | |
if (hookedPackageName.equals(lpparam.packageName)) { | |
XposedBridge.log("has hooked..."); | |
XposedBridge.log("inner => " + lpparam.processName); | |
Class ActivityThread = XposedHelpers.findClass("android.app.ActivityThread", lpparam.classLoader); | |
XposedBridge.hookAllMethods(ActivityThread, "performLaunchActivity", new XC_MethodHook() { | |
@Override | |
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | |
super.afterHookedMethod(param); | |
Object mInitialApplication = (Application) XposedHelpers.getObjectField(param.thisObject, "mInitialApplication"); | |
ClassLoader finalCL = (ClassLoader) XposedHelpers.callMethod(mInitialApplication, "getClassLoader"); | |
XposedBridge.log("found classload is => " + finalCL.toString()); | |
Class BabyMain = (Class) XposedHelpers.callMethod(finalCL, "findClass", hookedActivityName); | |
XposedBridge.log("found final class is => " + BabyMain.getName().toString()); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment