mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
refactor: big modified
- update dependencies - migration reflection api to KavaRef - merge to new api usage
This commit is contained in:
@@ -41,7 +41,9 @@ android {
|
||||
dependencies {
|
||||
compileOnly(de.robv.android.xposed.api)
|
||||
compileOnly(projects.yukihookapiStub)
|
||||
implementation(com.github.tiann.freeReflection)
|
||||
implementation(org.lsposed.hiddenapibypass.hiddenapibypass)
|
||||
implementation(com.highcapable.kavaref.kavaref.core)
|
||||
implementation(com.highcapable.kavaref.kavaref.extension)
|
||||
implementation(androidx.core.core.ktx)
|
||||
implementation(androidx.appcompat.appcompat)
|
||||
implementation(androidx.preference.preference.ktx)
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/4/4.
|
||||
*/
|
||||
@file:Suppress("unused", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress("unused", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.bean
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.generic
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
@@ -36,6 +37,7 @@ import com.highcapable.yukihookapi.hook.factory.method
|
||||
* @param classSet 当前实例的 [Class]
|
||||
* @param instance 当前实例本身
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class CurrentClass internal constructor(private val classSet: Class<*>, internal val instance: Any) {
|
||||
|
||||
/** 是否开启忽略错误警告功能 */
|
||||
@@ -45,12 +47,14 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* 获得当前 [classSet] 的 [Class.getName]
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val name get() = classSet.name ?: instance.javaClass.name ?: ""
|
||||
|
||||
/**
|
||||
* 获得当前 [classSet] 的 [Class.getSimpleName]
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val simpleName get() = classSet.simpleName ?: instance.javaClass.simpleName ?: ""
|
||||
|
||||
/**
|
||||
@@ -59,6 +63,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* 如果当前实例不存在泛型将返回 null
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun generic() = classSet.generic()
|
||||
|
||||
/**
|
||||
@@ -68,12 +73,14 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 实例方法体
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun generic(initiate: GenericClass.() -> Unit) = classSet.generic(initiate)
|
||||
|
||||
/**
|
||||
* 调用父类实例
|
||||
* @return [SuperClass]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun superClass() = SuperClass(classSet.superclass)
|
||||
|
||||
/**
|
||||
@@ -81,6 +88,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 查找方法体
|
||||
* @return [FieldFinder.Result.Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun field(initiate: FieldConditions) = classSet.field(initiate).result { if (isIgnoreErrorLogs) ignored() }.get(instance)
|
||||
|
||||
/**
|
||||
@@ -88,6 +96,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 查找方法体
|
||||
* @return [MethodFinder.Result.Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun method(initiate: MethodConditions) = classSet.method(initiate).result { if (isIgnoreErrorLogs) ignored() }.get(instance)
|
||||
|
||||
/**
|
||||
@@ -96,18 +105,21 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* - 请使用 [superClass] 方法来获取 [SuperClass]
|
||||
* @param superClassSet 父类 [Class] 对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class SuperClass internal constructor(private val superClassSet: Class<*>) {
|
||||
|
||||
/**
|
||||
* 获得当前 [classSet] 中父类的 [Class.getName]
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val name get() = superClassSet.name ?: ""
|
||||
|
||||
/**
|
||||
* 获得当前 [classSet] 中父类的 [Class.getSimpleName]
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val simpleName get() = superClassSet.simpleName ?: ""
|
||||
|
||||
/**
|
||||
@@ -116,6 +128,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* 如果当前实例不存在泛型将返回 null
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun generic() = superClassSet.generic()
|
||||
|
||||
/**
|
||||
@@ -125,6 +138,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 实例方法体
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun generic(initiate: GenericClass.() -> Unit) = superClassSet.generic(initiate)
|
||||
|
||||
/**
|
||||
@@ -132,6 +146,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 查找方法体
|
||||
* @return [FieldFinder.Result.Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun field(initiate: FieldConditions) = superClassSet.field(initiate).result { if (isIgnoreErrorLogs) ignored() }.get(instance)
|
||||
|
||||
/**
|
||||
@@ -139,6 +154,7 @@ class CurrentClass internal constructor(private val classSet: Class<*>, internal
|
||||
* @param initiate 查找方法体
|
||||
* @return [MethodFinder.Result.Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun method(initiate: MethodConditions) =
|
||||
superClassSet.method(initiate).result { if (isIgnoreErrorLogs) ignored() }.get(instance)
|
||||
|
||||
|
@@ -23,12 +23,14 @@
|
||||
|
||||
package com.highcapable.yukihookapi.hook.bean
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.ParameterizedType
|
||||
|
||||
/**
|
||||
* 当前 [Class] 的泛型父类操作对象
|
||||
* @param type 类型声明实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class GenericClass internal constructor(private val type: ParameterizedType) {
|
||||
|
||||
/**
|
||||
@@ -38,6 +40,7 @@ class GenericClass internal constructor(private val type: ParameterizedType) {
|
||||
* @param index 数组下标 - 默认 0
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun argument(index: Int = 0) = type.actualTypeArguments[index] as? Class<*>?
|
||||
|
||||
/**
|
||||
@@ -48,6 +51,7 @@ class GenericClass internal constructor(private val type: ParameterizedType) {
|
||||
* @return [Class]<[T]> or null
|
||||
* @throws IllegalStateException 如果 [Class] 的类型不为 [T]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName("argument_Generics")
|
||||
inline fun <reified T> argument(index: Int = 0) =
|
||||
type.actualTypeArguments[index].let { args ->
|
||||
|
@@ -21,12 +21,15 @@
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.bean
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.annotation.LegacyHookApi
|
||||
|
||||
/**
|
||||
* 创建一个当前 Hook 的 [Class] 接管类
|
||||
* @param instance 实例
|
||||
* @param name 完整名称
|
||||
* @param throwable 异常
|
||||
*/
|
||||
@LegacyHookApi
|
||||
class HookClass internal constructor(
|
||||
internal var instance: Class<*>? = null,
|
||||
internal var name: String,
|
||||
|
@@ -19,14 +19,18 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/10.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.bean
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
|
||||
/**
|
||||
* 这是一个不确定性 [Class] 类名装载器
|
||||
* @param name 可指定多个类名 - 将会自动匹配存在的第一个类名
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class VariousClass(private vararg val name: String) {
|
||||
|
||||
/**
|
||||
@@ -38,6 +42,7 @@ class VariousClass(private vararg val name: String) {
|
||||
* @return [Class]
|
||||
* @throws IllegalStateException 如果任何 [Class] 都没有匹配到
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun get(loader: ClassLoader? = null, initialize: Boolean = false): Class<*> {
|
||||
var finalClass: Class<*>? = null
|
||||
if (name.isNotEmpty()) run {
|
||||
@@ -59,6 +64,7 @@ class VariousClass(private vararg val name: String) {
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun getOrNull(loader: ClassLoader? = null, initialize: Boolean = false) = runCatching { get(loader, initialize) }.getOrNull()
|
||||
|
||||
override fun toString(): String {
|
||||
|
@@ -21,11 +21,12 @@
|
||||
*/
|
||||
@file:Suppress(
|
||||
"unused", "UNUSED_PARAMETER", "MemberVisibilityCanBePrivate", "UnusedReceiverParameter",
|
||||
"DeprecatedCallableAddReplaceWith", "PropertyName", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE"
|
||||
"DeprecatedCallableAddReplaceWith", "PropertyName", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core
|
||||
|
||||
import com.highcapable.kavaref.extension.isNotSubclassOf
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.bean.HookClass
|
||||
import com.highcapable.yukihookapi.hook.core.annotation.LegacyHookApi
|
||||
@@ -44,8 +45,6 @@ import com.highcapable.yukihookapi.hook.factory.allConstructors
|
||||
import com.highcapable.yukihookapi.hook.factory.allMethods
|
||||
import com.highcapable.yukihookapi.hook.factory.constructor
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
import com.highcapable.yukihookapi.hook.factory.notExtends
|
||||
import com.highcapable.yukihookapi.hook.factory.notImplements
|
||||
import com.highcapable.yukihookapi.hook.factory.toJavaPrimitiveType
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.param.HookParam
|
||||
@@ -65,6 +64,7 @@ import java.lang.reflect.Method
|
||||
* @param packageParam 需要传入 [PackageParam] 实现方法调用
|
||||
* @param hookClass 要 Hook 的 [HookClass] 实例
|
||||
*/
|
||||
@OptIn(LegacyHookApi::class)
|
||||
class YukiMemberHookCreator internal constructor(private val packageParam: PackageParam, private val hookClass: HookClass) {
|
||||
|
||||
internal companion object {
|
||||
@@ -552,7 +552,7 @@ class YukiMemberHookCreator internal constructor(private val packageParam: Packa
|
||||
if (origin == null || target == null) return
|
||||
origin.toJavaPrimitiveType().also { o ->
|
||||
target.toJavaPrimitiveType().also { t ->
|
||||
if (o notExtends t && t notExtends o && o notImplements t && t notImplements o)
|
||||
if (o isNotSubclassOf t && t isNotSubclassOf o)
|
||||
error("Hooked method return type match failed, required [$origin] but got [$target]")
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ package com.highcapable.yukihookapi.hook.core.annotation
|
||||
|
||||
@RequiresOptIn(message = "这种方式将不再被推荐且将在 2.0.0 版本完全移除,建议迁移到使用 Member 创建 Hook 的新写法", level = RequiresOptIn.Level.WARNING)
|
||||
@MustBeDocumented
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
/**
|
||||
* 标记需要 [RequiresOptIn] 的功能
|
||||
|
@@ -23,10 +23,10 @@
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.api.compat
|
||||
|
||||
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
||||
import com.highcapable.kavaref.condition.type.Modifiers
|
||||
import com.highcapable.kavaref.extension.hasClass
|
||||
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
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
|
||||
@@ -63,10 +63,15 @@ internal object HookApiProperty {
|
||||
internal val name
|
||||
get() = when (HookApiCategoryHelper.currentCategory) {
|
||||
HookApiCategory.ROVO89_XPOSED -> when {
|
||||
EXPOSED_BRIDGE_CLASS_NAME.hasClass(AppParasitics.currentApplication?.classLoader) -> TAICHI_XPOSED_NAME
|
||||
BUG_LOAD_CLASS_NAME.hasClass(AppParasitics.currentApplication?.classLoader) -> BUG_XPOSED_NAME
|
||||
AppParasitics.currentApplication?.classLoader?.hasClass(EXPOSED_BRIDGE_CLASS_NAME) == true -> TAICHI_XPOSED_NAME
|
||||
AppParasitics.currentApplication?.classLoader?.hasClass(BUG_LOAD_CLASS_NAME) == true -> BUG_XPOSED_NAME
|
||||
else -> runCatching {
|
||||
classOf<XposedBridge>().field { name = "TAG" }.ignored().get().string().takeIf { it.isNotBlank() }
|
||||
XposedBridge::class.resolve()
|
||||
.optional(silent = true)
|
||||
.firstFieldOrNull {
|
||||
name = "TAG"
|
||||
modifiers(Modifiers.STATIC)
|
||||
}?.get<String>()?.takeIf { it.isNotBlank() }
|
||||
?.replace("Bridge", "")?.replace("-", "")?.trim() ?: "unknown"
|
||||
}.getOrNull() ?: "invalid"
|
||||
}
|
||||
|
@@ -21,14 +21,12 @@
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.api.helper
|
||||
|
||||
import com.highcapable.kavaref.resolver.base.MemberResolver
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookCompatHelper
|
||||
import com.highcapable.yukihookapi.hook.core.api.proxy.YukiHookCallback
|
||||
import com.highcapable.yukihookapi.hook.core.api.result.YukiHookResult
|
||||
import com.highcapable.yukihookapi.hook.core.api.store.YukiHookCacheStore
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.BaseFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import java.lang.reflect.Member
|
||||
|
||||
@@ -38,19 +36,13 @@ import java.lang.reflect.Member
|
||||
internal object YukiHookHelper {
|
||||
|
||||
/**
|
||||
* Hook [BaseFinder.BaseResult]
|
||||
* @param traction 直接调用 [BaseFinder.BaseResult]
|
||||
* Hook [MemberResolver]
|
||||
* @param resolver 需要 Hook 的 [MemberResolver]
|
||||
* @param callback 回调
|
||||
* @return [YukiHookResult]
|
||||
*/
|
||||
internal fun hook(traction: BaseFinder.BaseResult, callback: YukiHookCallback) = runCatching {
|
||||
val member: Member? = when (traction) {
|
||||
is MethodFinder.Result -> traction.ignored().give()
|
||||
is ConstructorFinder.Result -> traction.ignored().give()
|
||||
else -> error("Unexpected BaseFinder result interface type")
|
||||
}
|
||||
hookMember(member, callback)
|
||||
}.onFailure { YLog.innerE("An exception occurred when hooking internal function", it) }.getOrNull() ?: YukiHookResult()
|
||||
internal fun hook(resolver: MemberResolver<*, *>?, callback: YukiHookCallback) =
|
||||
resolver?.self?.let { hookMember(it, callback) } ?: YukiHookResult()
|
||||
|
||||
/**
|
||||
* Hook [Member]
|
||||
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/YukiHookAPI
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is created by fankes on 2025/6/15.
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.api.reflect
|
||||
|
||||
import android.os.Build
|
||||
import com.highcapable.kavaref.resolver.processor.MemberProcessor
|
||||
import org.lsposed.hiddenapibypass.HiddenApiBypass
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Method
|
||||
|
||||
/**
|
||||
* 这是一个为 KavaRef 提供的 [HiddenApiBypass].
|
||||
*
|
||||
* 使用 [AndroidHiddenApiBypass](https://github.com/LSPosed/AndroidHiddenApiBypass) 实现
|
||||
*
|
||||
* 你可以调用 [AndroidHiddenApiBypassResolver.get] 来在想要调用系统隐藏 API 的地方使用它
|
||||
*
|
||||
* - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本可能将合并到新的模块
|
||||
*/
|
||||
class AndroidHiddenApiBypassResolver private constructor() : MemberProcessor.Resolver() {
|
||||
|
||||
companion object {
|
||||
|
||||
private val self by lazy { AndroidHiddenApiBypassResolver() }
|
||||
|
||||
/**
|
||||
* 获得 [AndroidHiddenApiBypassResolver] 实例
|
||||
* @return [AndroidHiddenApiBypassResolver]
|
||||
*/
|
||||
fun get() = self
|
||||
}
|
||||
|
||||
override fun <T : Any> getDeclaredConstructors(declaringClass: Class<T>): List<Constructor<T>> {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
return super.getDeclaredConstructors(declaringClass)
|
||||
val constructors = HiddenApiBypass.getDeclaredMethods(declaringClass)
|
||||
.filterIsInstance<Constructor<T>>()
|
||||
.toList()
|
||||
return constructors
|
||||
}
|
||||
|
||||
override fun <T : Any> getDeclaredMethods(declaringClass: Class<T>): List<Method> {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
return super.getDeclaredMethods(declaringClass)
|
||||
val methods = HiddenApiBypass.getDeclaredMethods(declaringClass)
|
||||
.filterIsInstance<Method>()
|
||||
.toList()
|
||||
return methods
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/YukiHookAPI
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is created by fankes on 2025/6/16.
|
||||
*/
|
||||
@file:Suppress("unused", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "UNCHECKED_CAST")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.api.reflect
|
||||
|
||||
import com.highcapable.kavaref.extension.makeAccessible
|
||||
import com.highcapable.kavaref.resolver.MethodResolver
|
||||
import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper
|
||||
|
||||
/**
|
||||
* Invoke the method with the given arguments.
|
||||
*
|
||||
* This action calls the original method without hook.
|
||||
* @see MethodResolver.invoke
|
||||
* @return [T] or null.
|
||||
*/
|
||||
@JvmName("invokeOriginalTyped")
|
||||
fun <T : Any?> MethodResolver<*>.invokeOriginal(vararg args: Any?): T? {
|
||||
self.makeAccessible()
|
||||
return YukiHookHelper.invokeOriginalMember(self, instance, args) as? T?
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the method with the given arguments and ignore any exceptions.
|
||||
*
|
||||
* This action calls the original method without hook.
|
||||
* @see MethodResolver.invokeQuietly
|
||||
* @return [T] or null.
|
||||
*/
|
||||
@JvmName("invokeOriginalQuietlyTyped")
|
||||
fun <T : Any?> MethodResolver<*>.invokeOriginalQuietly(vararg args: Any?) = runCatching { invokeOriginal<T>(*args) }.getOrNull()
|
||||
|
||||
/**
|
||||
* Invoke the method with the given arguments.
|
||||
*
|
||||
* This action calls the original method without hook.
|
||||
* @see MethodResolver.invoke
|
||||
* @return [Any] or null.
|
||||
*/
|
||||
fun MethodResolver<*>.invokeOriginal(vararg args: Any?): Any? {
|
||||
self.makeAccessible()
|
||||
return YukiHookHelper.invokeOriginalMember(self, instance, args)
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the method with the given arguments and ignore any exceptions.
|
||||
*
|
||||
* This action calls the original method without hook.
|
||||
* @see MethodResolver.invokeQuietly
|
||||
* @return [Any] or null.
|
||||
*/
|
||||
fun MethodResolver<*>.invokeOriginalQuietly(vararg args: Any?) = runCatching { invokeOriginal(*args) }.getOrNull()
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/YukiHookAPI
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is created by fankes on 2025/6/11.
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.core.finder
|
||||
|
||||
/**
|
||||
* YukiHookAPI 反射 API 迁移指引类
|
||||
*/
|
||||
internal object ReflectionMigration {
|
||||
|
||||
/**
|
||||
* [KavaRef](https://github.com/HighCapable/KavaRef) 迁移指引信息
|
||||
*/
|
||||
const val KAVAREF_INFO = "YukiHookAPI 会在 2.0.0 版本完全移除自身反射部分的 API,我们推荐你使用 KavaRef 来实现反射功能以获得更好的性能和可维护性。" +
|
||||
"请参阅:https://github.com/HighCapable/KavaRef"
|
||||
}
|
@@ -19,10 +19,13 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base
|
||||
|
||||
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.data.BaseRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
import java.lang.reflect.Member
|
||||
@@ -31,6 +34,7 @@ import kotlin.math.abs
|
||||
/**
|
||||
* 这是 [Class] 与 [Member] 查找类功能的基本类实现
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
abstract class BaseFinder {
|
||||
|
||||
/** 当前查找条件规则数据 */
|
||||
@@ -45,6 +49,7 @@ abstract class BaseFinder {
|
||||
* 字节码、数组下标筛选实现类
|
||||
* @param type 类型
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class IndexTypeCondition internal constructor(private val type: IndexConfigType) {
|
||||
|
||||
/**
|
||||
@@ -55,6 +60,7 @@ abstract class BaseFinder {
|
||||
* 可使用 [IndexTypeConditionSort.first] 和 [IndexTypeConditionSort.last] 设置首位和末位筛选条件
|
||||
* @param num 下标
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun index(num: Int) = when (type) {
|
||||
IndexConfigType.ORDER -> rulesData.orderIndex = Pair(num, true)
|
||||
IndexConfigType.MATCH -> rulesData.matchIndex = Pair(num, true)
|
||||
@@ -64,6 +70,7 @@ abstract class BaseFinder {
|
||||
* 得到下标
|
||||
* @return [IndexTypeConditionSort]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun index() = IndexTypeConditionSort()
|
||||
|
||||
/**
|
||||
@@ -71,12 +78,15 @@ abstract class BaseFinder {
|
||||
*
|
||||
* - 请使用 [index] 方法来获取 [IndexTypeConditionSort]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class IndexTypeConditionSort internal constructor() {
|
||||
|
||||
/** 设置满足条件的第一个*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun first() = index(num = 0)
|
||||
|
||||
/** 设置满足条件的最后一个*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun last() = when (type) {
|
||||
IndexConfigType.ORDER -> rulesData.orderIndex = Pair(0, false)
|
||||
IndexConfigType.MATCH -> rulesData.matchIndex = Pair(0, false)
|
||||
@@ -86,6 +96,7 @@ abstract class BaseFinder {
|
||||
* 设置倒序下标
|
||||
* @param num 下标
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun reverse(num: Int) = when {
|
||||
num < 0 -> index(abs(num))
|
||||
num == 0 -> index().last()
|
||||
@@ -130,5 +141,6 @@ abstract class BaseFinder {
|
||||
*
|
||||
* - 此功能交由方法体自动完成 - 你不应该手动继承此接口
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
interface BaseResult
|
||||
}
|
||||
}
|
@@ -19,16 +19,20 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base
|
||||
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
|
||||
/**
|
||||
* 这是 [Class] 查找类功能的基本类实现
|
||||
* @param loaderSet 当前使用的 [ClassLoader] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
abstract class ClassBaseFinder internal constructor(internal open val loaderSet: ClassLoader? = null) : BaseFinder() {
|
||||
|
||||
internal companion object {
|
||||
|
@@ -19,11 +19,14 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/18.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base
|
||||
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.YukiMemberHookCreator
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.utils.factory.await
|
||||
import java.lang.reflect.Constructor
|
||||
@@ -36,6 +39,7 @@ import java.lang.reflect.Method
|
||||
* @param tag 当前查找类的标识
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
abstract class MemberBaseFinder internal constructor(private val tag: String, internal open val classSet: Class<*>? = null) : BaseFinder() {
|
||||
|
||||
internal companion object {
|
||||
|
@@ -19,6 +19,8 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/8.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.rules.CountRules
|
||||
@@ -26,6 +28,7 @@ import com.highcapable.yukihookapi.hook.core.finder.base.rules.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.rules.NameRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.rules.ObjectRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.type.defined.VagueType
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
@@ -38,6 +41,7 @@ import java.lang.reflect.Method
|
||||
* @param orderIndex 字节码、数组顺序下标
|
||||
* @param matchIndex 字节码、数组筛选下标
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal abstract class BaseRulesData internal constructor(
|
||||
var modifiers: ModifierConditions? = null,
|
||||
var orderIndex: Pair<Int, Boolean>? = null,
|
||||
|
@@ -19,10 +19,11 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/14.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused", "DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ import java.lang.reflect.Member
|
||||
* 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
|
||||
* @param instance 当前实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class CountRules private constructor(private val instance: Int) {
|
||||
|
||||
internal companion object {
|
||||
@@ -47,6 +49,7 @@ class CountRules private constructor(private val instance: Int) {
|
||||
* 是否为 0
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Int.isZero() = this == 0
|
||||
|
||||
/**
|
||||
@@ -54,6 +57,7 @@ class CountRules private constructor(private val instance: Int) {
|
||||
* @param count 目标对象
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Int.moreThan(count: Int) = this > count
|
||||
|
||||
/**
|
||||
@@ -61,6 +65,7 @@ class CountRules private constructor(private val instance: Int) {
|
||||
* @param count 目标对象
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Int.lessThan(count: Int) = this < count
|
||||
|
||||
/**
|
||||
@@ -68,6 +73,7 @@ class CountRules private constructor(private val instance: Int) {
|
||||
* @param countRange 区间
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Int.inInterval(countRange: IntRange) = this in countRange
|
||||
|
||||
override fun toString() = "CountRules [$instance]"
|
||||
|
@@ -20,10 +20,11 @@
|
||||
* This file is created by fankes on 2022/3/27.
|
||||
* This file is modified by fankes on 2022/9/14.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused", "DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Member
|
||||
import java.lang.reflect.Method
|
||||
@@ -35,6 +36,7 @@ import java.lang.reflect.Modifier
|
||||
* 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
|
||||
* @param instance 当前实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class ModifierRules private constructor(private val instance: Any) {
|
||||
|
||||
internal companion object {
|
||||
@@ -71,6 +73,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isPublic get() = Modifier.isPublic(modifiers).also { templates.add("<isPublic> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -83,6 +86,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isPrivate get() = Modifier.isPrivate(modifiers).also { templates.add("<isPrivate> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -95,6 +99,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isProtected get() = Modifier.isProtected(modifiers).also { templates.add("<isProtected> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -111,6 +116,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* - 注意 Kotlin → Jvm 后的 object 类中的方法并不是静态的
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isStatic get() = Modifier.isStatic(modifiers).also { templates.add("<isStatic> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -125,6 +131,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* - 注意 Kotlin → Jvm 后没有 open 标识的 [Class]、[Member] 和没有任何关联的 [Class]、[Member] 都将为 final
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isFinal get() = Modifier.isFinal(modifiers).also { templates.add("<isFinal> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -137,6 +144,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isSynchronized get() = Modifier.isSynchronized(modifiers).also { templates.add("<isSynchronized> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -149,6 +157,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isVolatile get() = Modifier.isVolatile(modifiers).also { templates.add("<isVolatile> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -161,6 +170,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isTransient get() = Modifier.isTransient(modifiers).also { templates.add("<isTransient> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -175,6 +185,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isNative get() = Modifier.isNative(modifiers).also { templates.add("<isNative> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -187,6 +198,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isInterface get() = Modifier.isInterface(modifiers).also { templates.add("<isInterface> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -201,6 +213,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isAbstract get() = Modifier.isAbstract(modifiers).also { templates.add("<isAbstract> ($it)") }
|
||||
|
||||
/**
|
||||
@@ -213,6 +226,7 @@ class ModifierRules private constructor(private val instance: Any) {
|
||||
* ^^^
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val isStrict get() = Modifier.isStrict(modifiers).also { templates.add("<isStrict> ($it)") }
|
||||
|
||||
/**
|
||||
|
@@ -20,10 +20,11 @@
|
||||
* This file is created by fankes on 2022/5/16.
|
||||
* This file is modified by fankes on 2022/9/14.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ import java.lang.reflect.Member
|
||||
* 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
|
||||
* @param instance 当前实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class NameRules private constructor(private val instance: String) {
|
||||
|
||||
internal companion object {
|
||||
@@ -51,6 +53,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* @param index 下标 - 默认 0
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isSynthetic(index: Int = 0) = this == "this$$index"
|
||||
|
||||
/**
|
||||
@@ -61,6 +64,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlySymbols() = matches("[*,.:~`'\"|/\\\\?!^()\\[\\]{}%@#$&\\-_+=<>]+".toRegex())
|
||||
|
||||
/**
|
||||
@@ -71,6 +75,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlyLetters() = matches("[a-zA-Z]+".toRegex())
|
||||
|
||||
/**
|
||||
@@ -81,6 +86,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlyNumbers() = matches("\\d+".toRegex())
|
||||
|
||||
/**
|
||||
@@ -91,6 +97,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlyLettersNumbers() = matches("[a-zA-Z\\d]+".toRegex())
|
||||
|
||||
/**
|
||||
@@ -101,6 +108,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlyLowercase() = matches("[a-z]+".toRegex())
|
||||
|
||||
/**
|
||||
@@ -111,6 +119,7 @@ class NameRules private constructor(private val instance: String) {
|
||||
* 你可以使用 [matches] 方法进行更详细的正则匹配
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.isOnlyUppercase() = matches("[A-Z]+".toRegex())
|
||||
|
||||
override fun toString() = "NameRules [$instance]"
|
||||
|
@@ -19,10 +19,11 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/12/30.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused", "DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.base.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ import java.lang.reflect.Member
|
||||
* 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
|
||||
* @param instance 当前实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class ObjectRules private constructor(private val instance: Any) {
|
||||
|
||||
internal companion object {
|
||||
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "MemberVisibilityCanBePrivate", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "DEPRECATION", "UseKtx",
|
||||
"TYPEALIAS_EXPANSION_DEPRECATION", "DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes
|
||||
|
||||
@@ -39,6 +42,7 @@ import com.highcapable.yukihookapi.hook.core.finder.classes.rules.result.MemberR
|
||||
import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.factory.searchClass
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
@@ -63,6 +67,7 @@ import java.lang.reflect.Method
|
||||
* @param async 是否启用异步
|
||||
* @param loaderSet 当前使用的 [ClassLoader] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class DexClassFinder internal constructor(
|
||||
internal var name: String,
|
||||
internal var async: Boolean,
|
||||
@@ -101,6 +106,7 @@ class DexClassFinder internal constructor(
|
||||
* @param versionName 版本名称 - 默认空
|
||||
* @param versionCode 版本号 - 默认空
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun clearCache(context: Context? = currentContext, versionName: String? = null, versionCode: Long? = null) {
|
||||
context?.currentSp(versionName, versionCode)?.edit()?.clear()?.apply()
|
||||
?: YLog.innerW("Cannot clear cache for DexClassFinder because got null context instance")
|
||||
@@ -117,6 +123,7 @@ class DexClassFinder internal constructor(
|
||||
* 例如 com.demo.Test 需要填写 com.demo.Test
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var fullName
|
||||
get() = rulesData.fullName?.name ?: ""
|
||||
set(value) {
|
||||
@@ -133,6 +140,7 @@ class DexClassFinder internal constructor(
|
||||
* 对于匿名类例如 com.demo.Test$InnerTest 会为空 - 此时你可以使用 [singleName]
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var simpleName
|
||||
get() = rulesData.simpleName?.name ?: ""
|
||||
set(value) {
|
||||
@@ -149,6 +157,7 @@ class DexClassFinder internal constructor(
|
||||
* 对于匿名类例如 com.demo.Test$InnerTest 只需要填写 Test$InnerTest
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var singleName
|
||||
get() = rulesData.singleName?.name ?: ""
|
||||
set(value) {
|
||||
@@ -170,6 +179,7 @@ class DexClassFinder internal constructor(
|
||||
* @param name 指定包名
|
||||
* @return [FromPackageRules] 可设置 [FromPackageRules.absolute] 标识包名绝对匹配
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun from(vararg name: String) = FromPackageRules(mutableListOf<ClassRulesData.PackageRulesData>().also {
|
||||
name.takeIf { e -> e.isNotEmpty() }?.forEach { e -> it.add(rulesData.createPackageRulesData(e)) }
|
||||
if (it.isNotEmpty()) rulesData.fromPackages.addAll(it)
|
||||
@@ -181,6 +191,7 @@ class DexClassFinder internal constructor(
|
||||
* - 可不设置筛选条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions) {
|
||||
rulesData.modifiers = conditions
|
||||
}
|
||||
@@ -194,6 +205,7 @@ class DexClassFinder internal constructor(
|
||||
* @param value 名称
|
||||
* @return [ClassNameRules] 可设置 [ClassNameRules.optional] 标识类名可选
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun fullName(value: String) = rulesData.createNameRulesData(value).let {
|
||||
rulesData.fullName = it
|
||||
ClassNameRules(it)
|
||||
@@ -210,6 +222,7 @@ class DexClassFinder internal constructor(
|
||||
* @param value 名称
|
||||
* @return [ClassNameRules] 可设置 [ClassNameRules.optional] 标识类名可选
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun simpleName(value: String) = rulesData.createNameRulesData(value).let {
|
||||
rulesData.simpleName = it
|
||||
ClassNameRules(it)
|
||||
@@ -226,6 +239,7 @@ class DexClassFinder internal constructor(
|
||||
* @param value 名称
|
||||
* @return [ClassNameRules] 可设置 [ClassNameRules.optional] 标识类名可选
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun singleName(value: String) = rulesData.createNameRulesData(value).let {
|
||||
rulesData.singleName = it
|
||||
ClassNameRules(it)
|
||||
@@ -237,6 +251,7 @@ class DexClassFinder internal constructor(
|
||||
* 只会查找匹配到的 [Class.getName]
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun fullName(conditions: NameConditions) {
|
||||
rulesData.fullNameConditions = conditions
|
||||
}
|
||||
@@ -247,6 +262,7 @@ class DexClassFinder internal constructor(
|
||||
* 只会查找匹配到的 [Class.getSimpleName]
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun simpleName(conditions: NameConditions) {
|
||||
rulesData.simpleNameConditions = conditions
|
||||
}
|
||||
@@ -257,11 +273,13 @@ class DexClassFinder internal constructor(
|
||||
* 设置后将首先使用 [Class.getSimpleName] - 若为空则会使用 [Class.getName] 进行处理
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun singleName(conditions: NameConditions) {
|
||||
rulesData.singleNameConditions = conditions
|
||||
}
|
||||
|
||||
/** 设置 [Class] 继承的父类 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> extends() {
|
||||
rulesData.extendsClass.add(T::class.java.name)
|
||||
}
|
||||
@@ -272,11 +290,13 @@ class DexClassFinder internal constructor(
|
||||
* 会同时查找 [name] 中所有匹配的父类
|
||||
* @param name [Class] 完整名称
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun extends(vararg name: String) {
|
||||
rulesData.extendsClass.addAll(name.toList())
|
||||
}
|
||||
|
||||
/** 设置 [Class] 实现的接口类 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> implements() {
|
||||
rulesData.implementsClass.add(T::class.java.name)
|
||||
}
|
||||
@@ -287,6 +307,7 @@ class DexClassFinder internal constructor(
|
||||
* 会同时查找 [name] 中所有匹配的接口类
|
||||
* @param name [Class] 完整名称
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun implements(vararg name: String) {
|
||||
rulesData.implementsClass.addAll(name.toList())
|
||||
}
|
||||
@@ -298,6 +319,7 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* 标识后你可以使用 [enclosing] 来进一步指定匿名类的 (封闭类) 主类
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun anonymous() {
|
||||
rulesData.isAnonymousClass = true
|
||||
}
|
||||
@@ -309,6 +331,7 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 设置此条件后 [extends] 将失效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun noExtends() {
|
||||
rulesData.isNoExtendsClass = true
|
||||
}
|
||||
@@ -318,6 +341,7 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 设置此条件后 [implements] 将失效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun noImplements() {
|
||||
rulesData.isNoImplementsClass = true
|
||||
}
|
||||
@@ -329,12 +353,14 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 设置此条件后 [extends] 与 [implements] 将失效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun noSuper() {
|
||||
noExtends()
|
||||
noImplements()
|
||||
}
|
||||
|
||||
/** 设置 [Class] 匿名类的 (封闭类) 主类 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> enclosing() {
|
||||
rulesData.enclosingClass.add(T::class.java.name)
|
||||
}
|
||||
@@ -345,6 +371,7 @@ class DexClassFinder internal constructor(
|
||||
* 会同时查找 [name] 中所有匹配的 (封闭类) 主类
|
||||
* @param name [Class] 完整名称
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun enclosing(vararg name: String) {
|
||||
rulesData.enclosingClass.addAll(name.toList())
|
||||
}
|
||||
@@ -353,6 +380,7 @@ class DexClassFinder internal constructor(
|
||||
* 包名范围名称过滤匹配条件实现类
|
||||
* @param packages 包名数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class FromPackageRules internal constructor(private val packages: MutableList<ClassRulesData.PackageRulesData>) {
|
||||
|
||||
/**
|
||||
@@ -370,6 +398,7 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* 相反地 - 不设置以上示例会全部匹配
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun absolute() = packages.takeIf { it.isNotEmpty() }?.forEach { it.isAbsolute = true }
|
||||
}
|
||||
|
||||
@@ -377,6 +406,7 @@ class DexClassFinder internal constructor(
|
||||
* 类名匹配条件实现类
|
||||
* @param name 类名匹配实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class ClassNameRules internal constructor(private val name: ClassRulesData.NameRulesData) {
|
||||
|
||||
/**
|
||||
@@ -394,6 +424,7 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* 这样就可在完全匹配类名情况下使用类名而忽略其它查找条件 - 否则忽略此条件继续使用其它查找条件
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun optional() {
|
||||
name.isOptional = true
|
||||
}
|
||||
@@ -404,6 +435,7 @@ class DexClassFinder internal constructor(
|
||||
* @param initiate 条件方法体
|
||||
* @return [MemberRulesResult]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun member(initiate: MemberRules.() -> Unit = {}) = BaseRules.createMemberRules(this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -411,6 +443,7 @@ class DexClassFinder internal constructor(
|
||||
* @param initiate 条件方法体
|
||||
* @return [MemberRulesResult]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun field(initiate: FieldRules.() -> Unit = {}) = BaseRules.createFieldRules(this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -418,6 +451,7 @@ class DexClassFinder internal constructor(
|
||||
* @param initiate 条件方法体
|
||||
* @return [MemberRulesResult]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun method(initiate: MethodRules.() -> Unit = {}) = BaseRules.createMethodRules(this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -425,6 +459,7 @@ class DexClassFinder internal constructor(
|
||||
* @param initiate 查找方法体
|
||||
* @return [MemberRulesResult]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun constructor(initiate: ConstructorRules.() -> Unit = {}) = BaseRules.createConstructorRules(this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -500,6 +535,7 @@ class DexClassFinder internal constructor(
|
||||
* @param isNotFound 是否没有找到 [Class] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor(
|
||||
internal var isNotFound: Boolean = false,
|
||||
internal var throwable: Throwable? = null
|
||||
@@ -519,6 +555,7 @@ class DexClassFinder internal constructor(
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Result.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
@@ -531,6 +568,7 @@ class DexClassFinder internal constructor(
|
||||
* - 若你设置了 [async] 请使用 [wait] 方法
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun get() = all().takeIf { it.isNotEmpty() }?.first()
|
||||
|
||||
/**
|
||||
@@ -543,6 +581,7 @@ class DexClassFinder internal constructor(
|
||||
* - 若你设置了 [async] 请使用 [waitAll] 方法
|
||||
* @return [MutableList]<[Class]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all() = classInstances
|
||||
|
||||
/**
|
||||
@@ -556,6 +595,7 @@ class DexClassFinder internal constructor(
|
||||
* @param result 回调每个结果
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all(result: (Class<*>) -> Unit): Result {
|
||||
all().takeIf { it.isNotEmpty() }?.forEach(result)
|
||||
return this
|
||||
@@ -572,6 +612,7 @@ class DexClassFinder internal constructor(
|
||||
* @param result 回调 - ([Class] or null)
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun wait(result: (Class<*>?) -> Unit): Result {
|
||||
waitResultCallback = result
|
||||
return this
|
||||
@@ -588,6 +629,7 @@ class DexClassFinder internal constructor(
|
||||
* @param result 回调 - ([MutableList]<[Class]>)
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun waitAll(result: (MutableList<Class<*>>) -> Unit): Result {
|
||||
waitAllResultCallback = result
|
||||
return this
|
||||
@@ -598,6 +640,7 @@ class DexClassFinder internal constructor(
|
||||
* @param result 回调错误
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun onNoClassDefFoundError(result: (Throwable) -> Unit): Result {
|
||||
noClassDefFoundErrorCallback = { if (isNotFound) result(throwable ?: Throwable("Initialization Error")) }
|
||||
noClassDefFoundErrorCallback?.invoke()
|
||||
@@ -610,6 +653,7 @@ class DexClassFinder internal constructor(
|
||||
* - 此时若要监听异常结果 - 你需要手动实现 [onNoClassDefFoundError] 方法
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ignored(): Result {
|
||||
isIgnoreErrorLogs = true
|
||||
return this
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/5.
|
||||
*/
|
||||
@file:Suppress("PropertyName")
|
||||
@file:Suppress("PropertyName", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.data
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MethodRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Member
|
||||
@@ -55,6 +56,7 @@ import java.lang.reflect.Method
|
||||
* @param methodRules [Method] 查找条件数据数组
|
||||
* @param constroctorRules [Constructor] 查找条件数据数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal class ClassRulesData internal constructor(
|
||||
var fromPackages: MutableList<PackageRulesData> = mutableListOf(),
|
||||
var fullName: NameRulesData? = null,
|
||||
@@ -102,6 +104,7 @@ internal class ClassRulesData internal constructor(
|
||||
* @param name 包名
|
||||
* @param isOptional 是否可选 - 默认否
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class NameRulesData internal constructor(var name: String, var isOptional: Boolean = false) {
|
||||
|
||||
/** [Class.getName] */
|
||||
@@ -134,6 +137,7 @@ internal class ClassRulesData internal constructor(
|
||||
* @param name 包名
|
||||
* @param isAbsolute 是否绝对匹配 - 默认否
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class PackageRulesData internal constructor(var name: String, var isAbsolute: Boolean = false) {
|
||||
override fun toString() = "$name absolute($isAbsolute)"
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("MemberVisibilityCanBePrivate")
|
||||
@file:Suppress("MemberVisibilityCanBePrivate", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.ConstructorRule
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
import com.highcapable.yukihookapi.hook.type.defined.VagueType
|
||||
import java.lang.reflect.Constructor
|
||||
@@ -38,6 +39,7 @@ import java.lang.reflect.Constructor
|
||||
* [Constructor] 查找条件实现类
|
||||
* @param rulesData 当前查找条件规则数据
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class ConstructorRules internal constructor(private val rulesData: ConstructorRulesData) : BaseRules() {
|
||||
|
||||
/**
|
||||
@@ -48,6 +50,7 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* 若参数个数小于零则忽略并使用 [param]
|
||||
* @return [Int]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var paramCount
|
||||
get() = rulesData.paramCount
|
||||
set(value) {
|
||||
@@ -60,11 +63,13 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* - 可不设置筛选条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions) {
|
||||
rulesData.modifiers = conditions
|
||||
}
|
||||
|
||||
/** 设置 [Constructor] 空参数、无参数 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun emptyParam() {
|
||||
rulesData.paramCount = 0
|
||||
}
|
||||
@@ -93,6 +98,7 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* - 有参 [Constructor] 必须使用此方法设定参数或使用 [paramCount] 指定个数
|
||||
* @param paramType 参数类型数组 - 只能是 [Class]、[String]、[VariousClass]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(vararg paramType: Any) {
|
||||
if (paramType.isEmpty()) error("paramTypes is empty, please use emptyParam() instead")
|
||||
rulesData.paramTypes =
|
||||
@@ -113,6 +119,7 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* - 有参 [Constructor] 必须使用此方法设定参数或使用 [paramCount] 指定个数
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(conditions: ObjectsConditions) {
|
||||
rulesData.paramTypesConditions = conditions
|
||||
}
|
||||
@@ -129,6 +136,7 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* ```
|
||||
* @param numRange 个数范围
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(numRange: IntRange) {
|
||||
rulesData.paramCountRange = numRange
|
||||
}
|
||||
@@ -145,6 +153,7 @@ class ConstructorRules internal constructor(private val rulesData: ConstructorRu
|
||||
* ```
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(conditions: CountConditions) {
|
||||
rulesData.paramCountConditions = conditions
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||
@@ -28,18 +30,21 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Field
|
||||
|
||||
/**
|
||||
* [Field] 查找条件实现类
|
||||
* @param rulesData 当前查找条件规则数据
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class FieldRules internal constructor(private val rulesData: FieldRulesData) : BaseRules() {
|
||||
|
||||
/**
|
||||
* 设置 [Field] 名称
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var name
|
||||
get() = rulesData.name
|
||||
set(value) {
|
||||
@@ -54,6 +59,7 @@ class FieldRules internal constructor(private val rulesData: FieldRulesData) : B
|
||||
* - 可不填写类型
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var type
|
||||
get() = rulesData.type
|
||||
set(value) {
|
||||
@@ -66,6 +72,7 @@ class FieldRules internal constructor(private val rulesData: FieldRulesData) : B
|
||||
* - 可不设置筛选条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions) {
|
||||
rulesData.modifiers = conditions
|
||||
}
|
||||
@@ -74,6 +81,7 @@ class FieldRules internal constructor(private val rulesData: FieldRulesData) : B
|
||||
* 设置 [Field] 名称条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(conditions: NameConditions) {
|
||||
rulesData.nameConditions = conditions
|
||||
}
|
||||
@@ -90,6 +98,7 @@ class FieldRules internal constructor(private val rulesData: FieldRulesData) : B
|
||||
* ```
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun type(conditions: ObjectConditions) {
|
||||
rulesData.typeConditions = conditions
|
||||
}
|
||||
|
@@ -19,18 +19,22 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.classes.rules.base.BaseRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.classes.rules.result.MemberRulesResult
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
* [Member] 查找条件实现类
|
||||
* @param rulesData 当前查找条件规则数据
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class MemberRules internal constructor(private val rulesData: MemberRulesData) : BaseRules() {
|
||||
|
||||
/**
|
||||
@@ -39,6 +43,7 @@ class MemberRules internal constructor(private val rulesData: MemberRulesData) :
|
||||
* - 可不设置筛选条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions) {
|
||||
rulesData.modifiers = conditions
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditi
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
import com.highcapable.yukihookapi.hook.type.defined.VagueType
|
||||
import java.lang.reflect.Method
|
||||
@@ -40,12 +41,14 @@ import java.lang.reflect.Method
|
||||
* [Method] 查找条件实现类
|
||||
* @param rulesData 当前查找条件规则数据
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class MethodRules internal constructor(private val rulesData: MethodRulesData) : BaseRules() {
|
||||
|
||||
/**
|
||||
* 设置 [Method] 名称
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var name
|
||||
get() = rulesData.name
|
||||
set(value) {
|
||||
@@ -60,6 +63,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* 若参数个数小于零则忽略并使用 [param]
|
||||
* @return [Int]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var paramCount
|
||||
get() = rulesData.paramCount
|
||||
set(value) {
|
||||
@@ -74,6 +78,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* - 可不填写返回值
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var returnType
|
||||
get() = rulesData.returnType
|
||||
set(value) {
|
||||
@@ -86,11 +91,13 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* - 可不设置筛选条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions) {
|
||||
rulesData.modifiers = conditions
|
||||
}
|
||||
|
||||
/** 设置 [Method] 空参数、无参数 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun emptyParam() {
|
||||
rulesData.paramCount = 0
|
||||
}
|
||||
@@ -119,6 +126,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* - 有参 [Method] 必须使用此方法设定参数或使用 [paramCount] 指定个数
|
||||
* @param paramType 参数类型数组 - 只能是 [Class]、[String]、[VariousClass]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(vararg paramType: Any) {
|
||||
if (paramType.isEmpty()) error("paramTypes is empty, please use emptyParam() instead")
|
||||
rulesData.paramTypes =
|
||||
@@ -139,6 +147,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* - 有参 [Method] 必须使用此方法设定参数或使用 [paramCount] 指定个数
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(conditions: ObjectsConditions) {
|
||||
rulesData.paramTypesConditions = conditions
|
||||
}
|
||||
@@ -147,6 +156,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* 设置 [Method] 名称条件
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(conditions: NameConditions) {
|
||||
rulesData.nameConditions = conditions
|
||||
}
|
||||
@@ -163,6 +173,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* ```
|
||||
* @param numRange 个数范围
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(numRange: IntRange) {
|
||||
rulesData.paramCountRange = numRange
|
||||
}
|
||||
@@ -179,6 +190,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* ```
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(conditions: CountConditions) {
|
||||
rulesData.paramCountConditions = conditions
|
||||
}
|
||||
@@ -195,6 +207,7 @@ class MethodRules internal constructor(private val rulesData: MethodRulesData) :
|
||||
* ```
|
||||
* @param conditions 条件方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun returnType(conditions: ObjectConditions) {
|
||||
rulesData.returnTypeConditions = conditions
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules.base
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.classes.DexClassFinder
|
||||
@@ -30,12 +32,14 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.ConstructorRule
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MethodRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
* [Member] 查找条件实现父类
|
||||
* @param instance 当前查找类实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
open class BaseRules internal constructor(internal var instance: DexClassFinder? = null) {
|
||||
|
||||
internal companion object {
|
||||
|
@@ -19,24 +19,27 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/12.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.classes.rules.result
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
* 当前 [Member] 查找条件结果实现类
|
||||
* @param rulesData 当前查找条件规则数据
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class MemberRulesResult internal constructor(private val rulesData: MemberRulesData) {
|
||||
|
||||
/**
|
||||
* 设置当前 [Member] 在查找条件中个数为 0
|
||||
* @return [MemberRulesResult] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun none() = count(num = 0)
|
||||
|
||||
/**
|
||||
@@ -44,6 +47,7 @@ class MemberRulesResult internal constructor(private val rulesData: MemberRulesD
|
||||
* @param num 个数
|
||||
* @return [MemberRulesResult] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun count(num: Int): MemberRulesResult {
|
||||
rulesData.matchCount = num
|
||||
return this
|
||||
@@ -60,6 +64,7 @@ class MemberRulesResult internal constructor(private val rulesData: MemberRulesD
|
||||
* @param numRange 个数范围
|
||||
* @return [MemberRulesResult] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun count(numRange: IntRange): MemberRulesResult {
|
||||
rulesData.matchCountRange = numRange
|
||||
return this
|
||||
@@ -76,6 +81,7 @@ class MemberRulesResult internal constructor(private val rulesData: MemberRulesD
|
||||
* @param conditions 条件方法体
|
||||
* @return [MemberRulesResult] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun count(conditions: CountConditions): MemberRulesResult {
|
||||
rulesData.matchCountConditions = conditions
|
||||
return this
|
||||
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/4.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE",
|
||||
"DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION", "DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members
|
||||
|
||||
@@ -33,6 +36,7 @@ import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorCond
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
@@ -48,6 +52,7 @@ import java.lang.reflect.Member
|
||||
* 可通过指定类型查找指定 [Constructor] 或一组 [Constructor]
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class ConstructorFinder internal constructor(override val classSet: Class<*>? = null) : MemberBaseFinder(tag = "Constructor", classSet) {
|
||||
|
||||
internal companion object {
|
||||
@@ -78,6 +83,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* 若参数个数小于零则忽略并使用 [param]
|
||||
* @return [Int]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var paramCount
|
||||
get() = rulesData.paramCount
|
||||
set(value) {
|
||||
@@ -91,6 +97,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition {
|
||||
rulesData.modifiers = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -101,6 +108,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
*
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun emptyParam() = paramCount(num = 0)
|
||||
|
||||
/**
|
||||
@@ -130,6 +138,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param paramType 参数类型数组 - 只能是 [Class]、[String]、[VariousClass]
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(vararg paramType: Any): IndexTypeCondition {
|
||||
if (paramType.isEmpty()) error("paramTypes is empty, please use emptyParam() instead")
|
||||
rulesData.paramTypes = mutableListOf<Class<*>>().apply { paramType.forEach { add(it.compat() ?: UndefinedType) } }.toTypedArray()
|
||||
@@ -153,6 +162,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(conditions: ObjectsConditions): IndexTypeCondition {
|
||||
rulesData.paramTypesConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -162,6 +172,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* 顺序筛选字节码的下标
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun order() = IndexTypeCondition(IndexConfigType.ORDER)
|
||||
|
||||
/**
|
||||
@@ -175,6 +186,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param num 个数
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(num: Int): IndexTypeCondition {
|
||||
rulesData.paramCount = num
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -195,6 +207,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param numRange 个数范围
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(numRange: IntRange): IndexTypeCondition {
|
||||
rulesData.paramCountRange = numRange
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -215,6 +228,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(conditions: CountConditions): IndexTypeCondition {
|
||||
rulesData.paramCountConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -226,6 +240,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若当前 [classSet] 的父类较多可能会耗时 - API 会自动循环到父类继承是 [Any] 前的最后一个类
|
||||
* @param isOnlySuperClass 是否仅在当前 [classSet] 的父类中查找 - 若父类是 [Any] 则不会生效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun superClass(isOnlySuperClass: Boolean = false) {
|
||||
rulesData.isFindInSuper = true
|
||||
if (isOnlySuperClass && classSet?.hasExtends == true) usedClassSet = classSet.superclass
|
||||
@@ -284,6 +299,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
*
|
||||
* 可累计失败次数直到查找成功
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
@@ -297,6 +313,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* 若最后依然失败 - 将停止查找并输出错误日志
|
||||
* @param initiate 方法体
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun constructor(initiate: ConstructorConditions) = Result().apply {
|
||||
remedyPlans.add(Pair(ConstructorFinder(classSet).apply {
|
||||
hookerManager = this@ConstructorFinder.hookerManager
|
||||
@@ -335,6 +352,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
*
|
||||
* 可在这里处理是否成功的回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
@@ -344,6 +362,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
@@ -355,6 +374,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param isNoSuch 是否没有找到 [Constructor] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Process internal constructor(
|
||||
internal val isNoSuch: Boolean = false,
|
||||
internal val throwable: Throwable? = null
|
||||
@@ -365,12 +385,14 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param initiate 方法体
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Process.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
* 设置全部查找条件匹配的多个 [Constructor] 实例结果到 [hookerManager]
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all(): Process {
|
||||
fun MutableList<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
if (isUsingRemedyPlan)
|
||||
@@ -390,6 +412,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param initiate 方法体
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Process {
|
||||
isUsingRemedyPlan = true
|
||||
if (isNoSuch) RemedyPlan().apply(initiate).build()
|
||||
@@ -403,6 +426,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param result 回调错误
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Process {
|
||||
if (isNoSuch) result(throwable ?: Throwable("Initialization Error"))
|
||||
return this
|
||||
@@ -414,6 +438,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param isNoSuch 是否没有找到 [Constructor] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor(
|
||||
internal val isNoSuch: Boolean = false,
|
||||
internal val throwable: Throwable? = null
|
||||
@@ -424,6 +449,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Result.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
@@ -436,6 +462,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若你设置了 [remedys] 请使用 [wait] 回调结果方法
|
||||
* @return [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun get() = Instance(give())
|
||||
|
||||
/**
|
||||
@@ -448,6 +475,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若你设置了 [remedys] 请使用 [waitAll] 回调结果方法
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all() = mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(it)) } }
|
||||
|
||||
/**
|
||||
@@ -458,6 +486,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 在查找条件找不到任何结果的时候将返回 null
|
||||
* @return [Constructor] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun give() = giveAll().takeIf { it.isNotEmpty() }?.first()
|
||||
|
||||
/**
|
||||
@@ -468,6 +497,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Constructor]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.constructors() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
@@ -480,6 +510,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若你没有设置 [remedys] 此方法将不会被回调
|
||||
* @param initiate 回调 [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun wait(initiate: Instance.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(get())
|
||||
else remedyPlansCallback = { initiate(get()) }
|
||||
@@ -495,6 +526,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若你没有设置 [remedys] 此方法将不会被回调
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun waitAll(initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all())
|
||||
else remedyPlansCallback = { initiate(all()) }
|
||||
@@ -509,6 +541,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result {
|
||||
isUsingRemedyPlan = true
|
||||
if (isNoSuch) RemedyPlan().apply(initiate).build()
|
||||
@@ -522,6 +555,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param result 回调错误
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result {
|
||||
if (isNoSuch) result(throwable ?: Throwable("Initialization Error"))
|
||||
return this
|
||||
@@ -535,6 +569,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 此时若要监听异常结果 - 你需要手动实现 [onNoSuchConstructor] 方法
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ignored(): Result {
|
||||
isIgnoreErrorLogs = true
|
||||
return this
|
||||
@@ -559,6 +594,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 请使用 [get]、[wait]、[all]、[waitAll] 方法来获取 [Instance]
|
||||
* @param constructor 当前 [Constructor] 实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Instance internal constructor(private val constructor: Constructor<*>?) {
|
||||
|
||||
/**
|
||||
@@ -573,6 +609,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param args [Constructor] 参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun call(vararg args: Any?) = baseCall(*args)
|
||||
|
||||
/**
|
||||
@@ -580,6 +617,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @param args [Constructor] 参数
|
||||
* @return [T] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun <T> newInstance(vararg args: Any?) = baseCall(*args) as? T?
|
||||
|
||||
override fun toString() = "[${constructor?.name ?: "<empty>"}]"
|
||||
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/4.
|
||||
*/
|
||||
@file:Suppress("unused", "UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE",
|
||||
"DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION", "DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members
|
||||
|
||||
@@ -34,6 +37,7 @@ import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
@@ -46,6 +50,7 @@ import java.lang.reflect.Field
|
||||
* 可通过指定类型查找指定 [Field] 或一组 [Field]
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class FieldFinder internal constructor(override val classSet: Class<*>? = null) : MemberBaseFinder(tag = "Field", classSet) {
|
||||
|
||||
internal companion object {
|
||||
@@ -74,6 +79,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 若不填写名称则必须存在一个其它条件
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var name
|
||||
get() = rulesData.name
|
||||
set(value) {
|
||||
@@ -88,6 +94,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 可不填写类型
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var type
|
||||
get() = rulesData.type
|
||||
set(value) {
|
||||
@@ -103,6 +110,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition {
|
||||
rulesData.modifiers = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -112,6 +120,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 顺序筛选字节码的下标
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun order() = IndexTypeCondition(IndexConfigType.ORDER)
|
||||
|
||||
/**
|
||||
@@ -123,6 +132,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param value 名称
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(value: String): IndexTypeCondition {
|
||||
rulesData.name = value
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -137,6 +147,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(conditions: NameConditions): IndexTypeCondition {
|
||||
rulesData.nameConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -151,6 +162,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param value 类型 - 只能是 [Class]、[String]、[VariousClass]
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun type(value: Any): IndexTypeCondition {
|
||||
rulesData.type = value.compat()
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -171,6 +183,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun type(conditions: ObjectConditions): IndexTypeCondition {
|
||||
rulesData.typeConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -182,6 +195,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 若当前 [classSet] 的父类较多可能会耗时 - API 会自动循环到父类继承是 [Any] 前的最后一个类
|
||||
* @param isOnlySuperClass 是否仅在当前 [classSet] 的父类中查找 - 若父类是 [Any] 则不会生效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun superClass(isOnlySuperClass: Boolean = false) {
|
||||
rulesData.isFindInSuper = true
|
||||
if (isOnlySuperClass && classSet?.hasExtends == true) usedClassSet = classSet.superclass
|
||||
@@ -232,6 +246,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* 可累计失败次数直到查找成功
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
@@ -246,6 +261,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 结果
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun field(initiate: FieldConditions) = Result().apply {
|
||||
remedyPlans.add(FieldFinder(classSet).apply {
|
||||
hookerManager = this@FieldFinder.hookerManager
|
||||
@@ -284,6 +300,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* 可在这里处理是否成功的回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
@@ -293,6 +310,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun onFind(initiate: MutableList<Field>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
@@ -305,6 +323,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param isNoSuch 是否没有找到 [Field] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor(
|
||||
internal val isNoSuch: Boolean = false,
|
||||
internal val throwable: Throwable? = null
|
||||
@@ -315,6 +334,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Result.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
@@ -330,6 +350,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance [Field] 所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @return [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun get(instance: Any? = null) = Instance(instance, give())
|
||||
|
||||
/**
|
||||
@@ -345,6 +366,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance [Field] 所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all(instance: Any? = null) =
|
||||
mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
|
||||
@@ -356,6 +378,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 在查找条件找不到任何结果的时候将返回 null
|
||||
* @return [Field] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun give() = giveAll().takeIf { it.isNotEmpty() }?.first()
|
||||
|
||||
/**
|
||||
@@ -366,6 +389,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Field]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.fields() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
@@ -379,6 +403,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun wait(instance: Any? = null, initiate: Instance.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(get(instance))
|
||||
else remedyPlansCallback = { initiate(get(instance)) }
|
||||
@@ -395,6 +420,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun waitAll(instance: Any? = null, initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all(instance))
|
||||
else remedyPlansCallback = { initiate(all(instance)) }
|
||||
@@ -411,6 +437,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result {
|
||||
isUsingRemedyPlan = true
|
||||
if (isNoSuch) RemedyPlan().apply(initiate).build()
|
||||
@@ -424,6 +451,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param result 回调错误
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun onNoSuchField(result: (Throwable) -> Unit): Result {
|
||||
if (isNoSuch) result(throwable ?: Throwable("Initialization Error"))
|
||||
return this
|
||||
@@ -437,6 +465,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 此时若要监听异常结果 - 你需要手动实现 [onNoSuchField] 方法
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ignored(): Result {
|
||||
isIgnoreErrorLogs = true
|
||||
return this
|
||||
@@ -460,6 +489,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 当前 [Field] 所在类的实例对象
|
||||
* @param field 当前 [Field] 实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Instance internal constructor(private val instance: Any?, private val field: Field?) {
|
||||
|
||||
/**
|
||||
@@ -475,6 +505,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param ignored 是否开启忽略错误警告功能 - 默认否
|
||||
* @return [CurrentClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun current(ignored: Boolean = false) = self?.current(ignored)
|
||||
|
||||
/**
|
||||
@@ -483,12 +514,14 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun current(ignored: Boolean = false, initiate: CurrentClass.() -> Unit) = self?.current(ignored, initiate)
|
||||
|
||||
/**
|
||||
* 得到当前 [Field] 实例
|
||||
* @return [T] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun <T> cast() = self as? T?
|
||||
|
||||
/**
|
||||
@@ -497,6 +530,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回 null
|
||||
* @return [Byte] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun byte() = cast<Byte?>()
|
||||
|
||||
/**
|
||||
@@ -505,6 +539,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Int] 取不到返回 0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun int() = cast() ?: 0
|
||||
|
||||
/**
|
||||
@@ -513,6 +548,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Long] 取不到返回 0L
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun long() = cast() ?: 0L
|
||||
|
||||
/**
|
||||
@@ -521,6 +557,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Short] 取不到返回 0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun short() = cast<Short?>() ?: 0
|
||||
|
||||
/**
|
||||
@@ -529,6 +566,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Double] 取不到返回 0.0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun double() = cast() ?: 0.0
|
||||
|
||||
/**
|
||||
@@ -537,6 +575,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Float] 取不到返回 0f
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun float() = cast() ?: 0f
|
||||
|
||||
/**
|
||||
@@ -545,6 +584,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [String] 取不到返回 ""
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun string() = cast() ?: ""
|
||||
|
||||
/**
|
||||
@@ -553,6 +593,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Char] 取不到返回 ' '
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun char() = cast() ?: ' '
|
||||
|
||||
/**
|
||||
@@ -561,12 +602,14 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回默认值
|
||||
* @return [Boolean] 取不到返回 false
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun boolean() = cast() ?: false
|
||||
|
||||
/**
|
||||
* 得到当前 [Field] 的 [Any] 实例
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun any() = self
|
||||
|
||||
/**
|
||||
@@ -575,6 +618,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回空数组
|
||||
* @return [Array] 取不到返回空数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> array() = cast() ?: arrayOf<T>()
|
||||
|
||||
/**
|
||||
@@ -583,12 +627,14 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Field] 的类型 - 发生错误会返回空数组
|
||||
* @return [List] 取不到返回空数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> list() = cast() ?: listOf<T>()
|
||||
|
||||
/**
|
||||
* 设置当前 [Field] 实例
|
||||
* @param any 设置的实例内容
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun set(any: Any?) = field?.set(instance, any)
|
||||
|
||||
/**
|
||||
@@ -596,6 +642,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 请确保示例对象类型为 [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun setTrue() = set(true)
|
||||
|
||||
/**
|
||||
@@ -603,9 +650,11 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 请确保示例对象类型为 [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun setFalse() = set(false)
|
||||
|
||||
/** 设置当前 [Field] 实例为 null */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun setNull() = set(null)
|
||||
|
||||
override fun toString() =
|
||||
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/4.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE",
|
||||
"DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION", "DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members
|
||||
|
||||
@@ -36,6 +39,7 @@ import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditi
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.hasExtends
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.type.defined.UndefinedType
|
||||
@@ -51,6 +55,7 @@ import java.lang.reflect.Method
|
||||
* 可通过指定类型查找指定 [Method] 或一组 [Method]
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class MethodFinder internal constructor(override val classSet: Class<*>? = null) : MemberBaseFinder(tag = "Method", classSet) {
|
||||
|
||||
internal companion object {
|
||||
@@ -79,6 +84,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 若不填写名称则必须存在一个其它条件
|
||||
* @return [String]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var name
|
||||
get() = rulesData.name
|
||||
set(value) {
|
||||
@@ -93,6 +99,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 若参数个数小于零则忽略并使用 [param]
|
||||
* @return [Int]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var paramCount
|
||||
get() = rulesData.paramCount
|
||||
set(value) {
|
||||
@@ -107,6 +114,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 可不填写返回值
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
var returnType
|
||||
get() = rulesData.returnType
|
||||
set(value) {
|
||||
@@ -122,6 +130,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition {
|
||||
rulesData.modifiers = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -132,6 +141,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun emptyParam() = paramCount(num = 0)
|
||||
|
||||
/**
|
||||
@@ -161,6 +171,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param paramType 参数类型数组 - 只能是 [Class]、[String]、[VariousClass]
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(vararg paramType: Any): IndexTypeCondition {
|
||||
if (paramType.isEmpty()) error("paramTypes is empty, please use emptyParam() instead")
|
||||
rulesData.paramTypes = mutableListOf<Class<*>>().apply { paramType.forEach { add(it.compat() ?: UndefinedType) } }.toTypedArray()
|
||||
@@ -184,6 +195,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun param(conditions: ObjectsConditions): IndexTypeCondition {
|
||||
rulesData.paramTypesConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -193,6 +205,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 顺序筛选字节码的下标
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun order() = IndexTypeCondition(IndexConfigType.ORDER)
|
||||
|
||||
/**
|
||||
@@ -204,6 +217,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param value 名称
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(value: String): IndexTypeCondition {
|
||||
rulesData.name = value
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -218,6 +232,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun name(conditions: NameConditions): IndexTypeCondition {
|
||||
rulesData.nameConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -234,6 +249,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param num 个数
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(num: Int): IndexTypeCondition {
|
||||
rulesData.paramCount = num
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -254,6 +270,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param numRange 个数范围
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(numRange: IntRange): IndexTypeCondition {
|
||||
rulesData.paramCountRange = numRange
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -274,6 +291,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun paramCount(conditions: CountConditions): IndexTypeCondition {
|
||||
rulesData.paramCountConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -288,6 +306,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param value 个数
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun returnType(value: Any): IndexTypeCondition {
|
||||
rulesData.returnType = value.compat()
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -308,6 +327,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param conditions 条件方法体
|
||||
* @return [BaseFinder.IndexTypeCondition]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun returnType(conditions: ObjectConditions): IndexTypeCondition {
|
||||
rulesData.returnTypeConditions = conditions
|
||||
return IndexTypeCondition(IndexConfigType.MATCH)
|
||||
@@ -319,6 +339,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 若当前 [classSet] 的父类较多可能会耗时 - API 会自动循环到父类继承是 [Any] 前的最后一个类
|
||||
* @param isOnlySuperClass 是否仅在当前 [classSet] 的父类中查找 - 若父类是 [Any] 则不会生效
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun superClass(isOnlySuperClass: Boolean = false) {
|
||||
rulesData.isFindInSuper = true
|
||||
if (isOnlySuperClass && classSet?.hasExtends == true) usedClassSet = classSet.superclass
|
||||
@@ -377,6 +398,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* 可累计失败次数直到查找成功
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
@@ -391,6 +413,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 结果
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun method(initiate: MethodConditions) = Result().apply {
|
||||
remedyPlans.add(Pair(MethodFinder(classSet).apply {
|
||||
hookerManager = this@MethodFinder.hookerManager
|
||||
@@ -429,6 +452,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* 可在这里处理是否成功的回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
@@ -438,6 +462,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun onFind(initiate: MutableList<Method>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
@@ -449,6 +474,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param isNoSuch 是否没有找 [Method] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Process internal constructor(
|
||||
internal val isNoSuch: Boolean = false,
|
||||
internal val throwable: Throwable? = null
|
||||
@@ -459,12 +485,14 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Process.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
* 设置全部查找条件匹配的多个 [Method] 实例结果到 [hookerManager]
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all(): Process {
|
||||
fun MutableList<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
if (isUsingRemedyPlan)
|
||||
@@ -484,6 +512,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Process {
|
||||
isUsingRemedyPlan = true
|
||||
if (isNoSuch) RemedyPlan().apply(initiate).build()
|
||||
@@ -497,6 +526,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param result 回调错误
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun onNoSuchMethod(result: (Throwable) -> Unit): Process {
|
||||
if (isNoSuch) result(throwable ?: Throwable("Initialization Error"))
|
||||
return this
|
||||
@@ -508,6 +538,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param isNoSuch 是否没有找到 [Method] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Result internal constructor(
|
||||
internal val isNoSuch: Boolean = false,
|
||||
internal val throwable: Throwable? = null
|
||||
@@ -518,6 +549,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun result(initiate: Result.() -> Unit) = apply(initiate)
|
||||
|
||||
/**
|
||||
@@ -531,6 +563,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @return [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun get(instance: Any? = null) = Instance(instance, give())
|
||||
|
||||
/**
|
||||
@@ -544,6 +577,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun all(instance: Any? = null) =
|
||||
mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
|
||||
@@ -555,6 +589,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 在查找条件找不到任何结果的时候将返回 null
|
||||
* @return [Method] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun give() = giveAll().takeIf { it.isNotEmpty() }?.first()
|
||||
|
||||
/**
|
||||
@@ -565,6 +600,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Method]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.methods() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
@@ -578,6 +614,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [Instance]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun wait(instance: Any? = null, initiate: Instance.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(get(instance))
|
||||
else remedyPlansCallback = { initiate(get(instance)) }
|
||||
@@ -594,6 +631,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun waitAll(instance: Any? = null, initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all(instance))
|
||||
else remedyPlansCallback = { initiate(all(instance)) }
|
||||
@@ -610,6 +648,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param initiate 方法体
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result {
|
||||
isUsingRemedyPlan = true
|
||||
if (isNoSuch) RemedyPlan().apply(initiate).build()
|
||||
@@ -623,6 +662,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param result 回调错误
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun onNoSuchMethod(result: (Throwable) -> Unit): Result {
|
||||
if (isNoSuch) result(throwable ?: Throwable("Initialization Error"))
|
||||
return this
|
||||
@@ -636,6 +676,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 此时若要监听异常结果 - 你需要手动实现 [onNoSuchMethod] 方法
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ignored(): Result {
|
||||
isIgnoreErrorLogs = true
|
||||
return this
|
||||
@@ -659,6 +700,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param instance 当前 [Method] 所在类的实例对象
|
||||
* @param method 当前 [Method] 实例对象
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inner class Instance internal constructor(private val instance: Any?, private val method: Method?) {
|
||||
|
||||
/** 标识需要调用当前 [Method] 未经 Hook 的原始方法 */
|
||||
@@ -672,6 +714,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 你只能在 (Xposed) 宿主环境中使用此功能
|
||||
* @return [Instance] 可继续向下监听
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun original(): Instance {
|
||||
isCallOriginal = true
|
||||
return this
|
||||
@@ -692,6 +735,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun call(vararg args: Any?) = baseCall(*args)
|
||||
|
||||
/**
|
||||
@@ -699,6 +743,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [T] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun <T> invoke(vararg args: Any?) = baseCall(*args) as? T?
|
||||
|
||||
/**
|
||||
@@ -708,6 +753,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Byte] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun byte(vararg args: Any?) = invoke<Byte?>(*args)
|
||||
|
||||
/**
|
||||
@@ -717,6 +763,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Int] 取不到返回 0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun int(vararg args: Any?) = invoke(*args) ?: 0
|
||||
|
||||
/**
|
||||
@@ -726,6 +773,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Long] 取不到返回 0L
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun long(vararg args: Any?) = invoke(*args) ?: 0L
|
||||
|
||||
/**
|
||||
@@ -735,6 +783,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Short] 取不到返回 0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun short(vararg args: Any?) = invoke<Short?>(*args) ?: 0
|
||||
|
||||
/**
|
||||
@@ -744,6 +793,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Double] 取不到返回 0.0
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun double(vararg args: Any?) = invoke(*args) ?: 0.0
|
||||
|
||||
/**
|
||||
@@ -753,6 +803,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Float] 取不到返回 0f
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun float(vararg args: Any?) = invoke(*args) ?: 0f
|
||||
|
||||
/**
|
||||
@@ -760,6 +811,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [String] 取不到返回 ""
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun string(vararg args: Any?) = invoke(*args) ?: ""
|
||||
|
||||
/**
|
||||
@@ -767,6 +819,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Char] 取不到返回 ' '
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun char(vararg args: Any?) = invoke(*args) ?: ' '
|
||||
|
||||
/**
|
||||
@@ -776,6 +829,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @param args 方法参数
|
||||
* @return [Boolean] 取不到返回 false
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun boolean(vararg args: Any?) = invoke(*args) ?: false
|
||||
|
||||
/**
|
||||
@@ -784,6 +838,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Method] 的返回值 - 发生错误会返回空数组
|
||||
* @return [Array] 取不到返回空数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> array(vararg args: Any?) = invoke(*args) ?: arrayOf<T>()
|
||||
|
||||
/**
|
||||
@@ -792,6 +847,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* - 请确认目标 [Method] 的返回值 - 发生错误会返回空数组
|
||||
* @return [List] 取不到返回空数组
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> list(vararg args: Any?) = invoke(*args) ?: listOf<T>()
|
||||
|
||||
override fun toString() = "[${method?.name ?: "<empty>"}] in [${instance?.javaClass?.name ?: "<empty>"}]"
|
||||
|
@@ -19,10 +19,13 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("TYPEALIAS_EXPANSION_DEPRECATION", "DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
/**
|
||||
@@ -33,6 +36,7 @@ import java.lang.reflect.Constructor
|
||||
* @param paramCountRange 参数个数范围
|
||||
* @param paramCountConditions 参数个数条件
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal class ConstructorRulesData internal constructor(
|
||||
var paramTypes: Array<out Class<*>>? = null,
|
||||
var paramTypesConditions: ObjectsConditions? = null,
|
||||
|
@@ -19,10 +19,13 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("TYPEALIAS_EXPANSION_DEPRECATION", "DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Field
|
||||
|
||||
/**
|
||||
@@ -32,6 +35,7 @@ import java.lang.reflect.Field
|
||||
* @param type 类型
|
||||
* @param typeConditions 类型条件
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal class FieldRulesData internal constructor(
|
||||
var name: String = "",
|
||||
var nameConditions: NameConditions? = null,
|
||||
|
@@ -19,11 +19,14 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.data.BaseRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.rules.ModifierRules
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Member
|
||||
|
||||
/**
|
||||
@@ -33,6 +36,7 @@ import java.lang.reflect.Member
|
||||
* @param matchCountRange 匹配的字节码个数范围
|
||||
* @param matchCountConditions 匹配的字节码个数条件
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal open class MemberRulesData internal constructor(
|
||||
var isFindInSuper: Boolean = false,
|
||||
var matchCount: Int = -1,
|
||||
|
@@ -19,12 +19,15 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/4.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.members.data
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import java.lang.reflect.Method
|
||||
|
||||
/**
|
||||
@@ -39,6 +42,7 @@ import java.lang.reflect.Method
|
||||
* @param returnType 返回值类型
|
||||
* @param returnTypeConditions 返回值类型条件
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal class MethodRulesData internal constructor(
|
||||
var name: String = "",
|
||||
var nameConditions: NameConditions? = null,
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/3/27.
|
||||
*/
|
||||
@file:Suppress("KotlinConstantConditions", "KDocUnresolvedReference")
|
||||
@file:Suppress("KotlinConstantConditions", "KDocUnresolvedReference", "DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.tools
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.highcapable.yukihookapi.hook.core.finder.members.data.ConstructorRule
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.data.MethodRulesData
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
@@ -62,6 +63,7 @@ import kotlin.math.abs
|
||||
/**
|
||||
* 这是一个对 [Class]、[Member] 查找的工具实现类
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal object ReflectionTool {
|
||||
|
||||
/** 当前工具类的标签 */
|
||||
|
@@ -19,6 +19,8 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/9/14.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core.finder.type.factory
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.base.rules.CountRules
|
||||
@@ -29,33 +31,44 @@ import com.highcapable.yukihookapi.hook.core.finder.classes.DexClassFinder
|
||||
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
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
|
||||
/** 定义 [ClassLoader] 装载实例方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ClassLoaderInitializer = () -> ClassLoader?
|
||||
|
||||
/** 定义 [DexClassFinder] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ClassConditions = DexClassFinder.() -> Unit
|
||||
|
||||
/** 定义 [FieldFinder] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias FieldConditions = FieldFinder.() -> Unit
|
||||
|
||||
/** 定义 [MethodFinder] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias MethodConditions = MethodFinder.() -> Unit
|
||||
|
||||
/** 定义 [ConstructorFinder] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ConstructorConditions = ConstructorFinder.() -> Unit
|
||||
|
||||
/** 定义 [NameRules] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias NameConditions = NameRules.(String) -> Boolean
|
||||
|
||||
/** 定义 [CountRules] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias CountConditions = CountRules.(Int) -> Boolean
|
||||
|
||||
/** 定义 [ModifierRules] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ModifierConditions = ModifierRules.() -> Boolean
|
||||
|
||||
/** 定义 [ObjectRules] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ObjectConditions = ObjectRules.(Class<*>) -> Boolean
|
||||
|
||||
/** 定义 [ObjectRules] 方法体类型 */
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal typealias ObjectsConditions = ObjectRules.(Array<Class<*>>) -> Boolean
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/2.
|
||||
*/
|
||||
@file:Suppress("unused", "UNCHECKED_CAST", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "UNCHECKED_CAST", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION",
|
||||
"DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.factory
|
||||
|
||||
@@ -38,6 +41,7 @@ import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorCond
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.type.java.AnyClass
|
||||
import com.highcapable.yukihookapi.hook.type.java.BooleanClass
|
||||
import com.highcapable.yukihookapi.hook.type.java.BooleanType
|
||||
@@ -86,6 +90,7 @@ enum class MembersType {
|
||||
* @param initialize 是否初始化
|
||||
* @param loader [ClassLoader] 装载实例
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
open class LazyClass<T> internal constructor(
|
||||
private val instance: Any,
|
||||
private val initialize: Boolean,
|
||||
@@ -161,6 +166,7 @@ open class LazyClass<T> internal constructor(
|
||||
* @return [List]<[String]>
|
||||
* @throws IllegalStateException 如果当前 [ClassLoader] 不是 [BaseDexClassLoader]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ClassLoader.listOfClasses() = ReflectionTool.findDexClassList(loader = this)
|
||||
|
||||
/**
|
||||
@@ -176,6 +182,7 @@ fun ClassLoader.listOfClasses() = ReflectionTool.findDexClassList(loader = this)
|
||||
* @param initiate 方法体
|
||||
* @return [DexClassFinder.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun ClassLoader.searchClass(name: String = "", async: Boolean = false, initiate: ClassConditions) =
|
||||
DexClassFinder(name, async = async || name.isNotBlank(), loaderSet = this).apply(initiate).build()
|
||||
|
||||
@@ -195,6 +202,7 @@ fun ClassLoader.onLoadClass(result: (Class<*>) -> Unit) = AppParasitics.hookClas
|
||||
* 当前 [Class] 是否有继承关系 - 父类是 [Any] 将被认为没有继承关系
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Class<*>.hasExtends get() = superclass != null && superclass != AnyClass
|
||||
|
||||
/**
|
||||
@@ -206,6 +214,7 @@ val Class<*>.hasExtends get() = superclass != null && superclass != AnyClass
|
||||
* @param other 需要判断的 [Class]
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
infix fun Class<*>?.extends(other: Class<*>?): Boolean {
|
||||
if (this == null || other == null) return false
|
||||
var isMatched = false
|
||||
@@ -230,6 +239,7 @@ infix fun Class<*>?.extends(other: Class<*>?): Boolean {
|
||||
* @param other 需要判断的 [Class]
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
infix fun Class<*>?.notExtends(other: Class<*>?) = extends(other).not()
|
||||
|
||||
/**
|
||||
@@ -239,6 +249,7 @@ infix fun Class<*>?.notExtends(other: Class<*>?) = extends(other).not()
|
||||
* @param other 需要判断的 [Class]
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
infix fun Class<*>?.implements(other: Class<*>?): Boolean {
|
||||
if (this == null || other == null) return false
|
||||
/**
|
||||
@@ -256,6 +267,7 @@ infix fun Class<*>?.implements(other: Class<*>?): Boolean {
|
||||
* @param other 需要判断的 [Class]
|
||||
* @return [Boolean]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
infix fun Class<*>?.notImplements(other: Class<*>?) = implements(other).not()
|
||||
|
||||
/**
|
||||
@@ -277,6 +289,7 @@ infix fun Class<*>?.notImplements(other: Class<*>?) = implements(other).not()
|
||||
* - [java.lang.Byte]
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Class<*>.toJavaPrimitiveType() = when (this) {
|
||||
classOf<Unit>(), UnitClass, UnitType -> UnitType
|
||||
BooleanClass, BooleanType -> BooleanType
|
||||
@@ -309,6 +322,7 @@ fun classOf(name: String, loader: ClassLoader? = null) = name.toClass(loader)
|
||||
* @return [Class]
|
||||
* @throws NoClassDefFoundError 如果找不到 [Class] 或设置了错误的 [ClassLoader]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.toClass(loader: ClassLoader? = null, initialize: Boolean = false) = ReflectionTool.findClassByName(name = this, loader, initialize)
|
||||
|
||||
/**
|
||||
@@ -319,6 +333,7 @@ fun String.toClass(loader: ClassLoader? = null, initialize: Boolean = false) = R
|
||||
* @throws NoClassDefFoundError 如果找不到 [Class] 或设置了错误的 [ClassLoader]
|
||||
* @throws IllegalStateException 如果 [Class] 的类型不为 [T]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName("toClass_Generics")
|
||||
inline fun <reified T> String.toClass(loader: ClassLoader? = null, initialize: Boolean = false) =
|
||||
ReflectionTool.findClassByName(name = this, loader, initialize) as? Class<T>? ?: error("Target Class type cannot cast to ${T::class.java}")
|
||||
@@ -331,6 +346,7 @@ inline fun <reified T> String.toClass(loader: ClassLoader? = null, initialize: B
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.toClassOrNull(loader: ClassLoader? = null, initialize: Boolean = false) = runCatching { toClass(loader, initialize) }.getOrNull()
|
||||
|
||||
/**
|
||||
@@ -341,6 +357,7 @@ fun String.toClassOrNull(loader: ClassLoader? = null, initialize: Boolean = fals
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class]<[T]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName("toClassOrNull_Generics")
|
||||
inline fun <reified T> String.toClassOrNull(loader: ClassLoader? = null, initialize: Boolean = false) =
|
||||
runCatching { toClass<T>(loader, initialize) }.getOrNull()
|
||||
@@ -352,6 +369,7 @@ inline fun <reified T> String.toClassOrNull(loader: ClassLoader? = null, initial
|
||||
* @return [Class]<[T]>
|
||||
* @throws NoClassDefFoundError 如果找不到 [Class] 或设置了错误的 [ClassLoader]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T> classOf(loader: ClassLoader? = null, initialize: Boolean = false) =
|
||||
loader?.let { T::class.java.name.toClass(loader, initialize) as Class<T> } ?: T::class.java
|
||||
|
||||
@@ -362,6 +380,7 @@ inline fun <reified T> classOf(loader: ClassLoader? = null, initialize: Boolean
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.NonNull]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClass(name: String, initialize: Boolean = false, loader: ClassLoaderInitializer? = null) =
|
||||
lazyClass<Any>(name, initialize, loader)
|
||||
|
||||
@@ -372,6 +391,7 @@ fun lazyClass(name: String, initialize: Boolean = false, loader: ClassLoaderInit
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.NonNull]<[T]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName("lazyClass_Generics")
|
||||
inline fun <reified T> lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = null) =
|
||||
LazyClass.NonNull<T>(name, initialize, loader)
|
||||
@@ -383,6 +403,7 @@ inline fun <reified T> lazyClass(name: String, initialize: Boolean = false, noin
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.NonNull]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClass(variousClass: VariousClass, initialize: Boolean = false, loader: ClassLoaderInitializer? = null) =
|
||||
LazyClass.NonNull<Any>(variousClass, initialize, loader)
|
||||
|
||||
@@ -393,6 +414,7 @@ fun lazyClass(variousClass: VariousClass, initialize: Boolean = false, loader: C
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.Nullable]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClassOrNull(name: String, initialize: Boolean = false, loader: ClassLoaderInitializer? = null) =
|
||||
lazyClassOrNull<Any>(name, initialize, loader)
|
||||
|
||||
@@ -403,6 +425,7 @@ fun lazyClassOrNull(name: String, initialize: Boolean = false, loader: ClassLoad
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.Nullable]<[T]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName("lazyClassOrNull_Generics")
|
||||
inline fun <reified T> lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = null) =
|
||||
LazyClass.Nullable<T>(name, initialize, loader)
|
||||
@@ -414,6 +437,7 @@ inline fun <reified T> lazyClassOrNull(name: String, initialize: Boolean = false
|
||||
* @param loader [ClassLoader] 装载实例 - 默认空 - 不填使用默认 [ClassLoader]
|
||||
* @return [LazyClass.Nullable]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClassOrNull(variousClass: VariousClass, initialize: Boolean = false, loader: ClassLoaderInitializer? = null) =
|
||||
LazyClass.Nullable<Any>(variousClass, initialize, loader)
|
||||
|
||||
@@ -422,6 +446,7 @@ fun lazyClassOrNull(variousClass: VariousClass, initialize: Boolean = false, loa
|
||||
* @param loader [Class] 所在的 [ClassLoader] - 不填使用默认 [ClassLoader]
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.hasClass(loader: ClassLoader? = null) = ReflectionTool.hasClassByName(name = this, loader)
|
||||
|
||||
/**
|
||||
@@ -429,6 +454,7 @@ fun String.hasClass(loader: ClassLoader? = null) = ReflectionTool.hasClassByName
|
||||
* @param initiate 方法体
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.hasField(initiate: FieldConditions) = field(initiate).ignored().isNoSuch.not()
|
||||
|
||||
/**
|
||||
@@ -436,6 +462,7 @@ inline fun Class<*>.hasField(initiate: FieldConditions) = field(initiate).ignore
|
||||
* @param initiate 方法体
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.hasMethod(initiate: MethodConditions) = method(initiate).ignored().isNoSuch.not()
|
||||
|
||||
/**
|
||||
@@ -443,6 +470,7 @@ inline fun Class<*>.hasMethod(initiate: MethodConditions) = method(initiate).ign
|
||||
* @param initiate 方法体
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.hasConstructor(initiate: ConstructorConditions = { emptyParam() }) = constructor(initiate).ignored().isNoSuch.not()
|
||||
|
||||
/**
|
||||
@@ -450,6 +478,7 @@ inline fun Class<*>.hasConstructor(initiate: ConstructorConditions = { emptyPara
|
||||
* @param conditions 条件方法体
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Member.hasModifiers(conditions: ModifierConditions) = conditions(ModifierRules.with(instance = this))
|
||||
|
||||
/**
|
||||
@@ -457,6 +486,7 @@ inline fun Member.hasModifiers(conditions: ModifierConditions) = conditions(Modi
|
||||
* @param conditions 条件方法体
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.hasModifiers(conditions: ModifierConditions) = conditions(ModifierRules.with(instance = this))
|
||||
|
||||
/**
|
||||
@@ -464,6 +494,7 @@ inline fun Class<*>.hasModifiers(conditions: ModifierConditions) = conditions(Mo
|
||||
* @param initiate 查找方法体
|
||||
* @return [FieldFinder.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.field(initiate: FieldConditions = {}) = FieldFinder(classSet = this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -471,6 +502,7 @@ inline fun Class<*>.field(initiate: FieldConditions = {}) = FieldFinder(classSet
|
||||
* @param initiate 查找方法体
|
||||
* @return [MethodFinder.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.method(initiate: MethodConditions = {}) = MethodFinder(classSet = this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -478,6 +510,7 @@ inline fun Class<*>.method(initiate: MethodConditions = {}) = MethodFinder(class
|
||||
* @param initiate 查找方法体
|
||||
* @return [ConstructorFinder.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.constructor(initiate: ConstructorConditions = {}) = ConstructorFinder(classSet = this).apply(initiate).build()
|
||||
|
||||
/**
|
||||
@@ -486,6 +519,7 @@ inline fun Class<*>.constructor(initiate: ConstructorConditions = {}) = Construc
|
||||
* 如果当前实例不存在泛型将返回 null
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun Class<*>.generic() = genericSuperclass?.let { (it as? ParameterizedType?)?.let { e -> GenericClass(e) } }
|
||||
|
||||
/**
|
||||
@@ -495,6 +529,7 @@ fun Class<*>.generic() = genericSuperclass?.let { (it as? ParameterizedType?)?.l
|
||||
* @param initiate 实例方法体
|
||||
* @return [GenericClass] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.generic(initiate: GenericClass.() -> Unit) = generic()?.apply(initiate)
|
||||
|
||||
/**
|
||||
@@ -502,6 +537,7 @@ inline fun Class<*>.generic(initiate: GenericClass.() -> Unit) = generic()?.appl
|
||||
* @param ignored 是否开启忽略错误警告功能 - 默认否
|
||||
* @return [CurrentClass]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean = false) =
|
||||
CurrentClass(javaClass, instance = this).apply { isIgnoreErrorLogs = ignored }
|
||||
|
||||
@@ -511,6 +547,7 @@ inline fun <reified T : Any> T.current(ignored: Boolean = false) =
|
||||
* @param initiate 方法体
|
||||
* @return [T]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean = false, initiate: CurrentClass.() -> Unit): T {
|
||||
current(ignored).apply(initiate)
|
||||
return this
|
||||
@@ -533,6 +570,7 @@ fun Class<*>.buildOfAny(vararg args: Any?, initiate: ConstructorConditions = { e
|
||||
* @param initiate 查找方法体
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions = { emptyParam() }) =
|
||||
constructor(initiate).get().call(*args)
|
||||
|
||||
@@ -542,6 +580,7 @@ inline fun Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions =
|
||||
* @param initiate 查找方法体
|
||||
* @return [T] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
@JvmName(name = "buildOf_Generics")
|
||||
inline fun <T> Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions = { emptyParam() }) =
|
||||
constructor(initiate).get().newInstance<T>(*args)
|
||||
@@ -551,6 +590,7 @@ inline fun <T> Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditio
|
||||
* @param isAccessible 是否强制设置成员为可访问类型 - 默认是
|
||||
* @param result 回调 - ([Int] 下标,[Method] 实例)
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.allMethods(isAccessible: Boolean = true, result: (index: Int, method: Method) -> Unit) =
|
||||
declaredMethods.forEachIndexed { p, it -> result(p, it.also { e -> e.isAccessible = isAccessible }) }
|
||||
|
||||
@@ -559,6 +599,7 @@ inline fun Class<*>.allMethods(isAccessible: Boolean = true, result: (index: Int
|
||||
* @param isAccessible 是否强制设置成员为可访问类型 - 默认是
|
||||
* @param result 回调 - ([Int] 下标,[Constructor] 实例)
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.allConstructors(isAccessible: Boolean = true, result: (index: Int, constructor: Constructor<*>) -> Unit) =
|
||||
declaredConstructors.forEachIndexed { p, it -> result(p, it.also { e -> e.isAccessible = isAccessible }) }
|
||||
|
||||
@@ -567,5 +608,6 @@ inline fun Class<*>.allConstructors(isAccessible: Boolean = true, result: (index
|
||||
* @param isAccessible 是否强制设置成员为可访问类型 - 默认是
|
||||
* @param result 回调 - ([Int] 下标,[Field] 实例)
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun Class<*>.allFields(isAccessible: Boolean = true, result: (index: Int, field: Field) -> Unit) =
|
||||
declaredFields.forEachIndexed { p, it -> result(p, it.also { e -> e.isAccessible = isAccessible }) }
|
@@ -28,13 +28,13 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import android.view.ContextThemeWrapper
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.core.net.toUri
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||
@@ -209,7 +209,7 @@ internal val Context.isTaiChiModuleActive: Boolean
|
||||
* @return [Boolean] or null
|
||||
*/
|
||||
fun isModuleActive() =
|
||||
contentResolver?.call(Uri.parse("content://me.weishu.exposed.CP/"), "active", null, null)?.getBoolean("active", false)
|
||||
contentResolver?.call("content://me.weishu.exposed.CP/".toUri(), "active", null, null)?.getBoolean("active", false)
|
||||
return runCatching { isModuleActive() }.getOrNull() ?: runCatching {
|
||||
startActivity(Intent("me.weishu.exp.ACTION_ACTIVE").apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
|
||||
isModuleActive()
|
||||
|
@@ -27,7 +27,6 @@ import android.system.ErrnoException
|
||||
import android.util.Log
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.log.data.YLogData
|
||||
import com.highcapable.yukihookapi.hook.utils.factory.dumpToString
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule
|
||||
@@ -182,7 +181,7 @@ object YLog {
|
||||
data.takeIf { it.isNotEmpty() }?.forEach {
|
||||
content += "${it.head}$it\n"
|
||||
it.throwable?.also { e ->
|
||||
content += "${it.head}Dump stack trace for \"${e.current().name}\":\n"
|
||||
content += "${it.head}Dump stack trace for \"${e.javaClass.name}\":\n"
|
||||
content += e.dumpToString()
|
||||
}
|
||||
}; return content
|
||||
|
@@ -24,11 +24,11 @@
|
||||
package com.highcapable.yukihookapi.hook.param
|
||||
|
||||
import android.os.Bundle
|
||||
import com.highcapable.kavaref.extension.classOf
|
||||
import com.highcapable.yukihookapi.hook.core.YukiMemberHookCreator
|
||||
import com.highcapable.yukihookapi.hook.core.YukiMemberHookCreator.MemberHookCreator
|
||||
import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper
|
||||
import com.highcapable.yukihookapi.hook.core.api.proxy.YukiHookCallback
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Member
|
||||
@@ -179,20 +179,20 @@ class HookParam private constructor(
|
||||
* 获取当前 Hook 对象的 [method] or [constructor] 的返回值 [T]
|
||||
* @return [T] or null
|
||||
*/
|
||||
inline fun <reified T> result() = result as? T?
|
||||
inline fun <reified T : Any> result() = result as? T?
|
||||
|
||||
/**
|
||||
* 获取当前 Hook 实例的对象 [T]
|
||||
* @return [T]
|
||||
* @throws IllegalStateException 如果对象为空或对象类型不是 [T]
|
||||
*/
|
||||
inline fun <reified T> instance() = instance as? T? ?: error("HookParam instance cannot cast to ${classOf<T>().name}")
|
||||
inline fun <reified T : Any> instance() = instance as? T? ?: error("HookParam instance cannot cast to ${classOf<T>().name}")
|
||||
|
||||
/**
|
||||
* 获取当前 Hook 实例的对象 [T]
|
||||
* @return [T] or null
|
||||
*/
|
||||
inline fun <reified T> instanceOrNull() = instanceOrNull as? T?
|
||||
inline fun <reified T : Any> instanceOrNull() = instanceOrNull as? T?
|
||||
|
||||
/**
|
||||
* 获取当前 Hook 对象的 [method] or [constructor] 的参数数组下标实例化类
|
||||
|
@@ -19,7 +19,10 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/2.
|
||||
*/
|
||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
@file:Suppress(
|
||||
"unused", "MemberVisibilityCanBePrivate", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "DeprecatedCallableAddReplaceWith", "DEPRECATION",
|
||||
"TYPEALIAS_EXPANSION_DEPRECATION"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.param
|
||||
|
||||
@@ -30,11 +33,14 @@ import android.content.IntentFilter
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import com.highcapable.kavaref.extension.VariousClass
|
||||
import com.highcapable.kavaref.resolver.ConstructorResolver
|
||||
import com.highcapable.kavaref.resolver.MethodResolver
|
||||
import com.highcapable.kavaref.resolver.base.MemberResolver
|
||||
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
|
||||
import com.highcapable.yukihookapi.hook.core.YukiMemberHookCreator
|
||||
import com.highcapable.yukihookapi.hook.core.YukiResourcesHookCreator
|
||||
import com.highcapable.yukihookapi.hook.core.annotation.LegacyHookApi
|
||||
@@ -46,9 +52,9 @@ import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ClassConditions
|
||||
import com.highcapable.yukihookapi.hook.core.finder.type.factory.ClassLoaderInitializer
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||
import com.highcapable.yukihookapi.hook.factory.LazyClass
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper
|
||||
import com.highcapable.yukihookapi.hook.utils.factory.value
|
||||
@@ -62,11 +68,14 @@ import com.highcapable.yukihookapi.hook.xposed.prefs.YukiHookPrefsBridge
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Member
|
||||
import java.lang.reflect.Method
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass as hasClassGlobal
|
||||
import com.highcapable.yukihookapi.hook.factory.lazyClass as lazyClassGlobal
|
||||
import com.highcapable.yukihookapi.hook.factory.lazyClassOrNull as lazyClassOrNullGlobal
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass as toClassGlobal
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull as toClassOrNullGlobal
|
||||
import com.highcapable.kavaref.extension.lazyClass as lazyClassGlobal
|
||||
import com.highcapable.kavaref.extension.lazyClassOrNull as lazyClassOrNullGlobal
|
||||
import com.highcapable.kavaref.extension.toClass as toClassGlobal
|
||||
import com.highcapable.kavaref.extension.toClassOrNull as toClassOrNullGlobal
|
||||
import com.highcapable.yukihookapi.hook.bean.VariousClass as LegacyVariousClass
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass as hasClassLegacy
|
||||
import com.highcapable.yukihookapi.hook.factory.lazyClass as lazyClassGlobalLegacy
|
||||
import com.highcapable.yukihookapi.hook.factory.lazyClassOrNull as lazyClassOrNullGlobalLegacy
|
||||
|
||||
/**
|
||||
* 装载 Hook 的目标 APP 入口对象实现类
|
||||
@@ -132,7 +141,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [Context] ContextImpl 实例对象
|
||||
* @throws IllegalStateException 如果获取不到系统框架的 [Context]
|
||||
*/
|
||||
val systemContext get() = AppParasitics.systemContext
|
||||
val systemContext get() = AppParasitics.systemContext ?: error("Failed to got SystemContext")
|
||||
|
||||
/**
|
||||
* 获取当前 Hook APP 的进程名称
|
||||
@@ -463,6 +472,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param initiate 方法体
|
||||
* @return [DexClassFinder.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun searchClass(name: String = "", async: Boolean = false, initiate: ClassConditions) =
|
||||
DexClassFinder(name, async = async || name.isNotBlank(), appClassLoader).apply(initiate).build()
|
||||
|
||||
@@ -480,7 +490,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
get() = toClass()
|
||||
|
||||
/**
|
||||
* [VariousClass] 转换为当前 Hook APP 的实体类
|
||||
* [LegacyVariousClass] 转换为当前 Hook APP 的实体类
|
||||
*
|
||||
* - 此方法已弃用 - 在之后的版本中将直接被删除
|
||||
*
|
||||
@@ -489,7 +499,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @throws IllegalStateException 如果任何 [Class] 都没有匹配到
|
||||
*/
|
||||
@Deprecated(message = "请使用新的命名方法", ReplaceWith("toClass()"))
|
||||
val VariousClass.clazz
|
||||
val LegacyVariousClass.clazz
|
||||
get() = toClass()
|
||||
|
||||
/**
|
||||
@@ -523,7 +533,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @throws IllegalStateException 如果 [Class] 的类型不为 [T]
|
||||
*/
|
||||
@JvmName("toClass_Generics")
|
||||
inline fun <reified T> String.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) =
|
||||
inline fun <reified T : Any> String.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) =
|
||||
toClassGlobal<T>(loader, initialize)
|
||||
|
||||
/**
|
||||
@@ -546,9 +556,19 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [Class]<[T]> or null
|
||||
*/
|
||||
@JvmName("toClassOrNull_Generics")
|
||||
inline fun <reified T> String.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) =
|
||||
inline fun <reified T : Any> String.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) =
|
||||
toClassOrNullGlobal<T>(loader, initialize)
|
||||
|
||||
/**
|
||||
* [LegacyVariousClass] 转换为 [loader] 中的实体类
|
||||
* @param loader [Class] 所在的 [ClassLoader] - 不填使用 [appClassLoader]
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class]
|
||||
* @throws IllegalStateException 如果任何 [Class] 都没有匹配到
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun LegacyVariousClass.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = get(loader, initialize)
|
||||
|
||||
/**
|
||||
* [VariousClass] 转换为 [loader] 中的实体类
|
||||
* @param loader [Class] 所在的 [ClassLoader] - 不填使用 [appClassLoader]
|
||||
@@ -556,7 +576,18 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [Class]
|
||||
* @throws IllegalStateException 如果任何 [Class] 都没有匹配到
|
||||
*/
|
||||
fun VariousClass.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = get(loader, initialize)
|
||||
fun VariousClass.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = load(loader, initialize)
|
||||
|
||||
/**
|
||||
* [LegacyVariousClass] 转换为 [loader] 中的实体类
|
||||
*
|
||||
* 匹配不到 [Class] 会返回 null - 不会抛出异常
|
||||
* @param loader [Class] 所在的 [ClassLoader] - 不填使用 [appClassLoader]
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun LegacyVariousClass.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = getOrNull(loader, initialize)
|
||||
|
||||
/**
|
||||
* [VariousClass] 转换为 [loader] 中的实体类
|
||||
@@ -566,7 +597,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @return [Class] or null
|
||||
*/
|
||||
fun VariousClass.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = getOrNull(loader, initialize)
|
||||
fun VariousClass.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = loadOrNull(loader, initialize)
|
||||
|
||||
/**
|
||||
* 懒装载 [Class]
|
||||
@@ -586,9 +617,20 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [LazyClass.NonNull]<[T]>
|
||||
*/
|
||||
@JvmName("lazyClass_Generics")
|
||||
inline fun <reified T> lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
inline fun <reified T : Any> lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
lazyClassGlobal<T>(name, initialize, loader)
|
||||
|
||||
/**
|
||||
* 懒装载 [Class]
|
||||
* @param variousClass [LegacyVariousClass]
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @param loader [ClassLoader] 装载实例 - 不填使用 [appClassLoader]
|
||||
* @return [LazyClass.NonNull]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClass(variousClass: LegacyVariousClass, initialize: Boolean = false, loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
lazyClassGlobalLegacy(variousClass, initialize, loader)
|
||||
|
||||
/**
|
||||
* 懒装载 [Class]
|
||||
* @param variousClass [VariousClass]
|
||||
@@ -617,9 +659,20 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [LazyClass.Nullable]<[T]>
|
||||
*/
|
||||
@JvmName("lazyClassOrNull_Generics")
|
||||
inline fun <reified T> lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
inline fun <reified T : Any> lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
lazyClassOrNullGlobal<T>(name, initialize, loader)
|
||||
|
||||
/**
|
||||
* 懒装载 [Class]
|
||||
* @param variousClass [LegacyVariousClass]
|
||||
* @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
|
||||
* @param loader [ClassLoader] 装载实例 - 不填使用 [appClassLoader]
|
||||
* @return [LazyClass.Nullable]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun lazyClassOrNull(variousClass: LegacyVariousClass, initialize: Boolean = false, loader: ClassLoaderInitializer? = appLoaderInit) =
|
||||
lazyClassOrNullGlobalLegacy(variousClass, initialize, loader)
|
||||
|
||||
/**
|
||||
* 懒装载 [Class]
|
||||
* @param variousClass [VariousClass]
|
||||
@@ -635,7 +688,8 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param loader [Class] 所在的 [ClassLoader] - 不填使用 [appClassLoader]
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
fun String.hasClass(loader: ClassLoader? = appClassLoader) = hasClassGlobal(loader)
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun String.hasClass(loader: ClassLoader? = appClassLoader) = hasClassLegacy(loader)
|
||||
|
||||
/**
|
||||
* 查找并装载 [HookClass]
|
||||
@@ -654,12 +708,12 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
*
|
||||
* - 此方法已弃用 - 在之后的版本中将直接被删除
|
||||
*
|
||||
* - 请现在迁移到 [VariousClass]
|
||||
* - 请现在迁移到 [LegacyVariousClass]
|
||||
* @return [HookClass]
|
||||
*/
|
||||
@LegacyHookApi
|
||||
@Deprecated(message = "不再推荐使用此方法", ReplaceWith("VariousClass(*name)"))
|
||||
fun findClass(vararg name: String, loader: ClassLoader? = appClassLoader) = VariousClass(*name).toHookClass(loader)
|
||||
fun findClass(vararg name: String, loader: ClassLoader? = appClassLoader) = LegacyVariousClass(*name).toHookClass(loader)
|
||||
|
||||
/**
|
||||
* Hook 方法、构造方法
|
||||
@@ -699,7 +753,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @return [YukiMemberHookCreator.Result]
|
||||
*/
|
||||
@LegacyHookApi
|
||||
inline fun VariousClass.hook(initiate: YukiMemberHookCreator.() -> Unit) = toHookClass().hook(initiate)
|
||||
inline fun LegacyVariousClass.hook(initiate: YukiMemberHookCreator.() -> Unit) = toHookClass().hook(initiate)
|
||||
|
||||
/**
|
||||
* Hook 方法、构造方法
|
||||
@@ -739,6 +793,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun BaseFinder.BaseResult.hook(priority: YukiHookPriority = YukiHookPriority.DEFAULT) = baseHook(isMultiple = false, priority)
|
||||
|
||||
/**
|
||||
@@ -749,11 +804,56 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param initiate 方法体
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun BaseFinder.BaseResult.hook(
|
||||
priority: YukiHookPriority = YukiHookPriority.DEFAULT,
|
||||
initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit
|
||||
) = baseHook(isMultiple = false, priority, isLazyMode = true).apply(initiate).build()
|
||||
|
||||
/**
|
||||
* 通过 [MemberResolver] 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
fun MemberResolver<*, *>.hook(priority: YukiHookPriority = YukiHookPriority.DEFAULT) = baseHook(priority)
|
||||
|
||||
/**
|
||||
* 通过 [MemberResolver] 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @param initiate 方法体
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
inline fun MemberResolver<*, *>.hook(
|
||||
priority: YukiHookPriority = YukiHookPriority.DEFAULT,
|
||||
initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit
|
||||
) = hook(priority).apply(initiate)
|
||||
|
||||
/**
|
||||
* 通过 [List]<[MemberResolver]> 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
fun List<MemberResolver<*, *>>.hookAll(priority: YukiHookPriority = YukiHookPriority.DEFAULT) = baseHook(priority)
|
||||
|
||||
/**
|
||||
* 通过 [List]<[MemberResolver]> 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @param initiate 方法体
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator.Result]
|
||||
*/
|
||||
inline fun List<MemberResolver<*, *>>.hookAll(
|
||||
priority: YukiHookPriority = YukiHookPriority.DEFAULT,
|
||||
initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit
|
||||
) = hookAll(priority).apply(initiate)
|
||||
|
||||
/**
|
||||
* 直接 Hook 方法、构造方法 (批量)
|
||||
*
|
||||
@@ -783,6 +883,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
@JvmName("hookAll_Member")
|
||||
fun List<Member>.hookAll(priority: YukiHookPriority = YukiHookPriority.DEFAULT) = baseHook(priority)
|
||||
|
||||
/**
|
||||
@@ -805,6 +906,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param priority Hook 优先级 - 默认为 [YukiHookPriority.DEFAULT]
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun BaseFinder.BaseResult.hookAll(priority: YukiHookPriority = YukiHookPriority.DEFAULT) = baseHook(isMultiple = true, priority)
|
||||
|
||||
/**
|
||||
@@ -815,6 +917,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param initiate 方法体
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator.Result]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
inline fun BaseFinder.BaseResult.hookAll(
|
||||
priority: YukiHookPriority = YukiHookPriority.DEFAULT,
|
||||
initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit
|
||||
@@ -846,6 +949,34 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
else -> error("This type [$this] not support to hook, supported are Constructors and Methods")
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 [MemberResolver] 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级
|
||||
* @param isLazyMode 是否为惰性模式 - 默认否
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
private fun MemberResolver<*, *>.baseHook(priority: YukiHookPriority, isLazyMode: Boolean = false) = when (this) {
|
||||
is ConstructorResolver,
|
||||
is MethodResolver -> YukiMemberHookCreator.createMemberHook(packageParam = this@PackageParam, listOf(self), priority, isLazyMode)
|
||||
else -> error("This type [$this] not support to hook, supported are Constructors and Methods")
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 [List]<[MemberResolver]> 直接 Hook 方法、构造方法
|
||||
*
|
||||
* - 此功能尚在实验阶段 - 在 1.x.x 版本将暂定于此 - 在 2.0.0 版本将完全使用 KavaRef 接管
|
||||
* @param priority Hook 优先级
|
||||
* @param isLazyMode 是否为惰性模式 - 默认否
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
private fun List<MemberResolver<*, *>>.baseHook(priority: YukiHookPriority, isLazyMode: Boolean = false) =
|
||||
YukiMemberHookCreator.createMemberHook(packageParam = this@PackageParam, onEach {
|
||||
if (it !is ConstructorResolver && it !is MethodResolver)
|
||||
error("This type [$it] not support to hook, supported are Constructors and Methods")
|
||||
}.map { it.self }, priority, isLazyMode)
|
||||
|
||||
/**
|
||||
* 直接 Hook 方法、构造方法
|
||||
*
|
||||
@@ -854,6 +985,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
* @param isLazyMode 是否为惰性模式 - 默认否
|
||||
* @return [YukiMemberHookCreator.MemberHookCreator]
|
||||
*/
|
||||
@JvmName("baseHook_Member")
|
||||
private fun List<Member>.baseHook(priority: YukiHookPriority, isLazyMode: Boolean = false) =
|
||||
YukiMemberHookCreator.createMemberHook(packageParam = this@PackageParam, onEach {
|
||||
if (it !is Constructor<*> && it !is Method) error("This type [$it] not support to hook, supported are Constructors and Methods")
|
||||
@@ -870,12 +1002,12 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
|
||||
YukiResourcesHookCreator(packageParam = this@PackageParam, hookResources = this).apply(initiate).hook()
|
||||
|
||||
/**
|
||||
* [VariousClass] 转换为 [HookClass]
|
||||
* [LegacyVariousClass] 转换为 [HookClass]
|
||||
* @param loader 当前 [ClassLoader] - 不填使用 [appClassLoader]
|
||||
* @return [HookClass]
|
||||
*/
|
||||
@LegacyHookApi
|
||||
private fun VariousClass.toHookClass(loader: ClassLoader? = appClassLoader) =
|
||||
private fun LegacyVariousClass.toHookClass(loader: ClassLoader? = appClassLoader) =
|
||||
runCatching { get(loader).toHookClass() }.getOrElse { HookClass(name = "VariousClass", throwable = Throwable(it.message)) }
|
||||
|
||||
/**
|
||||
|
@@ -19,11 +19,11 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/2.
|
||||
*/
|
||||
@file:Suppress("unused", "KDocUnresolvedReference", "DEPRECATION")
|
||||
@file:Suppress("DEPRECATION", "KDocUnresolvedReference", "ktlint:standard:no-wildcard-imports", "unused", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.type.android
|
||||
|
||||
import android.app.* // ktlint-disable no-wildcard-imports
|
||||
import android.app.*
|
||||
import android.appwidget.AppWidgetHost
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetProvider
|
||||
@@ -46,6 +46,7 @@ import android.view.accessibility.AccessibilityEvent
|
||||
import android.view.accessibility.AccessibilityManager
|
||||
import android.view.accessibility.AccessibilityNodeInfo
|
||||
import android.widget.Toast
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
@@ -54,78 +55,91 @@ import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
* 获得 [android.R] 类型
|
||||
* @return [Class]<[android.R]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AndroidRClass get() = classOf<android.R>()
|
||||
|
||||
/**
|
||||
* 获得 [Context] 类型
|
||||
* @return [Class]<[Context]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContextClass get() = classOf<Context>()
|
||||
|
||||
/**
|
||||
* 获得 [ContextImpl] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContextImplClass get() = "android.app.ContextImpl".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [ContextWrapper] 类型
|
||||
* @return [Class]<[ContextWrapper]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContextWrapperClass get() = classOf<ContextWrapper>()
|
||||
|
||||
/**
|
||||
* 获得 [Application] 类型
|
||||
* @return [Class]<[Application]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ApplicationClass get() = classOf<Application>()
|
||||
|
||||
/**
|
||||
* 获得 [ApplicationInfo] 类型
|
||||
* @return [Class]<[ApplicationInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ApplicationInfoClass get() = classOf<ApplicationInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [Instrumentation] 类型
|
||||
* @return [Class]<[Instrumentation]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val InstrumentationClass get() = classOf<Instrumentation>()
|
||||
|
||||
/**
|
||||
* 获得 [PackageInfo] 类型
|
||||
* @return [Class]<[PackageInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PackageInfoClass get() = classOf<PackageInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [ApplicationPackageManager] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ApplicationPackageManagerClass get() = "android.app.ApplicationPackageManager".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [ActivityThread] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityThreadClass get() = "android.app.ActivityThread".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [ActivityManager] 类型
|
||||
* @return [Class]<[ActivityManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityManagerClass get() = classOf<ActivityManager>()
|
||||
|
||||
/**
|
||||
* 获得 [IActivityManager] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IActivityManagerClass get() = "android.app.IActivityManager".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [ActivityManagerNative] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityManagerNativeClass get() = "android.app.ActivityManagerNative".toClass()
|
||||
|
||||
/**
|
||||
@@ -134,6 +148,7 @@ val ActivityManagerNativeClass get() = "android.app.ActivityManagerNative".toCla
|
||||
* - 在 Android O (26) 及以上系统加入
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IActivityTaskManagerClass get() = "android.app.IActivityTaskManager".toClassOrNull()
|
||||
|
||||
/**
|
||||
@@ -142,204 +157,238 @@ val IActivityTaskManagerClass get() = "android.app.IActivityTaskManager".toClass
|
||||
* - 在 Android O (26) 及以上系统加入
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityTaskManagerClass get() = "android.app.ActivityTaskManager".toClassOrNull()
|
||||
|
||||
/**
|
||||
* 获得 [IPackageManager] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IPackageManagerClass get() = "android.content.pm.IPackageManager".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [ClientTransaction] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ClientTransactionClass get() = "android.app.servertransaction.ClientTransaction".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [LoadedApk] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LoadedApkClass get() = "android.app.LoadedApk".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [Singleton] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SingletonClass get() = "android.util.Singleton".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [Activity] 类型
|
||||
* @return [Class]<[Activity]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityClass get() = classOf<Activity>()
|
||||
|
||||
/**
|
||||
* 获得 [Looper] 类型
|
||||
* @return [Class]<[Looper]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LooperClass get() = classOf<Looper>()
|
||||
|
||||
/**
|
||||
* 获得 [Fragment] 类型 - Support
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FragmentClass_AndroidSupport get() = "android.support.v4.app.Fragment".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [Fragment] 类型 - AndroidX
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FragmentClass_AndroidX get() = "androidx.fragment.app.Fragment".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [FragmentActivity] 类型 - Support
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FragmentActivityClass_AndroidSupport get() = "android.support.v4.app.FragmentActivity".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [FragmentActivity] 类型 - AndroidX
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FragmentActivityClass_AndroidX get() = "androidx.fragment.app.FragmentActivity".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [DocumentFile] 类型 - AndroidX
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DocumentFileClass get() = "androidx.documentfile.provider.DocumentFile".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [Service] 类型
|
||||
* @return [Class]<[Service]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ServiceClass get() = classOf<Service>()
|
||||
|
||||
/**
|
||||
* 获得 [Binder] 类型
|
||||
* @return [Class]<[Binder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BinderClass get() = classOf<Binder>()
|
||||
|
||||
/**
|
||||
* 获得 [IBinder] 类型
|
||||
* @return [Class]<[IBinder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IBinderClass get() = classOf<IBinder>()
|
||||
|
||||
/**
|
||||
* 获得 [BroadcastReceiver] 类型
|
||||
* @return [Class]<[BroadcastReceiver]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BroadcastReceiverClass get() = classOf<BroadcastReceiver>()
|
||||
|
||||
/**
|
||||
* 获得 [Bundle] 类型
|
||||
* @return [Class]<[Bundle]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BundleClass get() = classOf<Bundle>()
|
||||
|
||||
/**
|
||||
* 获得 [BaseBundle] 类型
|
||||
* @return [Class]<[BaseBundle]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BaseBundleClass get() = classOf<BaseBundle>()
|
||||
|
||||
/**
|
||||
* 获得 [Resources] 类型
|
||||
* @return [Class]<[Resources]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ResourcesClass get() = classOf<Resources>()
|
||||
|
||||
/**
|
||||
* 获得 [Configuration] 类型
|
||||
* @return [Class]<[Configuration]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ConfigurationClass get() = classOf<Configuration>()
|
||||
|
||||
/**
|
||||
* 获得 [ConfigurationInfo] 类型
|
||||
* @return [Class]<[ConfigurationInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ConfigurationInfoClass get() = classOf<ConfigurationInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [ContentResolver] 类型
|
||||
* @return [Class]<[ContentResolver]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContentResolverClass get() = classOf<ContentResolver>()
|
||||
|
||||
/**
|
||||
* 获得 [ContentProvider] 类型
|
||||
* @return [Class]<[ContentProvider]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContentProviderClass get() = classOf<ContentProvider>()
|
||||
|
||||
/**
|
||||
* 获得 [Settings] 类型
|
||||
* @return [Class]<[Settings]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SettingsClass get() = classOf<Settings>()
|
||||
|
||||
/**
|
||||
* 获得 [Settings.System] 类型
|
||||
* @return [Class]<[Settings.System]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Settings_SystemClass get() = classOf<Settings.System>()
|
||||
|
||||
/**
|
||||
* 获得 [Settings.Secure] 类型
|
||||
* @return [Class]<[Settings.Secure]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Settings_SecureClass get() = classOf<Settings.Secure>()
|
||||
|
||||
/**
|
||||
* 获得 [TypedArray] 类型
|
||||
* @return [Class]<[TypedArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TypedArrayClass get() = classOf<TypedArray>()
|
||||
|
||||
/**
|
||||
* 获得 [TypedValue] 类型
|
||||
* @return [Class]<[TypedValue]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TypedValueClass get() = classOf<TypedValue>()
|
||||
|
||||
/**
|
||||
* 获得 [SparseArray] 类型
|
||||
* @return [Class]<[SparseArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SparseArrayClass get() = classOf<SparseArray<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [SparseIntArray] 类型
|
||||
* @return [Class]<[SparseIntArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SparseIntArrayClass get() = classOf<SparseIntArray>()
|
||||
|
||||
/**
|
||||
* 获得 [SparseBooleanArray] 类型
|
||||
* @return [Class]<[SparseBooleanArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SparseBooleanArrayClass get() = classOf<SparseBooleanArray>()
|
||||
|
||||
/**
|
||||
* 获得 [SparseLongArray] 类型
|
||||
* @return [Class]<[SparseLongArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SparseLongArrayClass get() = classOf<SparseLongArray>()
|
||||
|
||||
/**
|
||||
* 获得 [LongSparseArray] 类型
|
||||
* @return [Class]<[LongSparseArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LongSparseArrayClass get() = classOf<LongSparseArray<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [ArrayMap] 类型
|
||||
* @return [Class]<[ArrayMap]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ArrayMapClass get() = classOf<ArrayMap<*, *>>()
|
||||
|
||||
/**
|
||||
@@ -348,42 +397,49 @@ val ArrayMapClass get() = classOf<ArrayMap<*, *>>()
|
||||
* - 在 Android M (23) 及以上系统加入
|
||||
* @return [Class]<[ArraySet]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ArraySetClass get() = if (Build.VERSION.SDK_INT >= 23) classOf<ArraySet<*>>() else null
|
||||
|
||||
/**
|
||||
* 获得 [Handler] 类型
|
||||
* @return [Class]<[Handler]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HandlerClass get() = classOf<Handler>()
|
||||
|
||||
/**
|
||||
* 获得 [Handler.Callback] 类型
|
||||
* @return [Class]<[Handler.Callback]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Handler_CallbackClass get() = classOf<Handler.Callback>()
|
||||
|
||||
/**
|
||||
* 获得 [Message] 类型
|
||||
* @return [Class]<[Message]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MessageClass get() = classOf<Message>()
|
||||
|
||||
/**
|
||||
* 获得 [MessageQueue] 类型
|
||||
* @return [Class]<[MessageQueue]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MessageQueueClass get() = classOf<MessageQueue>()
|
||||
|
||||
/**
|
||||
* 获得 [Messenger] 类型
|
||||
* @return [Class]<[Messenger]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MessengerClass get() = classOf<Messenger>()
|
||||
|
||||
/**
|
||||
* 获得 [AsyncTask] 类型
|
||||
* @return [Class]<[AsyncTask]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AsyncTaskClass get() = classOf<AsyncTask<*, *, *>>()
|
||||
|
||||
/**
|
||||
@@ -392,18 +448,21 @@ val AsyncTaskClass get() = classOf<AsyncTask<*, *, *>>()
|
||||
* - 在 Android N (24) 及以上系统加入
|
||||
* @return [Class]<[SimpleDateFormat]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SimpleDateFormatClass_Android get() = if (Build.VERSION.SDK_INT >= 24) classOf<SimpleDateFormat>() else null
|
||||
|
||||
/**
|
||||
* 获得 [Base64] 类型
|
||||
* @return [Class]<[Base64]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Base64Class_Android get() = classOf<Base64>()
|
||||
|
||||
/**
|
||||
* 获得 [Window] 类型
|
||||
* @return [Class]<[Window]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowClass get() = classOf<Window>()
|
||||
|
||||
/**
|
||||
@@ -412,12 +471,14 @@ val WindowClass get() = classOf<Window>()
|
||||
* - 在 Android R (30) 及以上系统加入
|
||||
* @return [Class]<[WindowMetrics]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowMetricsClass get() = if (Build.VERSION.SDK_INT >= 30) classOf<WindowMetrics>() else null
|
||||
|
||||
/**
|
||||
* 获得 [WindowInsets] 类型
|
||||
* @return [Class]<[WindowInsets]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowInsetsClass get() = classOf<WindowInsets>()
|
||||
|
||||
/**
|
||||
@@ -426,216 +487,252 @@ val WindowInsetsClass get() = classOf<WindowInsets>()
|
||||
* - 在 Android R (30) 及以上系统加入
|
||||
* @return [Class]<[WindowInsets.Type]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowInsets_TypeClass get() = if (Build.VERSION.SDK_INT >= 30) classOf<WindowInsets.Type>() else null
|
||||
|
||||
/**
|
||||
* 获得 [WindowManager] 类型
|
||||
* @return [Class]<[WindowManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowManagerClass get() = classOf<WindowManager>()
|
||||
|
||||
/**
|
||||
* 获得 [WindowManager.LayoutParams] 类型
|
||||
* @return [Class]<[WindowManager.LayoutParams]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WindowManager_LayoutParamsClass get() = classOf<WindowManager.LayoutParams>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewManager] 类型
|
||||
* @return [Class]<[ViewManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewManagerClass get() = classOf<ViewManager>()
|
||||
|
||||
/**
|
||||
* 获得 [Parcel] 类型
|
||||
* @return [Class]<[Parcel]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ParcelClass get() = classOf<Parcel>()
|
||||
|
||||
/**
|
||||
* 获得 [Parcelable] 类型
|
||||
* @return [Class]<[Parcelable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ParcelableClass get() = classOf<Parcelable>()
|
||||
|
||||
/**
|
||||
* 获得 [Parcelable.Creator] 类型
|
||||
* @return [Class]<[Parcelable.Creator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Parcelable_CreatorClass get() = classOf<Parcelable.Creator<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Dialog] 类型
|
||||
* @return [Class]<[Dialog]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DialogClass get() = classOf<Dialog>()
|
||||
|
||||
/**
|
||||
* 获得 [AlertDialog] 类型
|
||||
* @return [Class]<[AlertDialog]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AlertDialogClass get() = classOf<AlertDialog>()
|
||||
|
||||
/**
|
||||
* 获得 [DisplayMetrics] 类型
|
||||
* @return [Class]<[DisplayMetrics]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DisplayMetricsClass get() = classOf<DisplayMetrics>()
|
||||
|
||||
/**
|
||||
* 获得 [Display] 类型
|
||||
* @return [Class]<[Display]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DisplayClass get() = classOf<Display>()
|
||||
|
||||
/**
|
||||
* 获得 [Toast] 类型
|
||||
* @return [Class]<[Toast]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ToastClass get() = classOf<Toast>()
|
||||
|
||||
/**
|
||||
* 获得 [Intent] 类型
|
||||
* @return [Class]<[Intent]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntentClass get() = classOf<Intent>()
|
||||
|
||||
/**
|
||||
* 获得 [ComponentInfo] 类型
|
||||
* @return [Class]<[ComponentInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ComponentInfoClass get() = classOf<ComponentInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [ComponentName] 类型
|
||||
* @return [Class]<[ComponentName]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ComponentNameClass get() = classOf<ComponentName>()
|
||||
|
||||
/**
|
||||
* 获得 [PendingIntent] 类型
|
||||
* @return [Class]<[PendingIntent]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PendingIntentClass get() = classOf<PendingIntent>()
|
||||
|
||||
/**
|
||||
* 获得 [ColorStateList] 类型
|
||||
* @return [Class]<[ColorStateList]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ColorStateListClass get() = classOf<ColorStateList>()
|
||||
|
||||
/**
|
||||
* 获得 [ContentValues] 类型
|
||||
* @return [Class]<[ContentValues]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContentValuesClass get() = classOf<ContentValues>()
|
||||
|
||||
/**
|
||||
* 获得 [SharedPreferences] 类型
|
||||
* @return [Class]<[SharedPreferences]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SharedPreferencesClass get() = classOf<SharedPreferences>()
|
||||
|
||||
/**
|
||||
* 获得 [MediaPlayer] 类型
|
||||
* @return [Class]<[MediaPlayer]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MediaPlayerClass get() = classOf<MediaPlayer>()
|
||||
|
||||
/**
|
||||
* 获得 [ProgressDialog] 类型
|
||||
* @return [Class]<[ProgressDialog]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ProgressDialogClass get() = classOf<ProgressDialog>()
|
||||
|
||||
/**
|
||||
* 获得 [Log] 类型
|
||||
* @return [Class]<[Log]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LogClass get() = classOf<Log>()
|
||||
|
||||
/**
|
||||
* 获得 [Build] 类型
|
||||
* @return [Class]<[Build]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BuildClass get() = classOf<Build>()
|
||||
|
||||
/**
|
||||
* 获得 [Xml] 类型
|
||||
* @return [Class]<[Xml]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val XmlClass get() = classOf<Xml>()
|
||||
|
||||
/**
|
||||
* 获得 [ContrastColorUtil] 类型
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ContrastColorUtilClass get() = "com.android.internal.util.ContrastColorUtil".toClass()
|
||||
|
||||
/**
|
||||
* 获得 [StatusBarNotification] 类型
|
||||
* @return [Class]<[StatusBarNotification]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StatusBarNotificationClass get() = classOf<StatusBarNotification>()
|
||||
|
||||
/**
|
||||
* 获得 [Notification] 类型
|
||||
* @return [Class]<[Notification]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NotificationClass get() = classOf<Notification>()
|
||||
|
||||
/**
|
||||
* 获得 [Notification.Builder] 类型
|
||||
* @return [Class]<[Notification.Builder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Notification_BuilderClass get() = classOf<Notification.Builder>()
|
||||
|
||||
/**
|
||||
* 获得 [Notification.Action] 类型
|
||||
* @return [Class]<[Notification.Action]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Notification_ActionClass get() = classOf<Notification.Action>()
|
||||
|
||||
/**
|
||||
* 获得 [DialogInterface] 类型
|
||||
* @return [Class]<[DialogInterface]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DialogInterfaceClass get() = classOf<DialogInterface>()
|
||||
|
||||
/**
|
||||
* 获得 [DialogInterface.OnClickListener] 类型
|
||||
* @return [Class]<[DialogInterface.OnClickListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DialogInterface_OnClickListenerClass get() = classOf<DialogInterface.OnClickListener>()
|
||||
|
||||
/**
|
||||
* 获得 [DialogInterface.OnCancelListener] 类型
|
||||
* @return [Class]<[DialogInterface.OnCancelListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DialogInterface_OnCancelListenerClass get() = classOf<DialogInterface.OnCancelListener>()
|
||||
|
||||
/**
|
||||
* 获得 [DialogInterface.OnDismissListener] 类型
|
||||
* @return [Class]<[DialogInterface.OnDismissListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DialogInterface_OnDismissListenerClass get() = classOf<DialogInterface.OnDismissListener>()
|
||||
|
||||
/**
|
||||
* 获得 [Environment] 类型
|
||||
* @return [Class]<[Environment]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val EnvironmentClass get() = classOf<Environment>()
|
||||
|
||||
/**
|
||||
* 获得 [Process] 类型
|
||||
* @return [Class]<[Process]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ProcessClass get() = classOf<Process>()
|
||||
|
||||
/**
|
||||
* 获得 [Vibrator] 类型
|
||||
* @return [Class]<[Vibrator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VibratorClass get() = classOf<Vibrator>()
|
||||
|
||||
/**
|
||||
@@ -644,6 +741,7 @@ val VibratorClass get() = classOf<Vibrator>()
|
||||
* - 在 Android O (26) 及以上系统加入
|
||||
* @return [Class]<[VibrationEffect]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VibrationEffectClass get() = if (Build.VERSION.SDK_INT >= 26) classOf<VibrationEffect>() else null
|
||||
|
||||
/**
|
||||
@@ -652,30 +750,35 @@ val VibrationEffectClass get() = if (Build.VERSION.SDK_INT >= 26) classOf<Vibrat
|
||||
* - 在 Android R (30) 及以上系统加入
|
||||
* @return [Class]<[VibrationAttributes]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VibrationAttributesClass get() = if (Build.VERSION.SDK_INT >= 30) classOf<VibrationAttributes>() else null
|
||||
|
||||
/**
|
||||
* 获得 [SystemClock] 类型
|
||||
* @return [Class]<[SystemClock]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SystemClockClass get() = classOf<SystemClock>()
|
||||
|
||||
/**
|
||||
* 获得 [PowerManager] 类型
|
||||
* @return [Class]<[PowerManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PowerManagerClass get() = classOf<PowerManager>()
|
||||
|
||||
/**
|
||||
* 获得 [PowerManager.WakeLock] 类型
|
||||
* @return [Class]<[PowerManager.WakeLock]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PowerManager_WakeLockClass get() = classOf<PowerManager.WakeLock>()
|
||||
|
||||
/**
|
||||
* 获得 [UserHandle] 类型
|
||||
* @return [Class]<[UserHandle]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val UserHandleClass get() = classOf<UserHandle>()
|
||||
|
||||
/**
|
||||
@@ -684,6 +787,7 @@ val UserHandleClass get() = classOf<UserHandle>()
|
||||
* - 在 Android N_MR1 (25) 及以上系统加入
|
||||
* @return [Class]<[ShortcutInfo]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortcutInfoClass get() = if (Build.VERSION.SDK_INT >= 25) classOf<ShortcutInfo>() else null
|
||||
|
||||
/**
|
||||
@@ -692,6 +796,7 @@ val ShortcutInfoClass get() = if (Build.VERSION.SDK_INT >= 25) classOf<ShortcutI
|
||||
* - 在 Android R (30) 及以上系统加入
|
||||
* @return [Class]<[ShortcutManager]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortcutManagerClass get() = if (Build.VERSION.SDK_INT >= 30) classOf<ShortcutManager>() else null
|
||||
|
||||
/**
|
||||
@@ -700,118 +805,138 @@ val ShortcutManagerClass get() = if (Build.VERSION.SDK_INT >= 30) classOf<Shortc
|
||||
* - 在 Android N_MR1 (25) 及以上系统加入
|
||||
* @return [Class]<[ShortcutQuery]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortcutQueryClass get() = if (Build.VERSION.SDK_INT >= 25) classOf<ShortcutQuery>() else null
|
||||
|
||||
/**
|
||||
* 获得 [KeyboardShortcutInfo] 类型
|
||||
* @return [Class]<[KeyboardShortcutInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val KeyboardShortcutInfoClass get() = classOf<KeyboardShortcutInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [KeyboardShortcutGroup] 类型
|
||||
* @return [Class]<[KeyboardShortcutGroup]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val KeyboardShortcutGroupClass get() = classOf<KeyboardShortcutGroup>()
|
||||
|
||||
/**
|
||||
* 获得 [ShortcutIconResource] 类型
|
||||
* @return [Class]<[ShortcutIconResource]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortcutIconResourceClass get() = classOf<ShortcutIconResource>()
|
||||
|
||||
/**
|
||||
* 获得 [AssetManager] 类型
|
||||
* @return [Class]<[AssetManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AssetManagerClass get() = classOf<AssetManager>()
|
||||
|
||||
/**
|
||||
* 获得 [AppWidgetManager] 类型
|
||||
* @return [Class]<[AppWidgetManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AppWidgetManagerClass get() = classOf<AppWidgetManager>()
|
||||
|
||||
/**
|
||||
* 获得 [AppWidgetProvider] 类型
|
||||
* @return [Class]<[AppWidgetProvider]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AppWidgetProviderClass get() = classOf<AppWidgetProvider>()
|
||||
|
||||
/**
|
||||
* 获得 [AppWidgetProviderInfo] 类型
|
||||
* @return [Class]<[AppWidgetProviderInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AppWidgetProviderInfoClass get() = classOf<AppWidgetProviderInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [AppWidgetHost] 类型
|
||||
* @return [Class]<[AppWidgetHost]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AppWidgetHostClass get() = classOf<AppWidgetHost>()
|
||||
|
||||
/**
|
||||
* 获得 [ActivityInfo] 类型
|
||||
* @return [Class]<[ActivityInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ActivityInfoClass get() = classOf<ActivityInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [ResolveInfo] 类型
|
||||
* @return [Class]<[ResolveInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ResolveInfoClass get() = classOf<ResolveInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [Property] 类型
|
||||
* @return [Class]<[Property]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PropertyClass get() = classOf<Property<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [IntProperty] 类型
|
||||
* @return [Class]<[IntProperty]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntPropertyClass get() = classOf<IntProperty<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [FloatProperty] 类型
|
||||
* @return [Class]<[FloatProperty]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FloatPropertyClass get() = classOf<FloatProperty<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [SQLiteDatabase] 类型
|
||||
* @return [Class]<[SQLiteDatabase]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SQLiteDatabaseClass get() = classOf<SQLiteDatabase>()
|
||||
|
||||
/**
|
||||
* 获得 [StrictMode] 类型
|
||||
* @return [Class]<[StrictMode]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StrictModeClass get() = classOf<StrictMode>()
|
||||
|
||||
/**
|
||||
* 获得 [AccessibilityManager] 类型
|
||||
* @return [Class]<[AccessibilityManager]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AccessibilityManagerClass get() = classOf<AccessibilityManager>()
|
||||
|
||||
/**
|
||||
* 获得 [AccessibilityEvent] 类型
|
||||
* @return [Class]<[AccessibilityEvent]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AccessibilityEventClass get() = classOf<AccessibilityEvent>()
|
||||
|
||||
/**
|
||||
* 获得 [AccessibilityNodeInfo] 类型
|
||||
* @return [Class]<[AccessibilityNodeInfo]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AccessibilityNodeInfoClass get() = classOf<AccessibilityNodeInfo>()
|
||||
|
||||
/**
|
||||
* 获得 [IInterface] 类型
|
||||
* @return [Class]<[IInterface]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IInterfaceClass get() = classOf<IInterface>()
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/13.
|
||||
*/
|
||||
@file:Suppress("unused", "KDocUnresolvedReference")
|
||||
@file:Suppress("unused", "KDocUnresolvedReference", "DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.type.android
|
||||
|
||||
@@ -52,18 +52,21 @@ import android.text.TextUtils
|
||||
import android.text.TextWatcher
|
||||
import android.util.Size
|
||||
import android.util.SizeF
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
|
||||
/**
|
||||
* 获得 [Typeface] 类型
|
||||
* @return [Class]<[Typeface]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TypefaceClass get() = classOf<Typeface>()
|
||||
|
||||
/**
|
||||
* 获得 [Bitmap] 类型
|
||||
* @return [Class]<[Bitmap]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BitmapClass get() = classOf<Bitmap>()
|
||||
|
||||
/**
|
||||
@@ -72,166 +75,194 @@ val BitmapClass get() = classOf<Bitmap>()
|
||||
* - 在 Android M (23) 及以上系统加入
|
||||
* @return [Class]<[Icon]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IconClass get() = if (Build.VERSION.SDK_INT >= 23) classOf<Icon>() else null
|
||||
|
||||
/**
|
||||
* 获得 [Outline] 类型
|
||||
* @return [Class]<[Outline]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OutlineClass get() = classOf<Outline>()
|
||||
|
||||
/**
|
||||
* 获得 [Drawable] 类型
|
||||
* @return [Class]<[Drawable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DrawableClass get() = classOf<Drawable>()
|
||||
|
||||
/**
|
||||
* 获得 [GradientDrawable] 类型
|
||||
* @return [Class]<[GradientDrawable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val GradientDrawableClass get() = classOf<GradientDrawable>()
|
||||
|
||||
/**
|
||||
* 获得 [ColorDrawable] 类型
|
||||
* @return [Class]<[ColorDrawable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ColorDrawableClass get() = classOf<ColorDrawable>()
|
||||
|
||||
/**
|
||||
* 获得 [BitmapDrawable] 类型
|
||||
* @return [Class]<[BitmapDrawable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BitmapDrawableClass get() = classOf<BitmapDrawable>()
|
||||
|
||||
/**
|
||||
* 获得 [Size] 类型
|
||||
* @return [Class]<[Size]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SizeClass get() = classOf<Size>()
|
||||
|
||||
/**
|
||||
* 获得 [SizeF] 类型
|
||||
* @return [Class]<[SizeF]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SizeFClass get() = classOf<SizeF>()
|
||||
|
||||
/**
|
||||
* 获得 [Rect] 类型
|
||||
* @return [Class]<[Rect]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RectClass get() = classOf<Rect>()
|
||||
|
||||
/**
|
||||
* 获得 [RectF] 类型
|
||||
* @return [Class]<[RectF]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RectFClass get() = classOf<RectF>()
|
||||
|
||||
/**
|
||||
* 获得 [NinePatch] 类型
|
||||
* @return [Class]<[NinePatch]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NinePatchClass get() = classOf<NinePatch>()
|
||||
|
||||
/**
|
||||
* 获得 [Paint] 类型
|
||||
* @return [Class]<[Paint]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PaintClass get() = classOf<Paint>()
|
||||
|
||||
/**
|
||||
* 获得 [TextPaint] 类型
|
||||
* @return [Class]<[TextPaint]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextPaintClass get() = classOf<TextPaint>()
|
||||
|
||||
/**
|
||||
* 获得 [Canvas] 类型
|
||||
* @return [Class]<[Canvas]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CanvasClass get() = classOf<Canvas>()
|
||||
|
||||
/**
|
||||
* 获得 [Point] 类型
|
||||
* @return [Class]<[Point]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PointClass get() = classOf<Point>()
|
||||
|
||||
/**
|
||||
* 获得 [PointF] 类型
|
||||
* @return [Class]<[PointF]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PointFClass get() = classOf<PointF>()
|
||||
|
||||
/**
|
||||
* 获得 [Matrix] 类型
|
||||
* @return [Class]<[Matrix]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MatrixClass get() = classOf<Matrix>()
|
||||
|
||||
/**
|
||||
* 获得 [ColorMatrix] 类型
|
||||
* @return [Class]<[ColorMatrix]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ColorMatrixClass get() = classOf<ColorMatrix>()
|
||||
|
||||
/**
|
||||
* 获得 [ColorMatrixColorFilter] 类型
|
||||
* @return [Class]<[ColorMatrixColorFilter]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ColorMatrixColorFilterClass get() = classOf<ColorMatrixColorFilter>()
|
||||
|
||||
/**
|
||||
* 获得 [TextUtils] 类型
|
||||
* @return [Class]<[TextUtils]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextUtilsClass get() = classOf<TextUtils>()
|
||||
|
||||
/**
|
||||
* 获得 [Editable] 类型
|
||||
* @return [Class]<[Editable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val EditableClass get() = classOf<Editable>()
|
||||
|
||||
/**
|
||||
* 获得 [TextWatcher] 类型
|
||||
* @return [Class]<[TextWatcher]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextWatcherClass get() = classOf<TextWatcher>()
|
||||
|
||||
/**
|
||||
* 获得 [Editable.Factory] 类型
|
||||
* @return [Class]<[Editable.Factory]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Editable_FactoryClass get() = classOf<Editable.Factory>()
|
||||
|
||||
/**
|
||||
* 获得 [GetChars] 类型
|
||||
* @return [Class]<[GetChars]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val GetCharsClass get() = classOf<GetChars>()
|
||||
|
||||
/**
|
||||
* 获得 [Spannable] 类型
|
||||
* @return [Class]<[Spannable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SpannableClass get() = classOf<Spannable>()
|
||||
|
||||
/**
|
||||
* 获得 [SpannableStringBuilder] 类型
|
||||
* @return [Class]<[SpannableStringBuilder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SpannableStringBuilderClass get() = classOf<SpannableStringBuilder>()
|
||||
|
||||
/**
|
||||
* 获得 [BitmapFactory] 类型
|
||||
* @return [Class]<[BitmapFactory]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BitmapFactoryClass get() = classOf<BitmapFactory>()
|
||||
|
||||
/**
|
||||
* 获得 [BitmapFactory.Options] 类型
|
||||
* @return [Class]<[BitmapFactory.Options]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BitmapFactory_OptionsClass get() = classOf<BitmapFactory.Options>()
|
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/2.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused", "DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.type.android
|
||||
|
||||
@@ -68,376 +68,439 @@ import android.widget.TextClock
|
||||
import android.widget.TextView
|
||||
import android.widget.VideoView
|
||||
import android.widget.ViewAnimator
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
|
||||
/**
|
||||
* 获得 [View] 类型
|
||||
* @return [Class]<[View]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewClass get() = classOf<View>()
|
||||
|
||||
/**
|
||||
* 获得 [Surface] 类型
|
||||
* @return [Class]<[Surface]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SurfaceClass get() = classOf<Surface>()
|
||||
|
||||
/**
|
||||
* 获得 [SurfaceView] 类型
|
||||
* @return [Class]<[SurfaceView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SurfaceViewClass get() = classOf<SurfaceView>()
|
||||
|
||||
/**
|
||||
* 获得 [TextureView] 类型
|
||||
* @return [Class]<[TextureView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextureViewClass get() = classOf<TextureView>()
|
||||
|
||||
/**
|
||||
* 获得 [WebView] 类型
|
||||
* @return [Class]<[WebView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WebViewClass get() = classOf<WebView>()
|
||||
|
||||
/**
|
||||
* 获得 [WebViewClient] 类型
|
||||
* @return [Class]<[WebViewClient]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WebViewClientClass get() = classOf<WebViewClient>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewStructure] 类型
|
||||
* @return [Class]<[ViewStructure]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewStructureClass get() = classOf<ViewStructure>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewGroup] 类型
|
||||
* @return [Class]<[ViewGroup]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewGroupClass get() = classOf<ViewGroup>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewParent] 类型
|
||||
* @return [Class]<[ViewParent]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewParentClass get() = classOf<ViewParent>()
|
||||
|
||||
/**
|
||||
* 获得 [AppWidgetHostView] 类型
|
||||
* @return [Class]<[AppWidgetHostView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AppWidgetHostViewClass get() = classOf<AppWidgetHostView>()
|
||||
|
||||
/**
|
||||
* 获得 [RemoteViews] 类型
|
||||
* @return [Class]<[RemoteViews]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RemoteViewsClass get() = classOf<RemoteViews>()
|
||||
|
||||
/**
|
||||
* 获得 [RemoteView] 类型
|
||||
* @return [Class]<[RemoteView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RemoteViewClass get() = classOf<RemoteView>()
|
||||
|
||||
/**
|
||||
* 获得 [TextView] 类型
|
||||
* @return [Class]<[TextView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextViewClass get() = classOf<TextView>()
|
||||
|
||||
/**
|
||||
* 获得 [ImageView] 类型
|
||||
* @return [Class]<[ImageView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ImageViewClass get() = classOf<ImageView>()
|
||||
|
||||
/**
|
||||
* 获得 [ImageButton] 类型
|
||||
* @return [Class]<[ImageButton]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ImageButtonClass get() = classOf<ImageButton>()
|
||||
|
||||
/**
|
||||
* 获得 [EditText] 类型
|
||||
* @return [Class]<[EditText]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val EditTextClass get() = classOf<EditText>()
|
||||
|
||||
/**
|
||||
* 获得 [Button] 类型
|
||||
* @return [Class]<[Button]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ButtonClass get() = classOf<Button>()
|
||||
|
||||
/**
|
||||
* 获得 [CheckBox] 类型
|
||||
* @return [Class]<[CheckBox]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CheckBoxClass get() = classOf<CheckBox>()
|
||||
|
||||
/**
|
||||
* 获得 [CompoundButton] 类型
|
||||
* @return [Class]<[CompoundButton]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CompoundButtonClass get() = classOf<CompoundButton>()
|
||||
|
||||
/**
|
||||
* 获得 [VideoView] 类型
|
||||
* @return [Class]<[VideoView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VideoViewClass get() = classOf<VideoView>()
|
||||
|
||||
/**
|
||||
* 获得 [ListView] 类型
|
||||
* @return [Class]<[ListView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ListViewClass get() = classOf<ListView>()
|
||||
|
||||
/**
|
||||
* 获得 [LayoutInflater] 类型
|
||||
* @return [Class]<[LayoutInflater]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LayoutInflaterClass get() = classOf<LayoutInflater>()
|
||||
|
||||
/**
|
||||
* 获得 [LayoutInflater.Filter] 类型
|
||||
* @return [Class]<[LayoutInflater.Filter]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LayoutInflater_FilterClass get() = classOf<LayoutInflater.Filter>()
|
||||
|
||||
/**
|
||||
* 获得 [LayoutInflater.Factory] 类型
|
||||
* @return [Class]<[LayoutInflater.Factory]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LayoutInflater_FactoryClass get() = classOf<LayoutInflater.Factory>()
|
||||
|
||||
/**
|
||||
* 获得 [LayoutInflater.Factory2] 类型
|
||||
* @return [Class]<[LayoutInflater.Factory2]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LayoutInflater_Factory2Class get() = classOf<LayoutInflater.Factory2>()
|
||||
|
||||
/**
|
||||
* 获得 [ListAdapter] 类型
|
||||
* @return [Class]<[ListAdapter]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ListAdapterClass get() = classOf<ListAdapter>()
|
||||
|
||||
/**
|
||||
* 获得 [ArrayAdapter] 类型
|
||||
* @return [Class]<[ArrayAdapter]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ArrayAdapterClass get() = classOf<ArrayAdapter<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [BaseAdapter] 类型
|
||||
* @return [Class]<[BaseAdapter]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BaseAdapterClass get() = classOf<BaseAdapter>()
|
||||
|
||||
/**
|
||||
* 获得 [RelativeLayout] 类型
|
||||
* @return [Class]<[RelativeLayout]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RelativeLayoutClass get() = classOf<RelativeLayout>()
|
||||
|
||||
/**
|
||||
* 获得 [FrameLayout] 类型
|
||||
* @return [Class]<[FrameLayout]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FrameLayoutClass get() = classOf<FrameLayout>()
|
||||
|
||||
/**
|
||||
* 获得 [LinearLayout] 类型
|
||||
* @return [Class]<[LinearLayout]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LinearLayoutClass get() = classOf<LinearLayout>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewGroup.LayoutParams] 类型
|
||||
* @return [Class]<[ViewGroup.LayoutParams]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewGroup_LayoutParamsClass get() = classOf<ViewGroup.LayoutParams>()
|
||||
|
||||
/**
|
||||
* 获得 [RelativeLayout.LayoutParams] 类型
|
||||
* @return [Class]<[RelativeLayout.LayoutParams]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RelativeLayout_LayoutParamsClass get() = classOf<RelativeLayout.LayoutParams>()
|
||||
|
||||
/**
|
||||
* 获得 [LinearLayout.LayoutParams] 类型
|
||||
* @return [Class]<[LinearLayout.LayoutParams]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LinearLayout_LayoutParamsClass get() = classOf<LinearLayout.LayoutParams>()
|
||||
|
||||
/**
|
||||
* 获得 [FrameLayout.LayoutParams] 类型
|
||||
* @return [Class]<[FrameLayout.LayoutParams]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FrameLayout_LayoutParamsClass get() = classOf<FrameLayout.LayoutParams>()
|
||||
|
||||
/**
|
||||
* 获得 [TextClock] 类型
|
||||
* @return [Class]<[TextClock]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TextClockClass get() = classOf<TextClock>()
|
||||
|
||||
/**
|
||||
* 获得 [MotionEvent] 类型
|
||||
* @return [Class]<[MotionEvent]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MotionEventClass get() = classOf<MotionEvent>()
|
||||
|
||||
/**
|
||||
* 获得 [View.OnClickListener] 类型
|
||||
* @return [Class]<[View.OnClickListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val View_OnClickListenerClass get() = classOf<View.OnClickListener>()
|
||||
|
||||
/**
|
||||
* 获得 [View.OnLongClickListener] 类型
|
||||
* @return [Class]<[View.OnLongClickListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val View_OnLongClickListenerClass get() = classOf<View.OnLongClickListener>()
|
||||
|
||||
/**
|
||||
* 获得 [View.OnTouchListener] 类型
|
||||
* @return [Class]<[View.OnTouchListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val View_OnTouchListenerClass get() = classOf<View.OnTouchListener>()
|
||||
|
||||
/**
|
||||
* 获得 [AutoCompleteTextView] 类型
|
||||
* @return [Class]<[AutoCompleteTextView]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AutoCompleteTextViewClass get() = classOf<AutoCompleteTextView>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewStub] 类型
|
||||
* @return [Class]<[ViewStub]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewStubClass get() = classOf<ViewStub>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewStub.OnInflateListener] 类型
|
||||
* @return [Class]<[ViewStub.OnInflateListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewStub_OnInflateListenerClass get() = classOf<ViewStub.OnInflateListener>()
|
||||
|
||||
/**
|
||||
* 获得 [GestureDetector] 类型
|
||||
* @return [Class]<[GestureDetector]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val GestureDetectorClass get() = classOf<GestureDetector>()
|
||||
|
||||
/**
|
||||
* 获得 [GestureDetector.SimpleOnGestureListener] 类型
|
||||
* @return [Class]<[GestureDetector.SimpleOnGestureListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val GestureDetector_SimpleOnGestureListenerClass get() = classOf<GestureDetector.SimpleOnGestureListener>()
|
||||
|
||||
/**
|
||||
* 获得 [ProgressBar] 类型
|
||||
* @return [Class]<[ProgressBar]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ProgressBarClass get() = classOf<ProgressBar>()
|
||||
|
||||
/**
|
||||
* 获得 [AttributeSet] 类型
|
||||
* @return [Class]<[AttributeSet]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AttributeSetClass get() = classOf<AttributeSet>()
|
||||
|
||||
/**
|
||||
* 获得 [Animation] 类型
|
||||
* @return [Class]<[Animation]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnimationClass get() = classOf<Animation>()
|
||||
|
||||
/**
|
||||
* 获得 [Animation.AnimationListener] 类型
|
||||
* @return [Class]<[Animation.AnimationListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Animation_AnimationListenerClass get() = classOf<Animation.AnimationListener>()
|
||||
|
||||
/**
|
||||
* 获得 [TranslateAnimation] 类型
|
||||
* @return [Class]<[TranslateAnimation]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TranslateAnimationClass get() = classOf<TranslateAnimation>()
|
||||
|
||||
/**
|
||||
* 获得 [AlphaAnimation] 类型
|
||||
* @return [Class]<[AlphaAnimation]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AlphaAnimationClass get() = classOf<AlphaAnimation>()
|
||||
|
||||
/**
|
||||
* 获得 [Animator] 类型
|
||||
* @return [Class]<[Animator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnimatorClass get() = classOf<Animator>()
|
||||
|
||||
/**
|
||||
* 获得 [Animator.AnimatorListener] 类型
|
||||
* @return [Class]<[Animator.AnimatorListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Animator_AnimatorListenerClass get() = classOf<Animator.AnimatorListener>()
|
||||
|
||||
/**
|
||||
* 获得 [ObjectAnimator] 类型
|
||||
* @return [Class]<[ObjectAnimator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ObjectAnimatorClass get() = classOf<ObjectAnimator>()
|
||||
|
||||
/**
|
||||
* 获得 [ValueAnimator] 类型
|
||||
* @return [Class]<[ValueAnimator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ValueAnimatorClass get() = classOf<ValueAnimator>()
|
||||
|
||||
/**
|
||||
* 获得 [ValueAnimator.AnimatorUpdateListener] 类型
|
||||
* @return [Class]<[ValueAnimator.AnimatorUpdateListener]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ValueAnimator_AnimatorUpdateListenerClass get() = classOf<ValueAnimator.AnimatorUpdateListener>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewAnimator] 类型
|
||||
* @return [Class]<[ViewAnimator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewAnimatorClass get() = classOf<ViewAnimator>()
|
||||
|
||||
/**
|
||||
* 获得 [AnimatorSet] 类型
|
||||
* @return [Class]<[AnimatorSet]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnimatorSetClass get() = classOf<AnimatorSet>()
|
||||
|
||||
/**
|
||||
* 获得 [AnimatorSet.Builder] 类型
|
||||
* @return [Class]<[AnimatorSet.Builder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnimatorSet_BuilderClass get() = classOf<AnimatorSet.Builder>()
|
||||
|
||||
/**
|
||||
* 获得 [PropertyValuesHolder] 类型
|
||||
* @return [Class]<[PropertyValuesHolder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val PropertyValuesHolderClass get() = classOf<PropertyValuesHolder>()
|
||||
|
||||
/**
|
||||
* 获得 [ViewPropertyAnimator] 类型
|
||||
* @return [Class]<[ViewPropertyAnimator]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ViewPropertyAnimatorClass get() = classOf<ViewPropertyAnimator>()
|
||||
|
||||
/**
|
||||
* 获得 [View.MeasureSpec] 类型
|
||||
* @return [Class]<[View.MeasureSpec]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val View_MeasureSpecClass get() = classOf<View.MeasureSpec>()
|
@@ -19,8 +19,11 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/4/3.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package com.highcapable.yukihookapi.hook.type.defined
|
||||
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
|
||||
/**
|
||||
@@ -28,6 +31,7 @@ import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
*
|
||||
* 请使用 [UndefinedType] 来调用它
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal class UndefinedClass private constructor()
|
||||
|
||||
/**
|
||||
@@ -35,16 +39,19 @@ internal class UndefinedClass private constructor()
|
||||
*
|
||||
* 请使用 [VagueType] 来调用它
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
class VagueClass private constructor()
|
||||
|
||||
/**
|
||||
* 得到未定义类型
|
||||
* @return [Class]<[UndefinedClass]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
internal val UndefinedType get() = classOf<UndefinedClass>()
|
||||
|
||||
/**
|
||||
* 得到模糊类型
|
||||
* @return [Class]<[VagueClass]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VagueType get() = classOf<VagueClass>()
|
@@ -19,11 +19,15 @@
|
||||
*
|
||||
* This file is created by fankes on 2022/2/2.
|
||||
*/
|
||||
@file:Suppress("unused", "KDocUnresolvedReference", "DEPRECATION", "FunctionName", "UNCHECKED_CAST")
|
||||
@file:Suppress(
|
||||
"DEPRECATION", "FunctionName", "KDocUnresolvedReference", "UNCHECKED_CAST", "ktlint:standard:no-wildcard-imports", "unused",
|
||||
"DeprecatedCallableAddReplaceWith"
|
||||
)
|
||||
|
||||
package com.highcapable.yukihookapi.hook.type.java
|
||||
|
||||
import android.os.Build
|
||||
import com.highcapable.yukihookapi.hook.core.finder.ReflectionMigration
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
@@ -33,7 +37,7 @@ import dalvik.system.InMemoryDexClassLoader
|
||||
import dalvik.system.PathClassLoader
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.* // ktlint-disable no-wildcard-imports
|
||||
import java.io.*
|
||||
import java.lang.ref.Reference
|
||||
import java.lang.ref.WeakReference
|
||||
import java.lang.reflect.Constructor
|
||||
@@ -60,6 +64,7 @@ import java.util.function.Function as JavaFunction
|
||||
* @param type 类型
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
fun ArrayClass(type: Class<*>) = JavaArray.newInstance(type, 0).javaClass as Class<JavaArray>
|
||||
|
||||
/**
|
||||
@@ -79,6 +84,7 @@ val AnyType get() = AnyClass
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "boolean"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BooleanType get() = Boolean::class.javaPrimitiveType ?: "boolean".toClass()
|
||||
|
||||
/**
|
||||
@@ -87,6 +93,7 @@ val BooleanType get() = Boolean::class.javaPrimitiveType ?: "boolean".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "char"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharType get() = Char::class.javaPrimitiveType ?: "char".toClass()
|
||||
|
||||
/**
|
||||
@@ -95,6 +102,7 @@ val CharType get() = Char::class.javaPrimitiveType ?: "char".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "byte"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ByteType get() = Byte::class.javaPrimitiveType ?: "byte".toClass()
|
||||
|
||||
/**
|
||||
@@ -103,6 +111,7 @@ val ByteType get() = Byte::class.javaPrimitiveType ?: "byte".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "short"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortType get() = Short::class.javaPrimitiveType ?: "short".toClass()
|
||||
|
||||
/**
|
||||
@@ -111,6 +120,7 @@ val ShortType get() = Short::class.javaPrimitiveType ?: "short".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "int"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntType get() = Int::class.javaPrimitiveType ?: "int".toClass()
|
||||
|
||||
/**
|
||||
@@ -119,6 +129,7 @@ val IntType get() = Int::class.javaPrimitiveType ?: "int".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "float"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FloatType get() = Float::class.javaPrimitiveType ?: "float".toClass()
|
||||
|
||||
/**
|
||||
@@ -127,6 +138,7 @@ val FloatType get() = Float::class.javaPrimitiveType ?: "float".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "long"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LongType get() = Long::class.javaPrimitiveType ?: "long".toClass()
|
||||
|
||||
/**
|
||||
@@ -135,6 +147,7 @@ val LongType get() = Long::class.javaPrimitiveType ?: "long".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "double"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DoubleType get() = Double::class.javaPrimitiveType ?: "double".toClass()
|
||||
|
||||
/**
|
||||
@@ -143,6 +156,7 @@ val DoubleType get() = Double::class.javaPrimitiveType ?: "double".toClass()
|
||||
* 这是 Java 原始类型 (Primitive Type) - 它在字节码中的关键字为 "void"
|
||||
* @return [Class]
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val UnitType get() = Void.TYPE ?: "void".toClass()
|
||||
|
||||
/**
|
||||
@@ -151,6 +165,7 @@ val UnitType get() = Void.TYPE ?: "void".toClass()
|
||||
* 它等价于 Java 中的 [java.lang.Object]
|
||||
* @return [Class]<[Any]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnyClass get() = classOf<Any>()
|
||||
|
||||
/**
|
||||
@@ -159,6 +174,7 @@ val AnyClass get() = classOf<Any>()
|
||||
* 它等价于 Java 中的 [java.lang.Boolean]
|
||||
* @return [Class]<[Boolean]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BooleanClass get() = classOf<Boolean>()
|
||||
|
||||
/**
|
||||
@@ -167,6 +183,7 @@ val BooleanClass get() = classOf<Boolean>()
|
||||
* 它等价于 Java 中的 [java.lang.Character]
|
||||
* @return [Class]<[Char]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharClass get() = classOf<Char>()
|
||||
|
||||
/**
|
||||
@@ -175,6 +192,7 @@ val CharClass get() = classOf<Char>()
|
||||
* 它等价于 Java 中的 [java.lang.Byte]
|
||||
* @return [Class]<[Byte]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ByteClass get() = classOf<Byte>()
|
||||
|
||||
/**
|
||||
@@ -183,6 +201,7 @@ val ByteClass get() = classOf<Byte>()
|
||||
* 它等价于 Java 中的 [java.lang.Short]
|
||||
* @return [Class]<[Short]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortClass get() = classOf<Short>()
|
||||
|
||||
/**
|
||||
@@ -191,6 +210,7 @@ val ShortClass get() = classOf<Short>()
|
||||
* 它等价于 Java 中的 [java.lang.Integer]
|
||||
* @return [Class]<[Int]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntClass get() = classOf<Int>()
|
||||
|
||||
/**
|
||||
@@ -199,6 +219,7 @@ val IntClass get() = classOf<Int>()
|
||||
* 它等价于 Java 中的 [java.lang.Float]
|
||||
* @return [Class]<[Float]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FloatClass get() = classOf<Float>()
|
||||
|
||||
/**
|
||||
@@ -207,6 +228,7 @@ val FloatClass get() = classOf<Float>()
|
||||
* 它等价于 Java 中的 [java.lang.Long]
|
||||
* @return [Class]<[Long]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LongClass get() = classOf<Long>()
|
||||
|
||||
/**
|
||||
@@ -215,6 +237,7 @@ val LongClass get() = classOf<Long>()
|
||||
* 它等价于 Java 中的 [java.lang.Double]
|
||||
* @return [Class]<[Double]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DoubleClass get() = classOf<Double>()
|
||||
|
||||
/**
|
||||
@@ -223,6 +246,7 @@ val DoubleClass get() = classOf<Double>()
|
||||
* 它等价于 Java 中的 [java.lang.Number]
|
||||
* @return [Class]<[Number]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NumberClass get() = classOf<Number>()
|
||||
|
||||
/**
|
||||
@@ -231,6 +255,7 @@ val NumberClass get() = classOf<Number>()
|
||||
* 它等价于 Java 中的 [java.lang.Void]
|
||||
* @return [Class]<[Void]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val UnitClass get() = classOf<Void>()
|
||||
|
||||
/**
|
||||
@@ -261,6 +286,7 @@ val CharSequenceType get() = CharSequenceClass
|
||||
* 它等价于 Java 中的 [java.lang.String]
|
||||
* @return [Class]<[String]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StringClass get() = classOf<String>()
|
||||
|
||||
/**
|
||||
@@ -269,12 +295,14 @@ val StringClass get() = classOf<String>()
|
||||
* 它等价于 Java 中的 [java.lang.CharSequence]
|
||||
* @return [Class]<[CharSequence]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharSequenceClass get() = classOf<CharSequence>()
|
||||
|
||||
/**
|
||||
* 获得 [Serializable] 类型
|
||||
* @return [Class]<[Serializable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SerializableClass get() = classOf<Serializable>()
|
||||
|
||||
/**
|
||||
@@ -283,6 +311,7 @@ val SerializableClass get() = classOf<Serializable>()
|
||||
* 它等价于 Java 中的 [java.lang.reflect.Array]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ArrayClass get() = classOf<JavaArray>()
|
||||
|
||||
/**
|
||||
@@ -291,6 +320,7 @@ val ArrayClass get() = classOf<JavaArray>()
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "boolean[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BooleanArrayType get() = ArrayClass(BooleanType)
|
||||
|
||||
/**
|
||||
@@ -299,6 +329,7 @@ val BooleanArrayType get() = ArrayClass(BooleanType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "char[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharArrayType get() = ArrayClass(CharType)
|
||||
|
||||
/**
|
||||
@@ -307,6 +338,7 @@ val CharArrayType get() = ArrayClass(CharType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "byte[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ByteArrayType get() = ArrayClass(ByteType)
|
||||
|
||||
/**
|
||||
@@ -315,6 +347,7 @@ val ByteArrayType get() = ArrayClass(ByteType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "short[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortArrayType get() = ArrayClass(ShortType)
|
||||
|
||||
/**
|
||||
@@ -334,6 +367,7 @@ val ShortArraytType get() = ShortArrayType
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "int[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntArrayType get() = ArrayClass(IntType)
|
||||
|
||||
/**
|
||||
@@ -342,6 +376,7 @@ val IntArrayType get() = ArrayClass(IntType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "float[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FloatArrayType get() = ArrayClass(FloatType)
|
||||
|
||||
/**
|
||||
@@ -350,6 +385,7 @@ val FloatArrayType get() = ArrayClass(FloatType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "long[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LongArrayType get() = ArrayClass(LongType)
|
||||
|
||||
/**
|
||||
@@ -358,6 +394,7 @@ val LongArrayType get() = ArrayClass(LongType)
|
||||
* 这是 Java 原始类型 (Primitive Type) 数组 - 它在字节码中的关键字为 "double[]"
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DoubleArrayType get() = ArrayClass(DoubleType)
|
||||
|
||||
/**
|
||||
@@ -366,6 +403,7 @@ val DoubleArrayType get() = ArrayClass(DoubleType)
|
||||
* 它在 Java 中表示为:Object[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AnyArrayClass get() = ArrayClass(AnyClass)
|
||||
|
||||
/**
|
||||
@@ -374,6 +412,7 @@ val AnyArrayClass get() = ArrayClass(AnyClass)
|
||||
* 它在 Java 中表示为:Boolean[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BooleanArrayClass get() = ArrayClass(BooleanClass)
|
||||
|
||||
/**
|
||||
@@ -382,6 +421,7 @@ val BooleanArrayClass get() = ArrayClass(BooleanClass)
|
||||
* 它在 Java 中表示为:Character[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharArrayClass get() = ArrayClass(CharClass)
|
||||
|
||||
/**
|
||||
@@ -390,6 +430,7 @@ val CharArrayClass get() = ArrayClass(CharClass)
|
||||
* 它在 Java 中表示为:Byte[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ByteArrayClass get() = ArrayClass(ByteClass)
|
||||
|
||||
/**
|
||||
@@ -398,6 +439,7 @@ val ByteArrayClass get() = ArrayClass(ByteClass)
|
||||
* 它在 Java 中表示为:Short[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ShortArrayClass get() = ArrayClass(ShortClass)
|
||||
|
||||
/**
|
||||
@@ -406,6 +448,7 @@ val ShortArrayClass get() = ArrayClass(ShortClass)
|
||||
* 它在 Java 中表示为:Integer[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IntArrayClass get() = ArrayClass(IntClass)
|
||||
|
||||
/**
|
||||
@@ -414,6 +457,7 @@ val IntArrayClass get() = ArrayClass(IntClass)
|
||||
* 它在 Java 中表示为:Float[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FloatArrayClass get() = ArrayClass(FloatClass)
|
||||
|
||||
/**
|
||||
@@ -422,6 +466,7 @@ val FloatArrayClass get() = ArrayClass(FloatClass)
|
||||
* 它在 Java 中表示为:Long[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val LongArrayClass get() = ArrayClass(LongClass)
|
||||
|
||||
/**
|
||||
@@ -430,6 +475,7 @@ val LongArrayClass get() = ArrayClass(LongClass)
|
||||
* 它在 Java 中表示为:Double[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DoubleArrayClass get() = ArrayClass(DoubleClass)
|
||||
|
||||
/**
|
||||
@@ -438,6 +484,7 @@ val DoubleArrayClass get() = ArrayClass(DoubleClass)
|
||||
* 它在 Java 中表示为:Number[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NumberArrayClass get() = ArrayClass(NumberClass)
|
||||
|
||||
/**
|
||||
@@ -446,6 +493,7 @@ val NumberArrayClass get() = ArrayClass(NumberClass)
|
||||
* 它在 Java 中表示为:String[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StringArrayClass get() = ArrayClass(StringClass)
|
||||
|
||||
/**
|
||||
@@ -454,138 +502,161 @@ val StringArrayClass get() = ArrayClass(StringClass)
|
||||
* 它在 Java 中表示为:CharSequence[]
|
||||
* @return [Class]<[JavaArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CharSequenceArrayClass get() = ArrayClass(CharSequenceClass)
|
||||
|
||||
/**
|
||||
* 获得 [Cloneable] 类型
|
||||
* @return [Class]<[Cloneable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val CloneableClass get() = classOf<Cloneable>()
|
||||
|
||||
/**
|
||||
* 获得 [List] 类型
|
||||
* @return [Class]<[List]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ListClass get() = classOf<List<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [ArrayList] 类型
|
||||
* @return [Class]<[ArrayList]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ArrayListClass get() = classOf<ArrayList<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [HashMap] 类型
|
||||
* @return [Class]<[HashMap]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HashMapClass get() = classOf<HashMap<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [HashSet] 类型
|
||||
* @return [Class]<[HashSet]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HashSetClass get() = classOf<HashSet<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [WeakHashMap] 类型
|
||||
* @return [Class]<[WeakHashMap]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WeakHashMapClass get() = classOf<WeakHashMap<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [WeakReference] 类型
|
||||
* @return [Class]<[WeakReference]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val WeakReferenceClass get() = classOf<WeakReference<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Enum] 类型
|
||||
* @return [Class]<[Enum]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val EnumClass get() = classOf<Enum<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Map] 类型
|
||||
* @return [Class]<[Map]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val MapClass get() = classOf<Map<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [Map.Entry] 类型
|
||||
* @return [Class]<[Map.Entry]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Map_EntryClass get() = classOf<Map.Entry<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [Reference] 类型
|
||||
* @return [Class]<[Reference]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ReferenceClass get() = classOf<Reference<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Vector] 类型
|
||||
* @return [Class]<[Vector]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val VectorClass get() = classOf<Vector<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [File] 类型
|
||||
* @return [Class]<[File]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FileClass get() = classOf<File>()
|
||||
|
||||
/**
|
||||
* 获得 [InputStream] 类型
|
||||
* @return [Class]<[InputStream]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val InputStreamClass get() = classOf<InputStream>()
|
||||
|
||||
/**
|
||||
* 获得 [OutputStream] 类型
|
||||
* @return [Class]<[OutputStream]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OutputStreamClass get() = classOf<OutputStream>()
|
||||
|
||||
/**
|
||||
* 获得 [BufferedReader] 类型
|
||||
* @return [Class]<[BufferedReader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val BufferedReaderClass get() = classOf<BufferedReader>()
|
||||
|
||||
/**
|
||||
* 获得 [Date] 类型
|
||||
* @return [Class]<[Date]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DateClass get() = classOf<Date>()
|
||||
|
||||
/**
|
||||
* 获得 [TimeZone] 类型
|
||||
* @return [Class]<[TimeZone]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TimeZoneClass get() = classOf<TimeZone>()
|
||||
|
||||
/**
|
||||
* 获得 [SimpleDateFormat] 类型
|
||||
* @return [Class]<[SimpleDateFormat]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SimpleDateFormatClass_Java get() = classOf<SimpleDateFormat>()
|
||||
|
||||
/**
|
||||
* 获得 [Timer] 类型
|
||||
* @return [Class]<[Timer]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TimerClass get() = classOf<Timer>()
|
||||
|
||||
/**
|
||||
* 获得 [TimerTask] 类型
|
||||
* @return [Class]<[TimerTask]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val TimerTaskClass get() = classOf<TimerTask>()
|
||||
|
||||
/**
|
||||
* 获得 [Thread] 类型
|
||||
* @return [Class]<[Thread]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ThreadClass get() = classOf<Thread>()
|
||||
|
||||
/**
|
||||
@@ -594,268 +665,313 @@ val ThreadClass get() = classOf<Thread>()
|
||||
* - 在 Android O (26) 及以上系统加入
|
||||
* @return [Class]<[Base64]> or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val Base64Class_Java get() = if (Build.VERSION.SDK_INT >= 26) classOf<Base64>() else null
|
||||
|
||||
/**
|
||||
* 获得 [Observer] 类型
|
||||
* @return [Class]<[Observer]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ObserverClass get() = classOf<Observer>()
|
||||
|
||||
/**
|
||||
* 获得 [Set] 类型
|
||||
* @return [Class]<[Set]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SetClass get() = classOf<Set<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [JSONObject] 类型
|
||||
* @return [Class]<[JSONObject]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JSONObjectClass get() = classOf<JSONObject>()
|
||||
|
||||
/**
|
||||
* 获得 [JSONArray] 类型
|
||||
* @return [Class]<[JSONArray]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JSONArrayClass get() = classOf<JSONArray>()
|
||||
|
||||
/**
|
||||
* 获得 [StringBuilder] 类型
|
||||
* @return [Class]<[StringBuilder]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StringBuilderClass get() = classOf<StringBuilder>()
|
||||
|
||||
/**
|
||||
* 获得 [StringBuffer] 类型
|
||||
* @return [Class]<[StringBuffer]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val StringBufferClass get() = classOf<StringBuffer>()
|
||||
|
||||
/**
|
||||
* 获得 [ZipEntry] 类型
|
||||
* @return [Class]<[ZipEntry]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ZipEntryClass get() = classOf<ZipEntry>()
|
||||
|
||||
/**
|
||||
* 获得 [ZipFile] 类型
|
||||
* @return [Class]<[ZipFile]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ZipFileClass get() = classOf<ZipFile>()
|
||||
|
||||
/**
|
||||
* 获得 [ZipInputStream] 类型
|
||||
* @return [Class]<[ZipInputStream]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ZipInputStreamClass get() = classOf<ZipInputStream>()
|
||||
|
||||
/**
|
||||
* 获得 [ZipOutputStream] 类型
|
||||
* @return [Class]<[ZipOutputStream]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ZipOutputStreamClass get() = classOf<ZipOutputStream>()
|
||||
|
||||
/**
|
||||
* 获得 [HttpURLConnection] 类型
|
||||
* @return [Class]<[HttpURLConnection]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HttpURLConnectionClass get() = classOf<HttpURLConnection>()
|
||||
|
||||
/**
|
||||
* 获得 [HttpCookie] 类型
|
||||
* @return [Class]<[HttpCookie]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HttpCookieClass get() = classOf<HttpCookie>()
|
||||
|
||||
/**
|
||||
* 获得 [HttpClient] 类型
|
||||
* @return [Class] or null
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val HttpClientClass get() = "java.net.http.HttpClient".toClassOrNull()
|
||||
|
||||
/**
|
||||
* 获得 [AtomicBoolean] 类型
|
||||
* @return [Class]<[AtomicBoolean]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val AtomicBooleanClass get() = classOf<AtomicBoolean>()
|
||||
|
||||
/**
|
||||
* 获得 [Supplier] 类型
|
||||
* @return [Class]<[Supplier]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val SupplierClass get() = classOf<Supplier<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Class] 类型
|
||||
* @return [Class]<[Class]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaClass get() = classOf<Class<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [ClassLoader] 类型
|
||||
* @return [Class]<[ClassLoader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaClassLoader get() = classOf<ClassLoader>()
|
||||
|
||||
/**
|
||||
* 获得 [BaseDexClassLoader] 类型
|
||||
* @return [Class]<[BaseDexClassLoader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DalvikBaseDexClassLoader get() = classOf<BaseDexClassLoader>()
|
||||
|
||||
/**
|
||||
* 获得 [DexClassLoader] 类型
|
||||
* @return [Class]<[DexClassLoader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DalvikDexClassLoader get() = classOf<DexClassLoader>()
|
||||
|
||||
/**
|
||||
* 获得 [PathClassLoader] 类型
|
||||
* @return [Class]<[PathClassLoader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DalvikPathClassLoader get() = classOf<PathClassLoader>()
|
||||
|
||||
/**
|
||||
* 获得 [InMemoryDexClassLoader] 类型
|
||||
* @return [Class]<[InMemoryDexClassLoader]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val DalvikInMemoryDexClassLoader get() = classOf<InMemoryDexClassLoader>()
|
||||
|
||||
/**
|
||||
* 获得 [Method] 类型
|
||||
* @return [Class]<[Method]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaMethodClass get() = classOf<Method>()
|
||||
|
||||
/**
|
||||
* 获得 [Field] 类型
|
||||
* @return [Class]<[Field]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaFieldClass get() = classOf<Field>()
|
||||
|
||||
/**
|
||||
* 获得 [Constructor] 类型
|
||||
* @return [Class]<[Constructor]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaConstructorClass get() = classOf<Constructor<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [Member] 类型
|
||||
* @return [Class]<[Member]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaMemberClass get() = classOf<Member>()
|
||||
|
||||
/**
|
||||
* 获得 [Annotation] 类型
|
||||
* @return [Class]<[Annotation]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val JavaAnnotationClass get() = classOf<Annotation>()
|
||||
|
||||
/**
|
||||
* 获得 [java.util.function.Function] 类型
|
||||
* @return [Class]<[JavaFunction]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val FunctionClass get() = classOf<JavaFunction<*, *>>()
|
||||
|
||||
/**
|
||||
* 获得 [Optional] 类型
|
||||
* @return [Class]<[Optional]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OptionalClass get() = classOf<Optional<*>>()
|
||||
|
||||
/**
|
||||
* 获得 [OptionalInt] 类型
|
||||
* @return [Class]<[OptionalInt]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OptionalIntClass get() = classOf<OptionalInt>()
|
||||
|
||||
/**
|
||||
* 获得 [OptionalLong] 类型
|
||||
* @return [Class]<[OptionalLong]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OptionalLongClass get() = classOf<OptionalLong>()
|
||||
|
||||
/**
|
||||
* 获得 [OptionalDouble] 类型
|
||||
* @return [Class]<[OptionalDouble]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val OptionalDoubleClass get() = classOf<OptionalDouble>()
|
||||
|
||||
/**
|
||||
* 获得 [Objects] 类型
|
||||
* @return [Class]<[Objects]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ObjectsClass get() = classOf<Objects>()
|
||||
|
||||
/**
|
||||
* 获得 [Runtime] 类型
|
||||
* @return [Class]<[Runtime]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RuntimeClass get() = classOf<Runtime>()
|
||||
|
||||
/**
|
||||
* 获得 [NullPointerException] 类型
|
||||
* @return [Class]<[NullPointerException]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NullPointerExceptionClass get() = classOf<NullPointerException>()
|
||||
|
||||
/**
|
||||
* 获得 [NumberFormatException] 类型
|
||||
* @return [Class]<[NumberFormatException]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NumberFormatExceptionClass get() = classOf<NumberFormatException>()
|
||||
|
||||
/**
|
||||
* 获得 [IllegalStateException] 类型
|
||||
* @return [Class]<[IllegalStateException]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val IllegalStateExceptionClass get() = classOf<IllegalStateException>()
|
||||
|
||||
/**
|
||||
* 获得 [RuntimeException] 类型
|
||||
* @return [Class]<[RuntimeException]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val RuntimeExceptionClass get() = classOf<RuntimeException>()
|
||||
|
||||
/**
|
||||
* 获得 [ClassNotFoundException] 类型
|
||||
* @return [Class]<[ClassNotFoundException]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ClassNotFoundExceptionClass get() = classOf<ClassNotFoundException>()
|
||||
|
||||
/**
|
||||
* 获得 [NoClassDefFoundError] 类型
|
||||
* @return [Class]<[NoClassDefFoundError]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NoClassDefFoundErrorClass get() = classOf<NoClassDefFoundError>()
|
||||
|
||||
/**
|
||||
* 获得 [NoSuchMethodError] 类型
|
||||
* @return [Class]<[NoSuchMethodError]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NoSuchMethodErrorClass get() = classOf<NoSuchMethodError>()
|
||||
|
||||
/**
|
||||
* 获得 [NoSuchFieldError] 类型
|
||||
* @return [Class]<[NoSuchFieldError]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val NoSuchFieldErrorClass get() = classOf<NoSuchFieldError>()
|
||||
|
||||
/**
|
||||
* 获得 [Error] 类型
|
||||
* @return [Class]<[Error]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ErrorClass get() = classOf<Error>()
|
||||
|
||||
/**
|
||||
* 获得 [Exception] 类型
|
||||
* @return [Class]<[Exception]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ExceptionClass get() = classOf<Exception>()
|
||||
|
||||
/**
|
||||
* 获得 [Throwable] 类型
|
||||
* @return [Class]<[Throwable]>
|
||||
*/
|
||||
@Deprecated(ReflectionMigration.KAVAREF_INFO)
|
||||
val ThrowableClass get() = classOf<Throwable>()
|
@@ -185,4 +185,4 @@ internal object RandomSeed {
|
||||
internal fun createString(length: Int = 15): String = buildString {
|
||||
repeat(length) { append(RANDOM_LETTERS_NUMBERS.random()) }
|
||||
}
|
||||
}
|
||||
}
|
@@ -22,12 +22,10 @@
|
||||
package com.highcapable.yukihookapi.hook.xposed.application
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||
import com.highcapable.yukihookapi.hook.xposed.channel.YukiHookDataChannel
|
||||
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||
import me.weishu.reflection.Reflection
|
||||
|
||||
/**
|
||||
* 这是对使用 [YukiHookAPI] Xposed 模块实现中的一个扩展功能
|
||||
@@ -44,8 +42,6 @@ import me.weishu.reflection.Reflection
|
||||
*
|
||||
* - 在模块与宿主中使用 [YukiHookDataChannel] 进行通讯
|
||||
*
|
||||
* - 在模块中使用系统隐藏 API - 核心技术引用了开源项目 [FreeReflection](https://github.com/tiann/FreeReflection)
|
||||
*
|
||||
* - 在模块中使用 [YukiHookAPI.Status.isTaiChiModuleActive] 判断太极、无极激活状态
|
||||
*
|
||||
* 详情请参考 [API 文档 - ModuleApplication](https://highcapable.github.io/YukiHookAPI/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication)
|
||||
@@ -67,11 +63,6 @@ open class ModuleApplication : Application() {
|
||||
val appContext get() = currentContext ?: error("App is dead, You cannot call to appContext")
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
super.attachBaseContext(base)
|
||||
runCatching { Reflection.unseal(base) }
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
currentContext = this
|
||||
|
@@ -24,9 +24,9 @@ package com.highcapable.yukihookapi.hook.xposed.bridge
|
||||
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.res.Resources
|
||||
import com.highcapable.kavaref.extension.hasClass
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||
import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper
|
||||
@@ -105,7 +105,8 @@ internal object YukiXposedModule : IYukiXposedModuleLifecycle {
|
||||
* @return [Boolean] 是否存在
|
||||
*/
|
||||
private fun isMiuiCatcherPatch(packageName: String?) =
|
||||
(packageName == "com.miui.contentcatcher" || packageName == "com.miui.catcherpatch") && "android.miui.R".hasClass()
|
||||
(packageName == "com.miui.contentcatcher" || packageName == "com.miui.catcherpatch") &&
|
||||
javaClass.classLoader?.hasClass("android.miui.R") == true
|
||||
|
||||
/**
|
||||
* 当前包名是否已在指定的 [HookEntryType] 被装载
|
||||
|
@@ -22,10 +22,10 @@
|
||||
*/
|
||||
package com.highcapable.yukihookapi.hook.xposed.bridge.status
|
||||
|
||||
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
||||
import com.highcapable.kavaref.extension.toClassOrNull
|
||||
import com.highcapable.kavaref.resolver.MethodResolver
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.isModuleActive]、[YukiHookAPI.Status.isXposedModuleActive]、[YukiHookAPI.Status.isTaiChiModuleActive] 判断模块激活状态
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal val isActive get() = classMethod(IS_ACTIVE_METHOD_NAME)?.boolean() ?: false
|
||||
internal val isActive get() = classMethod(IS_ACTIVE_METHOD_NAME)?.invoke<Boolean>() ?: false
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 是否支持资源钩子 (Resources Hook)
|
||||
@@ -72,7 +72,7 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.isSupportResourcesHook] 判断支持状态
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal val isSupportResourcesHook get() = classMethod(IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME)?.boolean() ?: false
|
||||
internal val isSupportResourcesHook get() = classMethod(IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME)?.invoke<Boolean>() ?: false
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 名称
|
||||
@@ -80,7 +80,7 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.Executor.name] 获取
|
||||
* @return [String] 模块未激活会返回 unknown
|
||||
*/
|
||||
internal val executorName get() = classMethod(GET_EXECUTOR_NAME_METHOD_NAME)?.string()?.ifBlank { "unknown" } ?: "unknown"
|
||||
internal val executorName get() = classMethod(GET_EXECUTOR_NAME_METHOD_NAME)?.invoke<String>()?.ifBlank { "unknown" } ?: "unknown"
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 的 API 版本
|
||||
@@ -88,7 +88,7 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.Executor.apiLevel] 获取
|
||||
* @return [Int] 模块未激活会返回 -1
|
||||
*/
|
||||
internal val executorApiLevel get() = classMethod(GET_EXECUTOR_API_LEVEL_METHOD_NAME)?.int()?.takeIf { it > 0 } ?: -1
|
||||
internal val executorApiLevel get() = classMethod(GET_EXECUTOR_API_LEVEL_METHOD_NAME)?.invoke<Int>()?.takeIf { it > 0 } ?: -1
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 版本名称
|
||||
@@ -96,7 +96,7 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.Executor.versionName] 获取
|
||||
* @return [Int] 模块未激活会返回 unknown
|
||||
*/
|
||||
internal val executorVersionName get() = classMethod(GET_EXECUTOR_VERSION_NAME_METHOD_NAME)?.string()?.ifBlank { "unknown" } ?: "unknown"
|
||||
internal val executorVersionName get() = classMethod(GET_EXECUTOR_VERSION_NAME_METHOD_NAME)?.invoke<String>()?.ifBlank { "unknown" } ?: "unknown"
|
||||
|
||||
/**
|
||||
* 获取当前 Hook Framework 版本号
|
||||
@@ -104,14 +104,14 @@ internal object YukiXposedModuleStatus {
|
||||
* 请使用 [YukiHookAPI.Status.Executor.versionCode] 获取
|
||||
* @return [Int] 模块未激活会返回 -1
|
||||
*/
|
||||
internal val executorVersionCode get() = classMethod(GET_EXECUTOR_VERSION_CODE_METHOD_NAME)?.int()?.takeIf { it > 0 } ?: -1
|
||||
internal val executorVersionCode get() = classMethod(GET_EXECUTOR_VERSION_CODE_METHOD_NAME)?.invoke<Int>()?.takeIf { it > 0 } ?: -1
|
||||
|
||||
/**
|
||||
* 通过 [className] 获取方法实例
|
||||
* @param name 方法名称
|
||||
* @return [MethodFinder.Result.Instance] or null
|
||||
* @return [MethodResolver] or null
|
||||
*/
|
||||
private fun classMethod(name: String) = className.toClassOrNull()?.method { this.name = name }?.ignored()?.onNoSuchMethod {
|
||||
YLog.innerW("Failed to initialize YukiXposedModuleStatus", it)
|
||||
}?.get()
|
||||
private fun classMethod(name: String) = className.toClassOrNull()?.resolve()?.optional()?.firstMethodOrNull { this.name = name }.apply {
|
||||
if (this == null) YLog.innerW("Failed to initialize YukiXposedModuleStatus")
|
||||
}
|
||||
}
|
@@ -41,40 +41,21 @@ import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.UserHandle
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
||||
import com.highcapable.kavaref.extension.classOf
|
||||
import com.highcapable.kavaref.extension.lazyClass
|
||||
import com.highcapable.kavaref.extension.lazyClassOrNull
|
||||
import com.highcapable.kavaref.extension.toClassOrNull
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiProperty
|
||||
import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper
|
||||
import com.highcapable.yukihookapi.hook.core.api.proxy.YukiHookCallback
|
||||
import com.highcapable.yukihookapi.hook.core.api.proxy.YukiMemberHook
|
||||
import com.highcapable.yukihookapi.hook.core.api.proxy.YukiMemberReplacement
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.factory.hasMethod
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
import com.highcapable.yukihookapi.hook.core.api.reflect.AndroidHiddenApiBypassResolver
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.type.android.ActivityManagerClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ActivityManagerNativeClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ActivityTaskManagerClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ActivityThreadClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ApplicationClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ContextClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ContextImplClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.HandlerClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.IActivityManagerClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.IActivityTaskManagerClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.InstrumentationClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.IntentClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.SingletonClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.UserHandleClass
|
||||
import com.highcapable.yukihookapi.hook.type.java.BooleanType
|
||||
import com.highcapable.yukihookapi.hook.type.java.IntType
|
||||
import com.highcapable.yukihookapi.hook.type.java.JavaClassLoader
|
||||
import com.highcapable.yukihookapi.hook.type.java.StringClass
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.status.YukiXposedModuleStatus
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.type.HookEntryType
|
||||
@@ -109,6 +90,14 @@ internal object AppParasitics {
|
||||
/** 当前 Hook APP (宿主) 的生命周期演绎者数组 */
|
||||
private val appLifecycleActors = mutableMapOf<String, AppLifecycleActor>()
|
||||
|
||||
private val ActivityThreadClass by lazyClass("android.app.ActivityThread")
|
||||
private val ContextImplClass by lazyClass("android.app.ContextImpl")
|
||||
private val ActivityManagerNativeClass by lazyClass("android.app.ActivityManagerNative")
|
||||
private val SingletonClass by lazyClass("android.util.Singleton")
|
||||
private val IActivityManagerClass by lazyClass("android.app.IActivityManager")
|
||||
private val ActivityTaskManagerClass by lazyClassOrNull("android.app.ActivityTaskManager")
|
||||
private val IActivityTaskManagerClass by lazyClass("android.app.IActivityTaskManager")
|
||||
|
||||
/**
|
||||
* 当前 Hook APP (宿主) 的全局生命周期 [Application]
|
||||
*
|
||||
@@ -127,34 +116,53 @@ internal object AppParasitics {
|
||||
|
||||
/**
|
||||
* 获取当前系统框架的 [Context]
|
||||
* @return [Context] ContextImpl 实例对象
|
||||
* @throws IllegalStateException 如果获取不到系统框架的 [Context]
|
||||
* @return [Context] ContextImpl 实例对象 or null
|
||||
*/
|
||||
internal val systemContext
|
||||
get() = ActivityThreadClass.method { name = "currentActivityThread" }.ignored().get().call()?.let {
|
||||
ActivityThreadClass.method { name = "getSystemContext" }.ignored().get(it).invoke<Context?>()
|
||||
} ?: error("Failed to got SystemContext")
|
||||
internal val systemContext get(): Context? {
|
||||
val scope = ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
val current = scope.firstMethodOrNull {
|
||||
name = "currentActivityThread"
|
||||
emptyParameters()
|
||||
}?.invoke()
|
||||
return scope.firstMethodOrNull {
|
||||
name = "getSystemContext"
|
||||
emptyParameters()
|
||||
}?.of(current)?.invokeQuietly<Context>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前宿主的 [Application]
|
||||
* @return [Application] or null
|
||||
*/
|
||||
internal val currentApplication
|
||||
get() = runCatching { AndroidAppHelper.currentApplication() }.getOrNull() ?: runCatching {
|
||||
ActivityThreadClass.method { name = "currentApplication" }.ignored().get().invoke<Application>()
|
||||
}.getOrNull()
|
||||
get() = runCatching { AndroidAppHelper.currentApplication() }.getOrNull()
|
||||
?: ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "currentApplication" }
|
||||
?.invoke<Application>()
|
||||
|
||||
/**
|
||||
* 获取当前宿主的 [ApplicationInfo]
|
||||
* @return [ApplicationInfo] or null
|
||||
*/
|
||||
internal val currentApplicationInfo
|
||||
get() = runCatching { AndroidAppHelper.currentApplicationInfo() }.getOrNull() ?: runCatching {
|
||||
ActivityThreadClass.method { name = "currentActivityThread" }.ignored().get().call()
|
||||
?.current(ignored = true)?.field { name = "mBoundApplication" }
|
||||
?.current(ignored = true)?.field { name = "appInfo" }
|
||||
?.cast<ApplicationInfo>()
|
||||
}.getOrNull()
|
||||
get() = runCatching { AndroidAppHelper.currentApplicationInfo() }.getOrNull()
|
||||
?: let {
|
||||
val scope = ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
val current = scope.firstMethodOrNull {
|
||||
name = "currentActivityThread"
|
||||
emptyParameters()
|
||||
}?.invoke()
|
||||
val currentScope = current?.resolve()?.optional()
|
||||
val mBoundApplication = currentScope?.firstFieldOrNull { name = "mBoundApplication" }?.get()
|
||||
val appScope = mBoundApplication?.resolve()?.optional()
|
||||
appScope?.firstFieldOrNull { name = "appInfo" }?.get<ApplicationInfo>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前宿主的包名
|
||||
@@ -167,10 +175,14 @@ internal object AppParasitics {
|
||||
* @return [String]
|
||||
*/
|
||||
internal val currentProcessName
|
||||
get() = runCatching { AndroidAppHelper.currentProcessName() }.getOrNull() ?: runCatching {
|
||||
ActivityThreadClass.method { name = "currentPackageName" }.ignored().get().string()
|
||||
.takeIf { it.isNotBlank() } ?: SYSTEM_FRAMEWORK_NAME
|
||||
}.getOrNull() ?: SYSTEM_FRAMEWORK_NAME
|
||||
get() = runCatching { AndroidAppHelper.currentProcessName() }.getOrNull()
|
||||
?: ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "currentPackageName" }
|
||||
?.invoke<String>()
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?: SYSTEM_FRAMEWORK_NAME
|
||||
|
||||
/**
|
||||
* 获取指定 [packageName] 的用户 ID
|
||||
@@ -179,13 +191,17 @@ internal object AppParasitics {
|
||||
* @param packageName 当前包名
|
||||
* @return [Int]
|
||||
*/
|
||||
internal fun findUserId(packageName: String) = runCatching {
|
||||
@Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress")
|
||||
UserHandleClass.method {
|
||||
name = "getUserId"
|
||||
param(IntType)
|
||||
}.ignored().get().int(systemContext.packageManager.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES).uid)
|
||||
}.getOrNull() ?: 0
|
||||
internal fun findUserId(packageName: String): Int {
|
||||
val uid = systemContext?.packageManager?.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES)?.uid
|
||||
?: return 0
|
||||
return UserHandle::class.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull {
|
||||
name = "getUserId"
|
||||
parameters(Int::class)
|
||||
}?.invoke<Int>(uid) ?: 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听并 Hook 当前 [ClassLoader] 的 [ClassLoader.loadClass] 方法
|
||||
@@ -197,8 +213,12 @@ internal object AppParasitics {
|
||||
if (YukiXposedModule.isXposedEnvironment.not()) return YLog.innerW("You can only use hook ClassLoader method in Xposed Environment")
|
||||
classLoaderCallbacks[loader.hashCode()] = result
|
||||
if (isClassLoaderHooked) return
|
||||
val loadClass = ClassLoader::class.resolve().optional().firstMethodOrNull {
|
||||
name = "loadClass"
|
||||
parameters(String::class, Boolean::class)
|
||||
}
|
||||
runCatching {
|
||||
YukiHookHelper.hook(JavaClassLoader.method { name = "loadClass"; param(StringClass, BooleanType) }, object : YukiMemberHook() {
|
||||
YukiHookHelper.hook(loadClass, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
param.instance?.also { loader ->
|
||||
(param.result as? Class<*>?)?.also { classLoaderCallbacks[loader.hashCode()]?.invoke(it) }
|
||||
@@ -216,37 +236,43 @@ internal object AppParasitics {
|
||||
*/
|
||||
internal fun hookModuleAppRelated(loader: ClassLoader?, type: HookEntryType) {
|
||||
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("preferences.xml") == true) param.args?.set(1, 1)
|
||||
YukiHookHelper.hook(
|
||||
ContextImplClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "setFilePermissionsFromMode" },
|
||||
object : YukiMemberHook() {
|
||||
override fun beforeHookedMember(param: Param) {
|
||||
if ((param.args?.get(0) as? String?)?.endsWith("preferences.xml") == true) param.args?.set(1, 1)
|
||||
}
|
||||
}
|
||||
})
|
||||
YukiXposedModuleStatus.className.toClassOrNull(loader)?.apply {
|
||||
)
|
||||
YukiXposedModuleStatus.className.toClassOrNull(loader)?.resolve()?.optional()?.apply {
|
||||
if (type != HookEntryType.RESOURCES) {
|
||||
YukiHookHelper.hook(method { name = YukiXposedModuleStatus.IS_ACTIVE_METHOD_NAME },
|
||||
YukiHookHelper.hook(firstMethodOrNull { name = YukiXposedModuleStatus.IS_ACTIVE_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = true
|
||||
})
|
||||
YukiHookHelper.hook(method { name = YukiXposedModuleStatus.GET_EXECUTOR_NAME_METHOD_NAME },
|
||||
YukiHookHelper.hook(firstMethodOrNull { name = YukiXposedModuleStatus.GET_EXECUTOR_NAME_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = HookApiProperty.name
|
||||
})
|
||||
YukiHookHelper.hook(
|
||||
method { name = YukiXposedModuleStatus.GET_EXECUTOR_API_LEVEL_METHOD_NAME },
|
||||
firstMethodOrNull { name = YukiXposedModuleStatus.GET_EXECUTOR_API_LEVEL_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = HookApiProperty.apiLevel
|
||||
})
|
||||
YukiHookHelper.hook(
|
||||
method { name = YukiXposedModuleStatus.GET_EXECUTOR_VERSION_NAME_METHOD_NAME },
|
||||
firstMethodOrNull { name = YukiXposedModuleStatus.GET_EXECUTOR_VERSION_NAME_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = HookApiProperty.versionName
|
||||
})
|
||||
YukiHookHelper.hook(
|
||||
method { name = YukiXposedModuleStatus.GET_EXECUTOR_VERSION_CODE_METHOD_NAME },
|
||||
firstMethodOrNull { name = YukiXposedModuleStatus.GET_EXECUTOR_VERSION_CODE_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = HookApiProperty.versionCode
|
||||
})
|
||||
} else YukiHookHelper.hook(method { name = YukiXposedModuleStatus.IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME },
|
||||
} else YukiHookHelper.hook(firstMethodOrNull { name = YukiXposedModuleStatus.IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME },
|
||||
object : YukiMemberReplacement() {
|
||||
override fun replaceHookedMember(param: Param) = true
|
||||
})
|
||||
@@ -268,8 +294,8 @@ internal object AppParasitics {
|
||||
}
|
||||
/** Hook [Application] 装载方法 */
|
||||
runCatching {
|
||||
if (appLifecycleActors.isNotEmpty()) {
|
||||
YukiHookHelper.hook(ApplicationClass.method { name = "attach"; param(ContextClass) }, object : YukiMemberHook() {
|
||||
if (appLifecycleActors.isNotEmpty()) Application::class.resolve().apply {
|
||||
YukiHookHelper.hook(firstMethod { name = "attach"; parameters(Context::class) }, object : YukiMemberHook() {
|
||||
override fun beforeHookedMember(param: Param) {
|
||||
runCatching {
|
||||
appLifecycleActors.forEach { (_, actor) ->
|
||||
@@ -286,7 +312,7 @@ internal object AppParasitics {
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}
|
||||
})
|
||||
YukiHookHelper.hook(ApplicationClass.method { name = "onTerminate" }, object : YukiMemberHook() {
|
||||
YukiHookHelper.hook(firstMethod { name = "onTerminate" }, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
appLifecycleActors.forEach { (_, actor) ->
|
||||
@@ -295,7 +321,7 @@ internal object AppParasitics {
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}
|
||||
})
|
||||
YukiHookHelper.hook(ApplicationClass.method { name = "onLowMemory" }, object : YukiMemberHook() {
|
||||
YukiHookHelper.hook(firstMethod { name = "onLowMemory" }, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
appLifecycleActors.forEach { (_, actor) ->
|
||||
@@ -304,7 +330,7 @@ internal object AppParasitics {
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}
|
||||
})
|
||||
YukiHookHelper.hook(ApplicationClass.method { name = "onTrimMemory"; param(IntType) }, object : YukiMemberHook() {
|
||||
YukiHookHelper.hook(firstMethod { name = "onTrimMemory"; parameters(Int::class) }, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
val self = param.instance as? Application? ?: return
|
||||
@@ -313,7 +339,7 @@ internal object AppParasitics {
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}
|
||||
})
|
||||
YukiHookHelper.hook(ApplicationClass.method { name = "onConfigurationChanged" }, object : YukiMemberHook() {
|
||||
YukiHookHelper.hook(firstMethod { name = "onConfigurationChanged" }, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
val self = param.instance as? Application? ?: return
|
||||
@@ -324,54 +350,57 @@ internal object AppParasitics {
|
||||
})
|
||||
}
|
||||
if (YukiHookAPI.Configs.isEnableDataChannel || appLifecycleActors.isNotEmpty())
|
||||
YukiHookHelper.hook(InstrumentationClass.method { name = "callApplicationOnCreate" }, object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
(param.args?.get(0) as? Application?)?.also {
|
||||
/**
|
||||
* 注册广播
|
||||
* @param result 回调 - ([Context] 当前实例, [Intent] 当前对象)
|
||||
*/
|
||||
fun IntentFilter.registerReceiver(result: (Context, Intent) -> Unit) {
|
||||
object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
if (context == null || intent == null) return
|
||||
result(context, intent)
|
||||
YukiHookHelper.hook(
|
||||
Instrumentation::class.resolve().optional().firstMethodOrNull { name = "callApplicationOnCreate" },
|
||||
object : YukiMemberHook() {
|
||||
override fun afterHookedMember(param: Param) {
|
||||
runCatching {
|
||||
(param.args?.get(0) as? Application?)?.also {
|
||||
/**
|
||||
* 注册广播
|
||||
* @param result 回调 - ([Context] 当前实例, [Intent] 当前对象)
|
||||
*/
|
||||
fun IntentFilter.registerReceiver(result: (Context, Intent) -> Unit) {
|
||||
object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
if (context == null || intent == null) return
|
||||
result(context, intent)
|
||||
}
|
||||
}.also { receiver ->
|
||||
/**
|
||||
* 从 Android 14 (及预览版) 开始
|
||||
* 外部广播必须声明 [Context.RECEIVER_EXPORTED]
|
||||
*/
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
if (Build.VERSION.SDK_INT >= 33)
|
||||
it.registerReceiver(receiver, this, Context.RECEIVER_EXPORTED)
|
||||
else it.registerReceiver(receiver, this)
|
||||
}
|
||||
}.also { receiver ->
|
||||
/**
|
||||
* 从 Android 14 (及预览版) 开始
|
||||
* 外部广播必须声明 [Context.RECEIVER_EXPORTED]
|
||||
*/
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
if (Build.VERSION.SDK_INT >= 33)
|
||||
it.registerReceiver(receiver, this, Context.RECEIVER_EXPORTED)
|
||||
else it.registerReceiver(receiver, this)
|
||||
}
|
||||
hostApplication = it
|
||||
appLifecycleActors.forEach { (_, actor) ->
|
||||
actor.onCreateCallback?.invoke(it)
|
||||
actor.onReceiverActionsCallbacks.takeIf { e -> e.isNotEmpty() }?.forEach { (_, e) ->
|
||||
if (e.first.isNotEmpty()) IntentFilter().apply {
|
||||
e.first.forEach { action -> addAction(action) }
|
||||
}.registerReceiver(e.second)
|
||||
}
|
||||
actor.onReceiverFiltersCallbacks.takeIf { e -> e.isNotEmpty() }
|
||||
?.forEach { (_, e) -> e.first.registerReceiver(e.second) }
|
||||
}
|
||||
runCatching {
|
||||
/** 过滤系统框架与一系列服务组件包名不唯一的情况 */
|
||||
if (isDataChannelRegistered ||
|
||||
(currentPackageName == SYSTEM_FRAMEWORK_NAME && packageName != SYSTEM_FRAMEWORK_NAME)
|
||||
) return
|
||||
YukiHookDataChannel.instance().register(it, packageName)
|
||||
isDataChannelRegistered = true
|
||||
}
|
||||
}
|
||||
hostApplication = it
|
||||
appLifecycleActors.forEach { (_, actor) ->
|
||||
actor.onCreateCallback?.invoke(it)
|
||||
actor.onReceiverActionsCallbacks.takeIf { e -> e.isNotEmpty() }?.forEach { (_, e) ->
|
||||
if (e.first.isNotEmpty()) IntentFilter().apply {
|
||||
e.first.forEach { action -> addAction(action) }
|
||||
}.registerReceiver(e.second)
|
||||
}
|
||||
actor.onReceiverFiltersCallbacks.takeIf { e -> e.isNotEmpty() }
|
||||
?.forEach { (_, e) -> e.first.registerReceiver(e.second) }
|
||||
}
|
||||
runCatching {
|
||||
/** 过滤系统框架与一系列服务组件包名不唯一的情况 */
|
||||
if (isDataChannelRegistered ||
|
||||
(currentPackageName == SYSTEM_FRAMEWORK_NAME && packageName != SYSTEM_FRAMEWORK_NAME)
|
||||
) return
|
||||
YukiHookDataChannel.instance().register(it, packageName)
|
||||
isDataChannelRegistered = true
|
||||
}
|
||||
}
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}.onFailure { param.throwToAppOrLogger(it) }
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,10 +412,13 @@ internal object AppParasitics {
|
||||
if (YukiXposedModule.isXposedEnvironment) runCatching {
|
||||
if (currentPackageName == YukiXposedModule.modulePackageName)
|
||||
return YLog.innerE("You cannot inject module resources into yourself")
|
||||
hostResources.assets.current(ignored = true).method {
|
||||
name = "addAssetPath"
|
||||
param(StringClass)
|
||||
}.call(YukiXposedModule.moduleAppFilePath)
|
||||
hostResources.assets.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull {
|
||||
name = "addAssetPath"
|
||||
parameters(String::class)
|
||||
}?.invoke(YukiXposedModule.moduleAppFilePath)
|
||||
}.onFailure {
|
||||
YLog.innerE("Failed to inject module resources into [$hostResources]", it)
|
||||
} else YLog.innerW("You can only inject module resources in Xposed Environment")
|
||||
@@ -402,6 +434,7 @@ internal object AppParasitics {
|
||||
if (isActivityProxyRegistered) return
|
||||
if (YukiXposedModule.isXposedEnvironment.not()) return YLog.innerW("You can only register Activity Proxy in Xposed Environment")
|
||||
if (context.packageName == YukiXposedModule.modulePackageName) return YLog.innerE("You cannot register Activity Proxy into yourself")
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
if (Build.VERSION.SDK_INT < 24) return YLog.innerE("Activity Proxy only support for Android 7.0 (API 24) or higher")
|
||||
runCatching {
|
||||
ActivityProxyConfig.apply {
|
||||
@@ -416,36 +449,85 @@ internal object AppParasitics {
|
||||
@Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress")
|
||||
queryIntentActivities(getLaunchIntentForPackage(context.packageName)!!, 0).first().activityInfo.name
|
||||
}?.getOrNull() ?: ""
|
||||
if ((proxyClassName.hasClass(context.classLoader) && proxyClassName.toClass(context.classLoader).hasMethod {
|
||||
name = "setIntent"; param(IntentClass); superClass()
|
||||
}).not()
|
||||
) (if (proxyClassName.isBlank()) error("Cound not got launch intent for package \"${context.packageName}\"")
|
||||
else error("Could not found \"$proxyClassName\" or Class is not a type of Activity"))
|
||||
val checkIsActivity = proxyClassName.toClassOrNull(context.classLoader)
|
||||
?.resolve()?.optional()
|
||||
?.firstMethodOrNull {
|
||||
name = "setIntent"
|
||||
parameters(Intent::class)
|
||||
superclass()
|
||||
} != null
|
||||
if (!checkIsActivity) {
|
||||
if (proxyClassName.isBlank()) error("Cound not got launch intent for package \"${context.packageName}\"")
|
||||
else error("Could not found \"$proxyClassName\" or Class is not a type of Activity")
|
||||
}
|
||||
}
|
||||
/** Patched [Instrumentation] */
|
||||
ActivityThreadClass.field { name = "sCurrentActivityThread" }.ignored().get().any()?.current(ignored = true) {
|
||||
method { name = "getInstrumentation" }
|
||||
.invoke<Instrumentation>()
|
||||
?.also { field { name = "mInstrumentation" }.set(InstrumentationDelegate.wrapper(it)) }
|
||||
HandlerClass.field { name = "mCallback" }.get(field { name = "mH" }.any()).apply {
|
||||
cast<Handler.Callback?>()?.apply {
|
||||
if (current().name != HandlerDelegateImpl.wrapperClassName) set(HandlerDelegateImpl.createWrapper(baseInstance = this))
|
||||
} ?: set(HandlerDelegateImpl.createWrapper())
|
||||
}
|
||||
}
|
||||
val sCurrentActivityThread = ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "sCurrentActivityThread" }
|
||||
?.get()
|
||||
val instrumentation = sCurrentActivityThread?.resolve()
|
||||
?.processor(AndroidHiddenApiBypassResolver.get())
|
||||
?.optional()
|
||||
?.firstMethodOrNull { name = "getInstrumentation" }
|
||||
?.invoke<Instrumentation>() ?: error("Could not found Instrumentation in ActivityThread")
|
||||
sCurrentActivityThread.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "mInstrumentation" }
|
||||
?.set(InstrumentationDelegate.wrapper(instrumentation))
|
||||
val mH = sCurrentActivityThread.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "mH" }
|
||||
?.get<Handler>() ?: error("Could not found mH in ActivityThread")
|
||||
val mCallbackResolver = Handler::class.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "mCallback" }
|
||||
?.of(mH)
|
||||
val mCallback = mCallbackResolver?.get<Handler.Callback>()
|
||||
if (mCallback != null) {
|
||||
if (mCallback.javaClass.name != HandlerDelegateImpl.wrapperClassName)
|
||||
mCallbackResolver.set(HandlerDelegateImpl.createWrapper(mCallback))
|
||||
} else mCallbackResolver?.set(HandlerDelegateImpl.createWrapper())
|
||||
/** Patched [ActivityManager] */
|
||||
runCatching {
|
||||
runCatching {
|
||||
ActivityManagerNativeClass.field { name = "gDefault" }.ignored().get().any()
|
||||
}.getOrNull() ?: ActivityManagerClass.field { name = "IActivityManagerSingleton" }.ignored().get().any()
|
||||
}.getOrNull()?.also { default ->
|
||||
SingletonClass.field { name = "mInstance" }.ignored().result {
|
||||
get(default).apply { any()?.also { set(IActivityManagerProxyImpl.createWrapper(IActivityManagerClass, it)) } }
|
||||
ActivityTaskManagerClass?.field { name = "IActivityTaskManagerSingleton" }?.ignored()?.get()?.any()?.also { singleton ->
|
||||
SingletonClass.method { name = "get" }.ignored().get(singleton).call()
|
||||
get(singleton).apply { any()?.also { set(IActivityManagerProxyImpl.createWrapper(IActivityTaskManagerClass, it)) } }
|
||||
}
|
||||
}
|
||||
val gDefault = ActivityManagerNativeClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional(silent = true)
|
||||
.firstFieldOrNull { name = "gDefault" }
|
||||
?.get()
|
||||
?: ActivityManager::class.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional(silent = true)
|
||||
.firstFieldOrNull {
|
||||
name = "IActivityManagerSingleton"
|
||||
}?.get()
|
||||
val mInstanceResolver = SingletonClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "mInstance" }
|
||||
?.of(gDefault)
|
||||
val mInstance = mInstanceResolver?.get()
|
||||
mInstance?.let {
|
||||
mInstanceResolver.set(IActivityManagerProxyImpl.createWrapper(IActivityManagerClass, it))
|
||||
}
|
||||
val singleton = ActivityTaskManagerClass?.resolve()
|
||||
?.processor(AndroidHiddenApiBypassResolver.get())
|
||||
?.optional(silent = true)
|
||||
?.firstFieldOrNull { name = "IActivityTaskManagerSingleton" }
|
||||
?.get()
|
||||
SingletonClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "get" }
|
||||
?.of(singleton)
|
||||
?.invokeQuietly()
|
||||
val mInstanceResolver2 = mInstanceResolver?.copy()?.of(singleton)
|
||||
val mInstance2 = mInstanceResolver2?.get()
|
||||
mInstance2?.let {
|
||||
mInstanceResolver2.set(IActivityManagerProxyImpl.createWrapper(IActivityTaskManagerClass, it))
|
||||
}
|
||||
isActivityProxyRegistered = true
|
||||
}.onFailure { YLog.innerE("Activity Proxy initialization failed because got an exception", it) }
|
||||
|
@@ -39,11 +39,10 @@ import android.os.PersistableBundle
|
||||
import android.os.TestLooperManager
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import com.highcapable.yukihookapi.hook.factory.buildOf
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.kavaref.extension.createInstanceOrNull
|
||||
import com.highcapable.kavaref.extension.toClass
|
||||
import com.highcapable.yukihookapi.hook.factory.injectModuleAppResources
|
||||
import com.highcapable.yukihookapi.hook.factory.processName
|
||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
||||
import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
|
||||
|
||||
@@ -68,16 +67,16 @@ internal class InstrumentationDelegate private constructor(private val baseInsta
|
||||
* @param icicle [Bundle]
|
||||
*/
|
||||
private fun Activity.injectLifecycle(icicle: Bundle?) {
|
||||
if (icicle != null && current().name.startsWith(YukiXposedModule.modulePackageName))
|
||||
if (icicle != null && javaClass.name.startsWith(YukiXposedModule.modulePackageName))
|
||||
icicle.classLoader = AppParasitics.baseClassLoader
|
||||
if (current().name.startsWith(YukiXposedModule.modulePackageName)) injectModuleAppResources()
|
||||
if (javaClass.name.startsWith(YukiXposedModule.modulePackageName)) injectModuleAppResources()
|
||||
}
|
||||
|
||||
override fun newActivity(cl: ClassLoader?, className: String?, intent: Intent?): Activity? = try {
|
||||
baseInstance.newActivity(cl, className, intent)
|
||||
} catch (e: Throwable) {
|
||||
if (className?.startsWith(YukiXposedModule.modulePackageName) == true)
|
||||
className.toClass().buildOf<Activity>() ?: throw e
|
||||
className.toClass<Activity>().createInstanceOrNull() ?: throw e
|
||||
else throw e
|
||||
}
|
||||
|
||||
@@ -130,7 +129,7 @@ internal class InstrumentationDelegate private constructor(private val baseInsta
|
||||
override fun getTargetContext(): Context? = baseInstance.targetContext
|
||||
|
||||
override fun getProcessName(): String? =
|
||||
if (Build.VERSION.SDK_INT >= 26) baseInstance.processName else AppParasitics.systemContext.processName
|
||||
if (Build.VERSION.SDK_INT >= 26) baseInstance.processName else AppParasitics.systemContext?.processName
|
||||
|
||||
override fun isProfiling() = baseInstance.isProfiling
|
||||
|
||||
|
@@ -29,15 +29,11 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Message
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
import com.highcapable.yukihookapi.hook.log.YLog
|
||||
import com.highcapable.yukihookapi.hook.type.android.ActivityThreadClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.ClientTransactionClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.IBinderClass
|
||||
import com.highcapable.yukihookapi.hook.type.android.IntentClass
|
||||
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
||||
import com.highcapable.kavaref.extension.lazyClass
|
||||
import com.highcapable.yukihookapi.hook.core.api.reflect.AndroidHiddenApiBypassResolver
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.config.ActivityProxyConfig
|
||||
|
||||
@@ -52,6 +48,13 @@ internal object HandlerDelegateCaller {
|
||||
/** 执行事务处理 */
|
||||
private const val EXECUTE_TRANSACTION = 159
|
||||
|
||||
private val ActivityThreadClass by lazyClass("android.app.ActivityThread")
|
||||
private val ClientTransactionClass by lazyClass("android.app.servertransaction.ClientTransaction")
|
||||
|
||||
private val mExtrasResolver by lazy {
|
||||
Intent::class.resolve().optional().firstFieldOrNull { name = "mExtras" }
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用代理的 [Handler.Callback.handleMessage] 方法
|
||||
* @param baseInstance 原始实例
|
||||
@@ -60,41 +63,63 @@ internal object HandlerDelegateCaller {
|
||||
*/
|
||||
internal fun callHandleMessage(baseInstance: Handler.Callback?, msg: Message): Boolean {
|
||||
when (msg.what) {
|
||||
LAUNCH_ACTIVITY -> runCatching {
|
||||
msg.obj.current(ignored = true).field { name = "intent" }.apply {
|
||||
cast<Intent?>()?.also { intent ->
|
||||
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
||||
?.classLoader = AppParasitics.currentApplication?.classLoader
|
||||
LAUNCH_ACTIVITY -> {
|
||||
val intentResolver = msg.obj.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstFieldOrNull { name = "intent" }
|
||||
val intent = intentResolver?.get<Intent>()
|
||||
val mExtras = mExtrasResolver?.copy()?.of(intent)?.getQuietly<Bundle>()
|
||||
mExtras?.classLoader = AppParasitics.currentApplication?.classLoader
|
||||
@Suppress("DEPRECATION")
|
||||
if (intent?.hasExtra(ActivityProxyConfig.proxyIntentName) == true)
|
||||
intentResolver.set(intent.getParcelableExtra(ActivityProxyConfig.proxyIntentName))
|
||||
}
|
||||
EXECUTE_TRANSACTION -> {
|
||||
val callbacks = ClientTransactionClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull {
|
||||
name = "getCallbacks"
|
||||
}?.of(msg.obj)
|
||||
?.invokeQuietly<List<Any>>()
|
||||
?.takeIf { it.isNotEmpty() }
|
||||
callbacks?.filter { it.javaClass.name.contains("LaunchActivityItem") }?.forEach { item ->
|
||||
val itemResolver = item.resolve().optional()
|
||||
.firstFieldOrNull { name = "mIntent" }
|
||||
val intent = itemResolver?.get<Intent>()
|
||||
val mExtras = mExtrasResolver?.copy()?.of(intent)?.getQuietly<Bundle>()
|
||||
mExtras?.classLoader = AppParasitics.currentApplication?.classLoader
|
||||
if (intent?.hasExtra(ActivityProxyConfig.proxyIntentName) == true) {
|
||||
@Suppress("DEPRECATION")
|
||||
if (intent.hasExtra(ActivityProxyConfig.proxyIntentName))
|
||||
set(intent.getParcelableExtra(ActivityProxyConfig.proxyIntentName))
|
||||
val subIntent = intent.getParcelableExtra<Intent>(ActivityProxyConfig.proxyIntentName)
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
val currentActivityThread = ActivityThreadClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "currentActivityThread" }
|
||||
?.invoke()
|
||||
val token = msg.obj.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional()
|
||||
.firstMethodOrNull { name = "getActivityToken" }
|
||||
?.invokeQuietly()
|
||||
val launchingActivity = currentActivityThread?.resolve()
|
||||
?.processor(AndroidHiddenApiBypassResolver.get())
|
||||
?.optional()
|
||||
?.firstMethodOrNull {
|
||||
name = "getLaunchingActivity"
|
||||
parameters(IBinder::class)
|
||||
}?.invokeQuietly(token)
|
||||
launchingActivity?.resolve()
|
||||
?.processor(AndroidHiddenApiBypassResolver.get())
|
||||
?.optional()
|
||||
?.firstFieldOrNull { name = "intent" }
|
||||
?.set(subIntent)
|
||||
}; itemResolver.set(subIntent)
|
||||
}
|
||||
}
|
||||
}.onFailure { YLog.innerE("Activity Proxy got an exception in msg.what [$LAUNCH_ACTIVITY]", it) }
|
||||
EXECUTE_TRANSACTION -> msg.obj?.runCatching client@{
|
||||
ClientTransactionClass.method { name = "getCallbacks" }.ignored().get(this).list<Any?>().takeIf { it.isNotEmpty() }
|
||||
?.forEach { item ->
|
||||
item?.current(ignored = true)?.takeIf { it.name.contains("LaunchActivityItem") }?.field { name = "mIntent" }
|
||||
?.apply {
|
||||
cast<Intent?>()?.also { intent ->
|
||||
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
||||
?.classLoader = AppParasitics.currentApplication?.classLoader
|
||||
@Suppress("DEPRECATION")
|
||||
if (intent.hasExtra(ActivityProxyConfig.proxyIntentName))
|
||||
intent.getParcelableExtra<Intent>(ActivityProxyConfig.proxyIntentName).also { subIntent ->
|
||||
if (Build.VERSION.SDK_INT >= 31)
|
||||
ActivityThreadClass.method { name = "currentActivityThread" }.ignored().get().call()
|
||||
?.current(ignored = true)?.method {
|
||||
name = "getLaunchingActivity"
|
||||
param(IBinderClass)
|
||||
}?.call(this@client.current(ignored = true).method { name = "getActivityToken" }.call())
|
||||
?.current(ignored = true)?.field { name = "intent" }?.set(subIntent)
|
||||
set(subIntent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}?.onFailure { YLog.innerE("Activity Proxy got an exception in msg.what [$EXECUTE_TRANSACTION]", it) }
|
||||
}
|
||||
}
|
||||
return baseInstance?.handleMessage(msg) ?: false
|
||||
}
|
||||
|
@@ -27,11 +27,10 @@ package com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.call
|
||||
import android.app.Activity
|
||||
import android.app.ActivityManager
|
||||
import android.content.Intent
|
||||
import com.highcapable.yukihookapi.hook.factory.buildOf
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.extends
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
|
||||
import com.highcapable.kavaref.extension.createInstanceAsTypeOrNull
|
||||
import com.highcapable.kavaref.extension.hasClass
|
||||
import com.highcapable.kavaref.extension.isSubclassOf
|
||||
import com.highcapable.kavaref.extension.toClassOrNull
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppActivity
|
||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
|
||||
@@ -67,17 +66,19 @@ internal object IActivityManagerProxyCaller {
|
||||
*/
|
||||
if (component != null &&
|
||||
component.packageName == AppParasitics.currentPackageName &&
|
||||
component.className.hasClass()
|
||||
javaClass.classLoader?.hasClass(component.className) == true
|
||||
) args[index] = Intent().apply {
|
||||
/**
|
||||
* 验证类名是否存在
|
||||
* @return [String] or null
|
||||
*/
|
||||
fun String.verify() = if (hasClass(AppParasitics.hostApplication?.classLoader)) this else null
|
||||
fun String.verify() = if (AppParasitics.hostApplication?.classLoader?.hasClass(this) == true) this else null
|
||||
setClassName(component.packageName, component.className.toClassOrNull()?.runCatching {
|
||||
when {
|
||||
this extends classOf<ModuleAppActivity>() -> buildOf<ModuleAppActivity>()?.proxyClassName?.verify()
|
||||
this extends classOf<ModuleAppCompatActivity>() -> buildOf<ModuleAppCompatActivity>()?.proxyClassName?.verify()
|
||||
this isSubclassOf ModuleAppActivity::class ->
|
||||
createInstanceAsTypeOrNull<ModuleAppActivity>()?.proxyClassName?.verify()
|
||||
this isSubclassOf ModuleAppCompatActivity::class ->
|
||||
createInstanceAsTypeOrNull<ModuleAppCompatActivity>()?.proxyClassName?.verify()
|
||||
else -> null
|
||||
}
|
||||
}?.getOrNull() ?: ActivityProxyConfig.proxyClassName)
|
||||
|
Reference in New Issue
Block a user