mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Added type function in YukiHookAPI.Status.Executor and add ExecutorType
This commit is contained in:
@@ -39,6 +39,7 @@ import com.highcapable.yukihookapi.YukiHookAPI.encase
|
||||
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiProperty
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.type.ExecutorType
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
@@ -193,6 +194,14 @@ object YukiHookAPI {
|
||||
else -> YukiXposedModuleStatus.executorName
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 类型
|
||||
*
|
||||
* - ❗在模块环境中需要启用 [Configs.isEnableHookModuleStatus]
|
||||
* @return [ExecutorType]
|
||||
*/
|
||||
val type get() = HookApiProperty.type.takeIf { isXposedEnvironment } ?: HookApiProperty.type(YukiXposedModuleStatus.executorName)
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 的 API 版本
|
||||
*
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.api.compat
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.type.ExecutorType
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
@@ -40,6 +41,15 @@ import de.robv.android.xposed.XposedBridge
|
||||
*/
|
||||
internal object HookApiProperty {
|
||||
|
||||
/** Xposed 框架名称 */
|
||||
internal const val XPOSED_NAME = "Xposed"
|
||||
|
||||
/** LSPosed 框架名称 */
|
||||
internal const val LSPOSED_NAME = "LSPosed"
|
||||
|
||||
/** EdXposed 框架名称 */
|
||||
internal const val ED_XPOSED_NAME = "EdXposed"
|
||||
|
||||
/** TaiChi (太极) Xposed 框架名称 */
|
||||
internal const val TAICHI_XPOSED_NAME = "TaiChi"
|
||||
|
||||
@@ -69,6 +79,26 @@ internal object HookApiProperty {
|
||||
HookApiCategory.UNKNOWN -> "unknown"
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 类型
|
||||
* @return [ExecutorType]
|
||||
*/
|
||||
internal val type get() = type()
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 类型
|
||||
* @param executorName Hook Framework 名称 - 默认为 [name]
|
||||
* @return [ExecutorType]
|
||||
*/
|
||||
internal fun type(executorName: String = name) = when (executorName) {
|
||||
BUG_XPOSED_NAME -> ExecutorType.BUG_XPOSED
|
||||
TAICHI_XPOSED_NAME -> ExecutorType.TAICHI_XPOSED
|
||||
ED_XPOSED_NAME -> ExecutorType.ED_XPOSED
|
||||
LSPOSED_NAME -> ExecutorType.LSPOSED_LSPATCH
|
||||
XPOSED_NAME -> ExecutorType.XPOSED
|
||||
else -> ExecutorType.UNKNOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 的 API 版本
|
||||
* @return [Int] 无法获取会返回 -1
|
||||
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* https://github.com/fankes/YukiHookAPI
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* This file is Created by fankes on 2023/4/16.
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.api.compat.type
|
||||
|
||||
/**
|
||||
* Hook Framework 类型定义
|
||||
*
|
||||
* 定义了目前已知使用频率较高的 Hook Framework
|
||||
*
|
||||
* 后期根据 Hook Framework 特征和使用情况将会继续添加新的类型
|
||||
*
|
||||
* 无法识别的 Hook Framework 将被定义为 [UNKNOWN]
|
||||
*/
|
||||
enum class ExecutorType {
|
||||
/** 未知类型 */
|
||||
UNKNOWN,
|
||||
|
||||
/** 原版、第三方 Xposed */
|
||||
XPOSED,
|
||||
|
||||
/** LSPosed、LSPatch */
|
||||
LSPOSED_LSPATCH,
|
||||
|
||||
/** EdXposed */
|
||||
ED_XPOSED,
|
||||
|
||||
/** TaiChi (太极) */
|
||||
TAICHI_XPOSED,
|
||||
|
||||
/** BugXposed (应用转生) */
|
||||
BUG_XPOSED
|
||||
}
|
Reference in New Issue
Block a user