mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Added "isUsingResourcesHook" function in InjectYukiHookWithXposed
This commit is contained in:
@@ -34,6 +34,7 @@ import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import com.highcapable.yukihookapi.YukiHookAPI.configs
|
||||
import com.highcapable.yukihookapi.YukiHookAPI.encase
|
||||
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.MethodFinder
|
||||
@@ -143,6 +144,8 @@ object YukiHookAPI {
|
||||
* - ❗在模块环境中需要启用 [Configs.isEnableHookModuleStatus]
|
||||
*
|
||||
* - ❗在 Xposed 环境中可能会延迟等待事件回调后才会返回 true
|
||||
*
|
||||
* - ❗请注意你需要确保 [InjectYukiHookWithXposed.isUsingResourcesHook] 已启用 - 否则始终返回 false
|
||||
* @return [Boolean] 是否支持
|
||||
*/
|
||||
val isSupportResourcesHook
|
||||
|
@@ -29,6 +29,7 @@ package com.highcapable.yukihookapi.annotation.xposed
|
||||
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||
import de.robv.android.xposed.IXposedHookInitPackageResources
|
||||
|
||||
/**
|
||||
* 标识 [YukiHookAPI] 注入 Xposed 入口的类注解
|
||||
@@ -61,10 +62,12 @@ import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||
* @param sourcePath 你的项目 source 相对路径 - 默认为 ..src/main..
|
||||
* @param modulePackageName 模块包名 - 使用标准路径可不填会自动生成
|
||||
* @param entryClassName 定义 [YukiHookAPI] 自动生成 Xposed 模块入口类的名称 - 不填默认使用 HookEntryClass_YukiHookXposedInit 进行生成
|
||||
* @param isUsingResourcesHook 是否启用 Resources Hook (资源钩子) - 启用后将自动注入 [IXposedHookInitPackageResources] - 默认是
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class InjectYukiHookWithXposed(
|
||||
val sourcePath: String = "src/main",
|
||||
val modulePackageName: String = "",
|
||||
val entryClassName: String = ""
|
||||
val entryClassName: String = "",
|
||||
val isUsingResourcesHook: Boolean = true
|
||||
)
|
@@ -36,6 +36,7 @@ import android.content.pm.ApplicationInfo
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
||||
import com.highcapable.yukihookapi.hook.bean.HookClass
|
||||
import com.highcapable.yukihookapi.hook.bean.HookResources
|
||||
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||
@@ -375,6 +376,8 @@ open class PackageParam internal constructor(@PublishedApi internal var wrapper:
|
||||
|
||||
/**
|
||||
* Hook APP 的 Resources
|
||||
*
|
||||
* - ❗请注意你需要确保当前 Hook Framework 支持且 [InjectYukiHookWithXposed.isUsingResourcesHook] 已启用
|
||||
* @param initiate 方法体
|
||||
*/
|
||||
inline fun HookResources.hook(initiate: YukiResourcesHookCreater.() -> Unit) =
|
||||
|
Reference in New Issue
Block a user