Xpose拦截系统toast

方法1:

XposedHelpers.findAndHookMethod("android.widget.Toast", lpparam.classLoader, "makeText", Context.class, CharSequence.class, int.class, new XC_MethodHook() {
    @Override
    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
        Object[] args = param.args;
        args[1]="你的弹框被替换了";
        param.args=args;
        super.beforeHookedMethod(param);
    }

    @Override
    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
        super.afterHookedMethod(param);
    }
});

方法2:

        XposedHelpers.findAndHookMethod("android.widget.Toast", lpparam.classLoader, "makeText", Context.class, CharSequence.class, int.class, new XC_MethodReplacement() {
            @Override
            protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
                Object[] args = param.args;
                args[1] = "你被劫持了111";

                return XposedBridge.invokeOriginalMethod(
                        param.method,
                        param.thisObject,
                        args
                );
            }
        });

主要hook toast的makeText方法,替换参数,实现拦截。

你可能感兴趣的:(逆向,android)