Modify remove args function in Param in YukiBridgeFactory

This commit is contained in:
2022-09-27 00:25:41 +08:00
parent 4177a27387
commit f4b2a3fd5f
3 changed files with 2 additions and 13 deletions

View File

@@ -380,7 +380,7 @@ class HookParam internal constructor(private val creatorInstance: YukiMemberHook
if (index < 0) error("HookParam Method args index must be >= 0")
if (args.isEmpty()) error("HookParam Method args is empty, mabe not has args")
if (index > args.lastIndex) error("HookParam Method args index out of bounds, max is ${args.lastIndex}")
param?.args(index, any)
param?.args?.set(index, any)
}
/**

View File

@@ -183,10 +183,6 @@ internal object YukiHookHelper {
set(value) {
this@compat.throwable = value
}
override fun args(index: Int, value: Any?) {
this@compat.args[index] = value
}
}
}
@@ -298,12 +294,5 @@ internal abstract class YukiHookCallback(open val priority: Int) {
* @throws Throwable
*/
var throwable: Throwable?
/**
* 设置方法参数
* @param index 数组下标
* @param value 参数对象实例
*/
fun args(index: Int, value: Any?)
}
}

View File

@@ -140,7 +140,7 @@ internal object AppParasitics {
if (YukiHookAPI.Configs.isEnableHookSharedPreferences && type == HookEntryType.PACKAGE)
YukiHookHelper.hook(ContextImplClass.method { name = "setFilePermissionsFromMode" }, object : YukiMemberHook() {
override fun beforeHookedMember(param: Param) {
if ((param.args?.get(0) as? String?)?.endsWith(suffix = "preferences.xml") == true) param.args(index = 1, value = 1)
if ((param.args?.get(0) as? String?)?.endsWith(suffix = "preferences.xml") == true) param.args?.set(1, 1)
}
})
if (YukiHookAPI.Configs.isEnableHookModuleStatus) classOf<YukiHookModuleStatus>(loader).apply {