13 KiB
pageClass
pageClass |
---|
code-page |
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the Chrome Translation Plugin to translate entire pages for reference.
:::
YukiHookAPI - object
object YukiHookAPI
Change Records
v1.0
first
Function Illustrate
这是
YukiHookAPI
的 API 调用总类,Hook 相关功能的开始、Hook 相关功能的配置都在这里。
API_VERSION_NAME - field
const val API_VERSION_NAME: String
Change Records
v1.0.4
added
Function Illustrate
获取当前
YukiHookAPI
的版本。
API_VERSION_CODE - field
const val API_VERSION_CODE: Int
Change Records
v1.0.4
added
Function Illustrate
获取当前
YukiHookAPI
的版本号。
executorName - field
Change Records
v1.0.5
added
v1.0.91
removed
请转移到 Status.Executor.name
executorVersion - field
Change Records
v1.0.5
added
v1.0.91
removed
请转移到 Status.Executor.apiLevel
、Status.Executor.versionName
、Status.Executor.versionCode
Status - object
object Status
Change Records
v1.0.91
added
Function Illustrate
当前
YukiHookAPI
的状态。
compiledTimestamp - field
val compiledTimestamp: Long
Change Records
v1.1.0
added
Function Illustrate
获取项目编译完成的时间戳 (当前本地时间)。
isXposedEnvironment - field
val isXposedEnvironment: Boolean
Change Records
v1.1.0
added
Function Illustrate
获取当前是否为 (Xposed) 宿主环境。
executorName - field
Change Records
v1.0.91
added
v1.1.5
deprecated
请转移到 Executor.name
executorVersion - field
Change Records
v1.0.91
added
v1.1.5
deprecated
请转移到 Executor.apiLevel
、Executor.versionName
、Executor.versionCode
isModuleActive - field
val isModuleActive: Boolean
Change Records
v1.0.91
added
Function Illustrate
判断模块是否在 Xposed 或太极、无极中激活。
::: warning
在模块环境中你需要将 Application 继承于 ModuleApplication。
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
在 (Xposed) 宿主环境中仅返回非 isTaiChiModuleActive 的激活状态。
:::
isXposedModuleActive - field
val isXposedModuleActive: Boolean
Change Records
v1.0.91
added
Function Illustrate
仅判断模块是否在 Xposed 中激活。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
在 (Xposed) 宿主环境中始终返回 true。
:::
isTaiChiModuleActive - field
val isTaiChiModuleActive: Boolean
Change Records
v1.0.91
added
Function Illustrate
仅判断模块是否在太极、无极中激活。
::: warning
在模块环境中你需要将 Application 继承于 ModuleApplication。
在 (Xposed) 宿主环境中始终返回 false。
:::
isSupportResourcesHook - field
val isSupportResourcesHook: Boolean
Change Records
v1.0.91
added
Function Illustrate
判断当前 Hook Framework 是否支持资源钩子(Resources Hook)。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
在 (Xposed) 宿主环境中可能会延迟等待事件回调后才会返回 true。
请注意你需要确保 InjectYukiHookWithXposed.isUsingResourcesHook 已启用,否则始终返回 false。
:::
Executor - object
object Executor
Change Records
v1.1.5
added
Function Illustrate
当前
YukiHookAPI
使用的 Hook Framework 相关信息。
name - field
val name: String
Change Records
v1.1.5
added
Function Illustrate
获取当前 Hook Framework 名称。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
:::
type - field
val type: ExecutorType
Change Records
v1.1.9
added
Function Illustrate
获取当前 Hook Framework 类型。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
:::
apiLevel - field
val apiLevel: Int
Change Records
v1.1.5
added
Function Illustrate
获取当前 Hook Framework 的 API 版本。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
:::
versionName - field
val versionName: String
Change Records
v1.1.5
added
Function Illustrate
获取当前 Hook Framework 版本名称。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
:::
versionCode - field
val versionCode: Int
Change Records
v1.1.5
added
Function Illustrate
获取当前 Hook Framework 版本号。
::: warning
在模块环境中需要启用 Configs.isEnableHookModuleStatus。
:::
Configs - object
object Configs
Change Records
v1.0
first
Function Illustrate
对 API 相关功能的配置类。
debugLog - method
inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit)
Change Records
v1.1.0
added
Function Illustrate
配置
YukiHookLogger.Configs
相关参数。
debugTag - field
Change Records
v1.0
first
v1.1.0
deprecated
请转移到 YukiHookLogger.Configs.tag
isDebug - field
var isDebug: Boolean
Change Records
v1.0
first
Function Illustrate
是否启用 Debug 模式。
默认为开启状态,开启后模块将会向 Logcat
和 (Xposed) 宿主环境中的日志功能打印详细的 Hook 日志,关闭后仅会打印 E
级别的日志。
isAllowPrintingLogs - field
Change Records
v1.0.4
added
v1.1.0
deprecated
请转移到 YukiHookLogger.Configs.isEnable
isEnableModulePrefsCache - field
Change Records
v1.0.5
added
v1.1.9
deprecated
请转移到 isEnablePrefsBridgeCache
isEnablePrefsBridgeCache - field
Change Records
v1.1.9
added
v1.1.11
deprecated
键值的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
isEnableModuleAppResourcesCache - field
var isEnableModuleAppResourcesCache: Boolean
Change Records
v1.0.87
added
Function Illustrate
是否启用当前 Xposed 模块自身
Resources
缓存功能。
为防止内存复用过高问题,此功能默认启用。
你可以手动调用 PackageParam.refreshModuleAppResources
来刷新缓存。
::: warning
关闭后每次使用 PackageParam.moduleAppResources 都会重新创建,可能会造成运行缓慢。
:::
isEnableHookModuleStatus - field
var isEnableHookModuleStatus: Boolean
Change Records
v1.0.88
added
Function Illustrate
是否启用 Hook Xposed 模块激活等状态功能.
为原生支持 Xposed 模块激活状态检测,此功能默认启用。
::: warning
关闭后你将不能再在模块环境中使用 YukiHookAPI.Status 中的激活状态判断功能。
:::
isEnableHookSharedPreferences - field
var isEnableHookSharedPreferences: Boolean
Change Records
v1.1.0
added
Function Illustrate
是否启用 Hook
SharedPreferences
。
启用后将在模块启动时强制将 SharedPreferences
文件权限调整为 Context.MODE_WORLD_READABLE
(0664)。
::: warning
这是一个可选的实验性功能,此功能默认不启用。
仅用于修复某些系统可能会出现在启用了 New XSharedPreferences 后依然出现文件权限错误问题,若你能正常使用 YukiHookPrefsBridge 就不建议启用此功能。
:::
isEnableDataChannel - field
var isEnableDataChannel: Boolean
Change Records
v1.0.88
added
Function Illustrate
是否启用当前 Xposed 模块与宿主交互的
YukiHookDataChannel
功能。
请确保 Xposed 模块的 Application
继承于 ModuleApplication
才能有效。
此功能默认启用,关闭后将不会在功能初始化的时候装载 YukiHookDataChannel
。
isEnableMemberCache - field
Change Records
v1.0.68
added
v1.1.11
deprecated
Member
的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
configs - method
inline fun configs(initiate: Configs.() -> Unit)
Change Records
v1.0
first
v1.0.80
modified
将方法体进行 inline
Function Illustrate
对
Configs
类实现了一个 lambda 方法体。
你可以轻松地调用它进行配置。
Function Example
你可以在 Hook 入口类的 onInit
方法中调用 configs
方法和 debugLog
方法完成对 API 的功能配置,实时生效。
The following example
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
YukiHookAPI.configs {
debugLog {
tag = "YukiHookAPI"
isEnable = true
isRecord = false
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
}
isDebug = BuildConfig.DEBUG
isEnableModuleAppResourcesCache = true
isEnableHookModuleStatus = true
isEnableHookSharedPreferences = false
isEnableDataChannel = true
}
}
override fun onHook() {
// Your code here.
}
}
若觉得上面的写法不美观,你还可以写得更加简洁。
The following example
object HookEntry : IYukiHookXposedInit {
override fun onInit() = configs {
debugLog {
tag = "YukiHookAPI"
isEnable = true
isRecord = false
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
}
isDebug = BuildConfig.DEBUG
isEnableModuleAppResourcesCache = true
isEnableHookModuleStatus = true
isEnableHookSharedPreferences = false
isEnableDataChannel = true
}
override fun onHook() {
// Your code here.
}
}
你也可以不通过 configs
和 debugLog
方法,直接进行配置。
The following example
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
YukiHookLogger.Configs.tag = "YukiHookAPI"
YukiHookLogger.Configs.isEnable = true
YukiHookLogger.Configs.isRecord = false
YukiHookLogger.Configs.elements(
YukiHookLogger.Configs.TAG,
YukiHookLogger.Configs.PRIORITY,
YukiHookLogger.Configs.PACKAGE_NAME,
YukiHookLogger.Configs.USER_ID
)
YukiHookAPI.Configs.isDebug = BuildConfig.DEBUG
YukiHookAPI.Configs.isEnableModuleAppResourcesCache = true
YukiHookAPI.Configs.isEnableHookModuleStatus = true
YukiHookAPI.Configs.isEnableHookSharedPreferences = false
YukiHookAPI.Configs.isEnableDataChannel = true
}
override fun onHook() {
// Your code here.
}
}
encase - method
fun encase(initiate: PackageParam.() -> Unit)
fun encase(vararg hooker: YukiBaseHooker)
fun encase(baseContext: Context?, initiate: PackageParam.() -> Unit)
fun encase(baseContext: Context?, vararg hooker: YukiBaseHooker)
Change Records
v1.0
first
Function Illustrate
装载 Hook 入口的核心方法。
Function Example
详情请参考