Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[无法复现] before 和 after 替换 result 无效的问题 #37

Closed
buffcow opened this issue Apr 30, 2023 · 4 comments
Closed

[无法复现] before 和 after 替换 result 无效的问题 #37

buffcow opened this issue Apr 30, 2023 · 4 comments
Labels
question Further information is requested

Comments

@buffcow
Copy link
Contributor

buffcow commented Apr 30, 2023

突然又发现了一个bug,before 和 after 的回调里替换 result 无效。

  • 例子:实现功能:
    将状态栏的 NFC 磁贴 替换成 蓝牙
  1. 我用yuki写的:
"com.android.systemui.qs.QSTileHost".hook {
            injectMember {
                method { name = "createTile"; param(StringClass) }
                beforeHook {
                    if (args(0).string() == "nfc") {
                        val tile = XposedHelpers.callMethod(instance, "createTile", "bt")
                        result = tile
                    }
                }
            }
        }
}

效果:
86b5b1440dcbe68015b62465ed55797

无效


  1. 我用原生 xp 写的
        XposedHelpers.findAndHookMethod("com.android.systemui.qs.QSTileHost".toClass(), "createTile", String::class.java, object : XC_MethodHook() {
            override fun beforeHookedMethod(param: MethodHookParam) {
                    super.beforeHookedMethod(param)
                    if (param.args[0] == "nfc") {
                        val tile = XposedHelpers.callMethod(param.thisObject, "createTile", "bt")
                        param.result = tile
                    }
                }
        })

效果:
a7ed2e1678e59e26f5153927e257736

有效

@fankes
Copy link
Collaborator

fankes commented Apr 30, 2023

错误的用法,你可以把 XposedHelpers 丢掉了

@buffcow
Copy link
Contributor Author

buffcow commented Apr 30, 2023

错误的用法,你可以把 XposedHelpers 丢掉了

可是我用了 method.invoke(instance, "bt") 也是不行的

@fankes
Copy link
Collaborator

fankes commented Apr 30, 2023

错误的用法,你可以把 XposedHelpers 丢掉了

可是我用了 method.invoke(instance, "bt") 也是不行的

callOriginal,因为不知道你是不是重新调用的原始方法。
这里不常回复,有问题请电报群反馈。

@fankes fankes changed the title before 和 after 替换 result 无效的问题 [NSQ] before 和 after 替换 result 无效的问题 Apr 30, 2023
@fankes fankes added the question Further information is requested label Apr 30, 2023
@fankes
Copy link
Collaborator

fankes commented Apr 30, 2023

后期调整到 #33

@fankes fankes changed the title [NSQ] before 和 after 替换 result 无效的问题 [无法复现] before 和 after 替换 result 无效的问题 Apr 30, 2023
@fankes fankes closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants