From c8f1e3441e5c43c264dc5a822b95bc3a896e59f7 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Mon, 16 Jun 2025 17:05:06 +0800 Subject: [PATCH] refactor: big modified - update dependencies - migration reflection api to KavaRef - merge to new api usage --- docs-source/src/.vuepress/configs/template.ts | 7 +- docs-source/src/en/about/future.md | 7 +- docs-source/src/en/api/home.md | 8 + .../highcapable/yukihookapi/YukiHookAPI.md | 6 + .../xposed/InjectYukiHookWithXposed.md | 6 + .../yukihookapi/hook/bean/CurrentClass.md | 6 + .../yukihookapi/hook/bean/GenericClass.md | 6 + .../yukihookapi/hook/bean/HookClass.md | 6 + .../yukihookapi/hook/bean/VariousClass.md | 6 + .../hook/core/YukiMemberHookCreator.md | 6 + .../hook/core/YukiResourcesHookCreator.md | 6 + .../hook/core/api/compat/type/ExecutorType.md | 6 + .../core/api/priority/YukiHookPriority.md | 6 + .../hook/core/finder/base/BaseFinder.md | 6 + .../hook/core/finder/base/rules/CountRules.md | 6 + .../core/finder/base/rules/ModifierRules.md | 6 + .../hook/core/finder/base/rules/NameRules.md | 6 + .../core/finder/base/rules/ObjectRules.md | 6 + .../core/finder/classes/DexClassFinder.md | 6 + .../finder/classes/rules/ConstructorRules.md | 6 + .../core/finder/classes/rules/FieldRules.md | 6 + .../core/finder/classes/rules/MemberRules.md | 6 + .../core/finder/classes/rules/MethodRules.md | 6 + .../classes/rules/result/MemberRulesResult.md | 6 + .../core/finder/members/ConstructorFinder.md | 6 + .../hook/core/finder/members/FieldFinder.md | 6 + .../hook/core/finder/members/MethodFinder.md | 6 + .../yukihookapi/hook/entity/YukiBaseHooker.md | 6 + .../hook/factory/ReflectionFactory.md | 6 + .../hook/factory/YukiHookFactory.md | 6 + .../highcapable/yukihookapi/hook/log/YLog.md | 6 + .../yukihookapi/hook/log/data/YLogData.md | 6 + .../yukihookapi/hook/param/HookParam.md | 6 + .../yukihookapi/hook/param/PackageParam.md | 6 + .../hook/type/android/ComponentTypeFactory.md | 6 + .../hook/type/android/GraphicsTypeFactory.md | 6 + .../hook/type/android/ViewTypeFactory.md | 6 + .../hook/type/defined/DefinedTypeFactory.md | 6 + .../hook/type/java/VariableTypeFactory.md | 6 + .../xposed/application/ModuleApplication.md | 6 + .../xposed/bridge/event/YukiXposedEvent.md | 6 + .../bridge/resources/YukiModuleResources.md | 6 + .../bridge/resources/YukiResForwarder.md | 6 + .../xposed/bridge/resources/YukiResources.md | 6 + .../xposed/channel/YukiHookDataChannel.md | 6 + .../hook/xposed/channel/data/ChannelData.md | 6 + .../channel/priority/ChannelPriority.md | 6 + .../activity/base/ModuleAppActivity.md | 6 + .../activity/base/ModuleAppCompatActivity.md | 6 + .../wrapper/ModuleContextThemeWrapper.md | 6 + .../parasitic/reference/ModuleClassLoader.md | 6 + .../hook/xposed/prefs/YukiHookPrefsBridge.md | 6 + .../hook/xposed/prefs/data/PrefsData.md | 6 + .../prefs/ui/ModulePreferenceFragment.md | 6 + .../hook/xposed/proxy/IYukiHookXposedInit.md | 6 + .../en/api/special-features/host-inject.md | 16 +- .../src/en/api/special-features/logger.md | 8 + .../src/en/api/special-features/reflection.md | 26 +- docs-source/src/en/config/api-example.md | 38 +- docs-source/src/en/config/api-exception.md | 11 + .../src/en/config/move-to-api-1-2-x.md | 8 + .../src/en/config/move-to-api-1-3-x.md | 80 ++++ docs-source/src/en/guide/example.md | 89 +++-- docs-source/src/en/guide/home.md | 20 +- docs-source/src/en/guide/move-to-new-api.md | 15 +- docs-source/src/en/guide/quick-start.md | 138 ++++--- docs-source/src/en/guide/supportive.md | 24 +- docs-source/src/en/index.md | 4 +- docs-source/src/zh-cn/about/future.md | 6 +- docs-source/src/zh-cn/api/home.md | 6 + .../highcapable/yukihookapi/YukiHookAPI.md | 6 + .../xposed/InjectYukiHookWithXposed.md | 6 + .../yukihookapi/hook/bean/CurrentClass.md | 6 + .../yukihookapi/hook/bean/GenericClass.md | 6 + .../yukihookapi/hook/bean/HookClass.md | 6 + .../yukihookapi/hook/bean/VariousClass.md | 6 + .../hook/core/YukiMemberHookCreator.md | 6 + .../hook/core/YukiResourcesHookCreator.md | 6 + .../hook/core/api/compat/type/ExecutorType.md | 6 + .../core/api/priority/YukiHookPriority.md | 6 + .../hook/core/finder/base/BaseFinder.md | 6 + .../hook/core/finder/base/rules/CountRules.md | 6 + .../core/finder/base/rules/ModifierRules.md | 6 + .../hook/core/finder/base/rules/NameRules.md | 6 + .../core/finder/base/rules/ObjectRules.md | 6 + .../core/finder/classes/DexClassFinder.md | 6 + .../finder/classes/rules/ConstructorRules.md | 6 + .../core/finder/classes/rules/FieldRules.md | 6 + .../core/finder/classes/rules/MemberRules.md | 6 + .../core/finder/classes/rules/MethodRules.md | 6 + .../classes/rules/result/MemberRulesResult.md | 6 + .../core/finder/members/ConstructorFinder.md | 6 + .../hook/core/finder/members/FieldFinder.md | 6 + .../hook/core/finder/members/MethodFinder.md | 6 + .../yukihookapi/hook/entity/YukiBaseHooker.md | 6 + .../hook/factory/ReflectionFactory.md | 6 + .../hook/factory/YukiHookFactory.md | 6 + .../highcapable/yukihookapi/hook/log/YLog.md | 6 + .../yukihookapi/hook/log/data/YLogData.md | 6 + .../yukihookapi/hook/param/HookParam.md | 6 + .../yukihookapi/hook/param/PackageParam.md | 6 + .../hook/type/android/ComponentTypeFactory.md | 6 + .../hook/type/android/GraphicsTypeFactory.md | 6 + .../hook/type/android/ViewTypeFactory.md | 6 + .../hook/type/defined/DefinedTypeFactory.md | 6 + .../hook/type/java/VariableTypeFactory.md | 6 + .../xposed/application/ModuleApplication.md | 6 + .../xposed/bridge/event/YukiXposedEvent.md | 6 + .../bridge/resources/YukiModuleResources.md | 6 + .../bridge/resources/YukiResForwarder.md | 6 + .../xposed/bridge/resources/YukiResources.md | 6 + .../xposed/channel/YukiHookDataChannel.md | 6 + .../hook/xposed/channel/data/ChannelData.md | 6 + .../channel/priority/ChannelPriority.md | 6 + .../activity/base/ModuleAppActivity.md | 6 + .../activity/base/ModuleAppCompatActivity.md | 6 + .../wrapper/ModuleContextThemeWrapper.md | 6 + .../parasitic/reference/ModuleClassLoader.md | 6 + .../hook/xposed/prefs/YukiHookPrefsBridge.md | 6 + .../hook/xposed/prefs/data/PrefsData.md | 6 + .../prefs/ui/ModulePreferenceFragment.md | 6 + .../hook/xposed/proxy/IYukiHookXposedInit.md | 6 + .../zh-cn/api/special-features/host-inject.md | 18 +- .../src/zh-cn/api/special-features/logger.md | 6 + .../zh-cn/api/special-features/reflection.md | 25 +- docs-source/src/zh-cn/config/api-example.md | 40 +- docs-source/src/zh-cn/config/api-exception.md | 8 + .../src/zh-cn/config/move-to-api-1-2-x.md | 8 + .../src/zh-cn/config/move-to-api-1-3-x.md | 76 ++++ docs-source/src/zh-cn/guide/example.md | 86 ++-- docs-source/src/zh-cn/guide/home.md | 20 +- .../src/zh-cn/guide/move-to-new-api.md | 13 +- docs-source/src/zh-cn/guide/quick-start.md | 153 ++++--- docs-source/src/zh-cn/guide/supportive.md | 24 +- docs-source/src/zh-cn/index.md | 4 +- .../sweet-dependency-config.yaml | 13 +- yukihookapi-core/build.gradle.kts | 4 +- .../yukihookapi/hook/bean/CurrentClass.kt | 18 +- .../yukihookapi/hook/bean/GenericClass.kt | 4 + .../yukihookapi/hook/bean/HookClass.kt | 3 + .../yukihookapi/hook/bean/VariousClass.kt | 6 + .../hook/core/YukiMemberHookCreator.kt | 8 +- .../hook/core/annotation/LegacyHookApi.kt | 2 +- .../hook/core/api/compat/HookApiProperty.kt | 17 +- .../hook/core/api/helper/YukiHookHelper.kt | 18 +- .../reflect/AndroidHiddenApiBypassResolver.kt | 69 ++++ .../hook/core/api/reflect/KavaRefExtension.kt | 72 ++++ .../hook/core/finder/ReflectionMigration.kt | 34 ++ .../hook/core/finder/base/BaseFinder.kt | 14 +- .../hook/core/finder/base/ClassBaseFinder.kt | 4 + .../hook/core/finder/base/MemberBaseFinder.kt | 4 + .../core/finder/base/data/BaseRulesData.kt | 4 + .../hook/core/finder/base/rules/CountRules.kt | 8 +- .../core/finder/base/rules/ModifierRules.kt | 16 +- .../hook/core/finder/base/rules/NameRules.kt | 11 +- .../core/finder/base/rules/ObjectRules.kt | 4 +- .../core/finder/classes/DexClassFinder.kt | 46 ++- .../finder/classes/data/ClassRulesData.kt | 6 +- .../finder/classes/rules/ConstructorRules.kt | 11 +- .../core/finder/classes/rules/FieldRules.kt | 9 + .../core/finder/classes/rules/MemberRules.kt | 5 + .../core/finder/classes/rules/MethodRules.kt | 15 +- .../finder/classes/rules/base/BaseRules.kt | 4 + .../classes/rules/result/MemberRulesResult.kt | 8 +- .../core/finder/members/ConstructorFinder.kt | 40 +- .../hook/core/finder/members/FieldFinder.kt | 51 ++- .../hook/core/finder/members/MethodFinder.kt | 58 ++- .../members/data/ConstructorRulesData.kt | 4 + .../finder/members/data/FieldRulesData.kt | 4 + .../finder/members/data/MemberRulesData.kt | 4 + .../finder/members/data/MethodRulesData.kt | 4 + .../hook/core/finder/tools/ReflectionTool.kt | 4 +- .../finder/type/factory/TypeAliasFactory.kt | 13 + .../hook/factory/ReflectionFactory.kt | 44 ++- .../hook/factory/YukiHookFactory.kt | 4 +- .../highcapable/yukihookapi/hook/log/YLog.kt | 3 +- .../yukihookapi/hook/param/HookParam.kt | 8 +- .../yukihookapi/hook/param/PackageParam.kt | 178 +++++++-- .../hook/type/android/ComponentTypeFactory.kt | 129 +++++- .../hook/type/android/GraphicsTypeFactory.kt | 33 +- .../hook/type/android/ViewTypeFactory.kt | 65 ++- .../hook/type/defined/DefinedTypeFactory.kt | 7 + .../hook/type/java/VariableTypeFactory.kt | 120 +++++- .../hook/utils/factory/VariableFactory.kt | 2 +- .../xposed/application/ModuleApplication.kt | 9 - .../hook/xposed/bridge/YukiXposedModule.kt | 5 +- .../bridge/status/YukiXposedModuleStatus.kt | 26 +- .../hook/xposed/parasitic/AppParasitics.kt | 372 +++++++++++------- .../delegate/InstrumentationDelegate.kt | 13 +- .../delegate/caller/HandlerDelegateCaller.kt | 105 +++-- .../caller/IActivityManagerProxyCaller.kt | 19 +- 191 files changed, 2794 insertions(+), 583 deletions(-) create mode 100644 docs-source/src/en/config/move-to-api-1-3-x.md create mode 100644 docs-source/src/zh-cn/config/move-to-api-1-3-x.md create mode 100644 yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/AndroidHiddenApiBypassResolver.kt create mode 100644 yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/KavaRefExtension.kt create mode 100644 yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/ReflectionMigration.kt diff --git a/docs-source/src/.vuepress/configs/template.ts b/docs-source/src/.vuepress/configs/template.ts index 5d734769..d80220ca 100644 --- a/docs-source/src/.vuepress/configs/template.ts +++ b/docs-source/src/.vuepress/configs/template.ts @@ -17,6 +17,7 @@ const navigationLinks = { '/config/xposed-using', '/config/api-using', '/config/move-to-api-1-2-x', + '/config/move-to-api-1-3-x', '/config/r8-proguard' ], tools: '/tools/yukihookapi-projectbuilder', @@ -145,7 +146,8 @@ export const navBarItems = { { text: 'Use as Xposed Module Configs', link: i18n.string(navigationLinks.config[2], 'en') }, { text: 'Use as Hook API Configs', link: i18n.string(navigationLinks.config[3], 'en') }, { text: 'Migrate to YukiHookAPI 1.2.x', link: i18n.string(navigationLinks.config[4], 'en') }, - { text: 'R8 & Proguard Obfuscate', link: i18n.string(navigationLinks.config[5], 'en') } + { text: 'Migrate to YukiHookAPI 1.3.x', link: i18n.string(navigationLinks.config[5], 'en') }, + { text: 'R8 & Proguard Obfuscate', link: i18n.string(navigationLinks.config[6], 'en') } ] }, { text: 'Tools', @@ -196,7 +198,8 @@ export const navBarItems = { { text: '作为 Xposed 模块使用的相关配置', link: i18n.string(navigationLinks.config[2], 'zh-cn') }, { text: '作为 Hook API 使用的相关配置', link: i18n.string(navigationLinks.config[3], 'zh-cn') }, { text: '迁移到 YukiHookAPI 1.2.x', link: i18n.string(navigationLinks.config[4], 'zh-cn') }, - { text: 'R8 与 Proguard 混淆', link: i18n.string(navigationLinks.config[5], 'zh-cn') } + { text: '迁移到 YukiHookAPI 1.3.x', link: i18n.string(navigationLinks.config[5], 'zh-cn') }, + { text: 'R8 与 Proguard 混淆', link: i18n.string(navigationLinks.config[6], 'zh-cn') } ] }, { text: '工具', diff --git a/docs-source/src/en/about/future.md b/docs-source/src/en/about/future.md index de7233f5..ae00e602 100644 --- a/docs-source/src/en/about/future.md +++ b/docs-source/src/en/about/future.md @@ -34,7 +34,10 @@ If you like the Reflection API of `YukiHookAPI`, but your project may not need r Well here is some good news for you: -The core Reflection API of `YukiHookAPI` has been decoupled into [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can now be used in any Android project. +~~The core Reflection API of `YukiHookAPI` has been decoupled into [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can now be used in any Android project.~~ + +The `YukiReflection` project has been deprecated due to many unsolved black box issues, so we no longer recommend anyone to use it. +Please now migrate to the brand new design [KavaRef](https://github.com/HighCapable/KavaRef). ::: tip To be Discussed @@ -58,4 +61,4 @@ All functions are expected to be completed in `2.0.0` version, so stay tuned. - [New Xposed Module Config Plan](https://github.com/HighCapable/YukiHookAPI/issues/49) - [New Hook Entry Class](https://github.com/HighCapable/YukiHookAPI/issues/48) -- [New Hook Code Style](https://github.com/HighCapable/YukiHookAPI/issues/33) \ No newline at end of file +- ~~[New Hook Code Style](https://github.com/HighCapable/YukiHookAPI/issues/33)~~ (Replaced by [KavaRef](https://github.com/HighCapable/KavaRef)) \ No newline at end of file diff --git a/docs-source/src/en/api/home.md b/docs-source/src/en/api/home.md index 19a146c8..4820dc66 100644 --- a/docs-source/src/en/api/home.md +++ b/docs-source/src/en/api/home.md @@ -8,6 +8,14 @@ next: > The document here will synchronize the relevant usage of the latest API version, please keep `YukiHookAPI` as the latest version to use the latest version of the function. +::: warning + +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the +Dokka plugin in version `2.0.0`. +If you encounter unsolvable problems, you can contact us via [Contact Us](../about/contacts). + +::: + ## Function Description > The function description mainly introduces the related usage and purpose of the current API. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md index b057756c..d4c2ed9f 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md index 9d3403d0..b5781ea5 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md index 186fdd98..a812025f 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md index d0474b6f..503d1258 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md index 7a72a62c..58bf9498 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md index b77ed6fe..ab7e1fc9 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md index 68c8336f..e87aba7d 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md index f8060471..9beac634 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md index fbf29e18..d1e24246 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md index afa9b839..87e27457 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md index 3684ccb0..8411f407 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md index 33850652..f57bcde2 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md index 9d201070..ec2a5179 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md index 58fa3e4f..c291c766 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md index 942762e5..edbbb05e 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md index 84c9b64b..2d2c0582 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md index 1ad595d4..2a36bbdb 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md index 277e9d86..a477cc26 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md index 1b0b8209..d8a9cae6 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md index 75ae85e7..50cb7d61 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md index 1ae1e145..e6b0926c 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md index fef420a5..83d0e7ff 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md index ffa98de4..7d110d67 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md index 02687b60..5d58e3d0 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md index ff146827..651a826c 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md index d40266cd..d97ef2fc 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md index 3f151656..8c0a02ff 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/YLog.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/YLog.md index 2562f051..c379b267 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/YLog.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/YLog.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md index e282b260..f4f9d316 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md index 690db20c..60bb94b2 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md index 5a9e0417..81b94a38 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md index 6a959034..54d7cf38 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md index 58c37ddd..2c9a7bd4 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md index 55e78398..0cce35f8 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md index cd43f6da..3580f83a 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md index fa9857a6..0a4bcb79 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md index 24d7a67d..ef2880d3 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md index 59b46666..780d4e7e 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md index 1dbb1775..3732fd35 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md index d642bdd3..bbab8997 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md index cd14f008..51d48f84 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md index d365a8af..d8a02c3f 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md index 2d33e14d..a8b503d0 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md index 52883fa5..1f91f72f 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md index a7fb5c55..936b3114 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md index 0d7c1ee3..4b340dbb 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md index 4700385c..f50bd4d9 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md index 8500d322..484082fd 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md index a02b9a1d..02e85089 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md index ec97c7f5..0e5968d7 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md index 58b903db..e5b6d48b 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md index 2daa2c45..6b8143d1 100644 --- a/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md +++ b/docs-source/src/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md @@ -4,6 +4,12 @@ pageClass: code-page ::: warning +Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`. + +::: + +::: warning + The English translation of this page has not been completed, you are welcome to contribute translations to us. You can use the **Chrome Translation Plugin** to translate entire pages for reference. diff --git a/docs-source/src/en/api/special-features/host-inject.md b/docs-source/src/en/api/special-features/host-inject.md index e30e2d2f..8421d1ba 100644 --- a/docs-source/src/en/api/special-features/host-inject.md +++ b/docs-source/src/en/api/special-features/host-inject.md @@ -37,9 +37,9 @@ After the Host App is hooked, we can directly inject the `Context` obtained in t > The following example ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { instance().also { @@ -90,9 +90,9 @@ After the Host App is hooked, we can directly register the `Activity` proxy of t > The following example ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { instance().registerModuleAppActivities() @@ -236,9 +236,9 @@ At this time, we want to use `MaterialAlertDialogBuilder` to create a dialog in > The following example ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { // Use applyModuleTheme to create a theme resource in the current Module App @@ -260,9 +260,9 @@ Which requires at least Android 10 and above system version support and the curr > The following example ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { // Define the theme resource in the current Module App diff --git a/docs-source/src/en/api/special-features/logger.md b/docs-source/src/en/api/special-features/logger.md index ed1095a7..429da1a9 100644 --- a/docs-source/src/en/api/special-features/logger.md +++ b/docs-source/src/en/api/special-features/logger.md @@ -2,6 +2,14 @@ > Log is the most important part of the debugging process, `YukiHookAPI` encapsulates a set of stable and efficient debugging log functions for developers. +::: warning + +The log of `KavaRef` will be managed separately by itself. +For detailed configuration plans, you can refer to [here](https://highcapable.github.io/KavaRef/en/library/kavaref-core#exception-handling), +which will jump to the `KavaRef` document. + +::: + ## Normal Logs You can call `YLog.debug`, `YLog.info`, `YLog.warn` to print normal logs to the console. diff --git a/docs-source/src/en/api/special-features/reflection.md b/docs-source/src/en/api/special-features/reflection.md index a686dc10..5239ba89 100644 --- a/docs-source/src/en/api/special-features/reflection.md +++ b/docs-source/src/en/api/special-features/reflection.md @@ -1,12 +1,26 @@ -# Reflection Extensions +# Reflection Extensions (Migrated) > `YukiHookAPI` encapsulates a set of reflection API with near-zero reflection writing for developers, which can almost completely replace the usage of reflection API in Java. -The core part of this functionality has been decoupled into the [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can be used independently in any Java or Android project. +~~The core part of this functionality has been decoupled into the [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can be used independently in any Java or Android project.~~ -Now `YukiReflection` is integrated into `YukiHookAPI` as a core dependency. +~~Now `YukiReflection` is integrated into `YukiHookAPI` as a core dependency.~~ -`YukiHookAPI` adds related extensions for Hook functions on the basis of `YukiReflection`, and there is no need to introduce this dependency to use `YukiHookAPI`. +~~`YukiHookAPI` adds related extensions for Hook functions on the basis of `YukiReflection`, and there is no need to introduce this dependency to use `YukiHookAPI`.~~ + +::: warning + +Starting with version `1.3.0`, `YukiHookAPI` has moved its own reflection API partially to +[KavaRef](https://github.com/HighCapable/KavaRef), we no longer recommend the reflection API of `YukiHookAPI` itself, which have been marked as deprecated. + +The `YukiReflection` project has been deprecated due to many unsolved black box issues, and we no longer recommend anyone to use it. + +If you are still using the reflection API section of `YukiHookAPI`, +please refer to the migration document [here](https://highcapable.github.io/KavaRef/zh-cn/config/migration) which will jump to the `KavaRef` document. + +::: + +
## Class Extensions @@ -1958,4 +1972,6 @@ For more types, see [ComponentTypeFactory](../public/com/highcapable/yukihookapi ::: -At the same time, you are welcome to contribute more commonly used types. \ No newline at end of file +At the same time, you are welcome to contribute more commonly used types. + +
\ No newline at end of file diff --git a/docs-source/src/en/config/api-example.md b/docs-source/src/en/config/api-example.md index 886eb03b..7e27a41f 100644 --- a/docs-source/src/en/config/api-example.md +++ b/docs-source/src/en/config/api-example.md @@ -52,7 +52,8 @@ The `encase` method can be created in the `onHook` method using two schemes. YukiHookAPI.encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -67,7 +68,8 @@ YukiHookAPI.encase { encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -127,7 +129,8 @@ object CustomHooker : YukiBaseHooker() { override fun onHook() { loadApp(name = "com.example.demo1") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -135,7 +138,8 @@ object CustomHooker : YukiBaseHooker() { } loadApp(name = "com.example.demo2") { "$packageName.CustomClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -161,7 +165,8 @@ object ChildCustomHooker : YukiBaseHooker() { override fun onHook() { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -179,7 +184,8 @@ object FirstHooker : YukiBaseHooker() { override fun onHook() { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -254,7 +260,8 @@ In `YukiHookAPI`, these functions **are seamless**. encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -274,7 +281,7 @@ You can also use the `loadZygote` method to load the first event `initZygote` af ```kotlin encase { loadZygote { - ActivityClass.hook { + Activity::class.resolve().firstMethod { // Your code here. } // Create a Resources Hook in Zygote @@ -284,7 +291,8 @@ encase { } loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -324,7 +332,8 @@ Below are two **error** examples. encase { // Wrong usage, can't start Hook directly "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -357,7 +366,8 @@ object CustomHooker : YukiBaseHooker() { // Wrong method of use // Because there is no judgment object in the outer layer, you cannot start Hook directly "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -388,7 +398,8 @@ encase { loadHooker(CustomHooker) // ✅ Correct usage, Hook in app scope "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -418,7 +429,8 @@ object CustomHooker : YukiBaseHooker() { // it is necessary to judge the scope of the app before performing Hook loadApp(/** name parameter optional */) { "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. diff --git a/docs-source/src/en/config/api-exception.md b/docs-source/src/en/config/api-exception.md index 02a19d97..32b99088 100644 --- a/docs-source/src/en/config/api-exception.md +++ b/docs-source/src/en/config/api-exception.md @@ -8,6 +8,17 @@ pageClass: hidden-anchor-page The exception description here will only synchronize the latest API version, and the exception of the older API version will not be described again, please always keep the API version up-to-date. +::: warning + +Due to maintenance costs, `YukiHookAPI` will no longer update this document from the `1.3.0` version and there will be no new unspecified exceptions added here. +If you encounter unsolvable problems, you can contact us via [Contact Us](../about/contacts). + +The exception of `KavaRef` will be managed separately by itself. +For detailed configuration plans, you can refer to [here](https://highcapable.github.io/KavaRef/en/library/kavaref-core#exception-handling), +which will jump to the `KavaRef` document. + +::: + ## Non-Blocking Exceptions > These exceptions will not cause the app to stop running (FC), but will print `E` level logs on the console, and may also stop continuing to execute related functions. diff --git a/docs-source/src/en/config/move-to-api-1-2-x.md b/docs-source/src/en/config/move-to-api-1-2-x.md index 02b3fea8..eae42eeb 100644 --- a/docs-source/src/en/config/move-to-api-1-2-x.md +++ b/docs-source/src/en/config/move-to-api-1-2-x.md @@ -2,6 +2,14 @@ `YukiHookAPI` has undergone a lot of adjustments since version `1.2.0`, you can read on to see what are the notes and new features. +::: warning + +If you are using the YukiHookAPI previous version of `1.2.x`, it is recommended to refer to this document to migrate to the `1.2.x` version first. + +If you are using the `1.2.x` version of `YukiHookAPI`, please read directly [Migrate to YukiHookAPI 1.3.x](move-to-api-1-3-x) instead of this document. + +::: + ## Default Behavior Changes Since version `1.2.0`, the `isUsingResourcesHook` function in `@InjectYukiHookWithXposed` is no longer enabled by default, please enable it manually if necessary. diff --git a/docs-source/src/en/config/move-to-api-1-3-x.md b/docs-source/src/en/config/move-to-api-1-3-x.md new file mode 100644 index 00000000..a77561d0 --- /dev/null +++ b/docs-source/src/en/config/move-to-api-1-3-x.md @@ -0,0 +1,80 @@ +# Migrate to YukiHookAPI 1.3.x + +`YukiHookAPI` has deprecated its own reflection API since `1.3.0`, you can read on to see what are the notes and new features. + +::: warning + +If you are using `1.2.x` and previous versions of `YukiHookAPI`, it is recommended to read [Migrate to YukiHookAPI 1.2.x](move-to-api-1-2-x) instead of this document. + +::: + +## Self-reflection API Deprecated + +`YukiHookAPI` has deprecated its own reflection API since the `1.3.0` version. Now we recommend that all developers move to a brand new development. +[KavaRef](https://github.com/HighCapable/KavaRef), we no longer recommend the reflection API of `YukiHookAPI` itself, which have been marked as deprecated. + +Please refer to the migration document [here](https://highcapable.github.io/KavaRef/en/config/migration) which will jump to the `KavaRef` document. + +`YukiHookAPI` has now implemented complete decoupling of the reflection API. +The reflection API used by its internal API has also been migrated to `KavaRef` and has been tested stably. + +In later versions of `2.0.0`, the self-reflection API will be completely removed, +during which time you will have enough time to learn and migrate to this brand new set of reflection APIs. + +## FreeReflection Deprecated + +`YukiHookAPI` has deprecated [FreeReflection](https://github.com/tiann/FreeReflection) since the `1.3.0` version and migrated to a maintained by the LSPosed team +[AndroidHiddenApiBypass](https://github.com/LSPosed/AndroidHiddenApiBypass). + +When the reflection system hides the API, you cannot reflect directly like before, but need to do some operations. + +YukiHookAPI has built-in `AndroidHiddenApiBypassResolver` in `KavaRef`'s third-party Member parser, +and now you can use it like this where you need the reflection system to hide the API. + +> The following example + +```kotlin +"android.app.ActivityThread".toClass() + .resolve() + // Add a custom Member parser + .processor(AndroidHiddenApiBypassResolver.get()) + .firstMethod { + name = "currentActivityThread" + emptyParameters() + }.invoke() +``` + +::: warning + +`AndroidHiddenApiBypassResolver` is a tentative feature and may be migrated to a separate module in the `2.0.0` version, +you can also refer to [Third-party Member Resolvers](https://highcapable.github.io/KavaRef/en/config/processor-resolvers) implement one by yourself, +which will jump to the `KavaRef` document. + +::: + +## Original Method Call + +`Xposed` provides the `XposedBridge.invokeOriginalMethod` function, which can call original methods without a Hook. + +Due to deprecation of the self-reflection API, the method `method { ... }.get().original().call(...)` will no longer be available. + +So, YukiHookAPI has added an extension to `KavaRef`, and you can still implement this feature now. + +`YukiHookAPI` provides the following methods to connect to the original method calls of `KavaRef`. + +- `invokeOriginal(...)` → `invoke(...)` +- `invokeOriginalQuietly(...)` → `invokeQuietly(...)` + +> The following example + +```kotlin +// Suppose this is an instance of the Test class +val instance: Any +// Original call to the method using KavaRef +"com.example.Test".toClass() + .resolve() + .firstMethod { + name = "test" + emptyParameters() + }.of(instance).invokeOriginal() +``` \ No newline at end of file diff --git a/docs-source/src/en/guide/example.md b/docs-source/src/en/guide/example.md index 514a8212..51f8413a 100644 --- a/docs-source/src/en/guide/example.md +++ b/docs-source/src/en/guide/example.md @@ -33,7 +33,25 @@ Host Environment > The above structure can be written in the following form in code. ```kotlin -// New version +// KavaRef +TargetClass.resolve().firstMethod { + // Your code here. +}.hook { + before { + // Your code here. + } + after { + // Your code here. + } +} +``` + +
+ +Click to view the previous writing method + +```kotlin +// Old version (1.2.x-1.3.0 (Not included)) TargetClass.method { // Your code here. }.hook { @@ -58,6 +76,11 @@ TargetClass.hook { } } } +``` + +
+ +```kotlin // Resources Hook (2.0.0 will be discontinued) resources().hook { injectResource { @@ -83,6 +106,14 @@ Install the Host App and Module App Demo at the same time, and test the hooked f > Here are examples of Hook App, Hook System Framework and Hook Resources for reference. +::: tip + +Starting with version `1.3.0`, YukiHookAPI has moved its own reflection API partially to +[KavaRef](https://github.com/HighCapable/KavaRef), the reflection APIs in the demonstration section below use the `KavaRef` writing method. +We no longer recommend using the `YukiHookAPI`'s own reflection API. + +::: + ### Hook App Suppose, we want to hook the `onCreate` method in `com.android.browser` and show a dialog. @@ -93,10 +124,9 @@ Add code in the body of the `encase` method. ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { AlertDialog.Builder(instance()) @@ -113,17 +143,16 @@ At this point, the `onCreate` method will be successfully hooked and this dialog So, what should I do if I want to continue the Hook `onStart` method? -We can use Kotlin's `apply` method on `ActivityClass` to create a call space. +We can use Kotlin's `apply` method on `Activity::class.resolve()` to create a call space. > The following example ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.apply { - method { + Activity::class.resolve().apply { + firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { AlertDialog.Builder(instance()) @@ -133,10 +162,9 @@ loadApp(name = "com.android.browser") { .show() } } - method { + firstMethod { name = "onStart" - emptyParam() - returnType = UnitType + emptyParameters() }.hook { after { // Your code here. @@ -154,7 +182,8 @@ For example, I want to get `com.example.demo.TestClass`. ```kotlin "com.example.demo.TestClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -167,7 +196,8 @@ If `com.example.demo` is the app you want to hook, then the writing method can b ```kotlin "$packageName.TestClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -187,7 +217,7 @@ val TestClass by lazyClass("com.example.demo.TestClass") Use it when appropriate. ```kotlin -TestClass.method { +TestClass.resolve().firstMethod { // Your code here. }.hook { // Your code here. @@ -212,10 +242,9 @@ Add code in the body of the `encase` method. ```kotlin loadZygote { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { // Your code here. @@ -242,12 +271,12 @@ Add code in the body of the `encase` method. ```kotlin loadSystem { - ApplicationInfoClass.method { + ApplicationInfo::class.resolve().firstMethod { // Your code here. }.hook { // Your code here. } - PackageInfoClass.method { + PackageInfo::class.resolve().firstMethod { // Your code here. }.hook { // Your code here. @@ -341,9 +370,9 @@ The first way, save the `Result` instance of the current injected object, and ca ```kotlin // Set a variable to save the current instance val hookResult = - method { + resolve().firstMethod { name = "test" - returnType = UnitType + returnType = Void.TYPE }.hook { after { // ... @@ -358,9 +387,9 @@ The second method, call `removeSelf` in the Hook callback method to remove itsel > The following example ```kotlin -method { +resolve().firstMethod { name = "test" - returnType = UnitType + returnType = Void.TYPE }.hook { after { // Just call the following method directly @@ -427,7 +456,7 @@ TargetClass.hook { } ``` -You can also handle exceptions when looking up methods. +**(Applicable to older versions)** You can also handle exceptions when looking up methods. > The following example @@ -447,6 +476,14 @@ For more functions, please refer to [MemberHookCreator.Result](../api/public/com Common exceptions that may occur are described here. For more information, please refer to [API Exception Handling](../config/api-exception). +::: warning + +The exception of `KavaRef` will be managed separately by itself. +For detailed configuration plans, you can refer to [here](https://highcapable.github.io/KavaRef/en/library/kavaref-core#exception-handling), +which will jump to the `KavaRef` document. + +::: + ### Throw an Exception In some cases, you can **manually throw exceptions** to alert some functionality that there is a problem. @@ -593,7 +630,7 @@ You can also abbreviate the `hook { ... }` method body when you only need a Hook > The following example ```kotlin -ActivityClass.method { +Activity::class.resolve().firstMethod { // Your code here. }.hook().after { // Your code here. diff --git a/docs-source/src/en/guide/home.md b/docs-source/src/en/guide/home.md index 2f079ff2..2faa7f39 100644 --- a/docs-source/src/en/guide/home.md +++ b/docs-source/src/en/guide/home.md @@ -22,8 +22,6 @@ Please use Kotlin, the framework part of the code composition is also compatible All demo code in this document will be described using Kotlin, if you don't know how to use Kotlin then you may not be able to use `YukiHookAPI`. -Part of the Java Demo code can be found [here](https://github.com/HighCapable/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java), but not recommended. - ## Source of Inspiration Previously, when we built an Xposed Module, we first needed to create an `xposed_init` file under `assets`. @@ -51,9 +49,9 @@ object HookEntry : IYukiHookXposedInit { override fun onHook() = encase { loadZygote { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. @@ -64,9 +62,9 @@ object HookEntry : IYukiHookXposedInit { } } loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. @@ -129,4 +127,12 @@ class HookEntry : IXposedHookZygoteInit, IXposedHookLoadPackage { Yes, you read that right, just needing these codes can completely replace the traditional Xposed API to achieve the same function. -Now, with the help of the efficient and powerful `YukiHookAPI`, you can implement a very simple Xposed Module. \ No newline at end of file +Now, with the help of the efficient and powerful `YukiHookAPI`, you can implement a very simple Xposed Module. + +::: tip + +Starting with version `1.3.0`, `YukiHookAPI` has migrated its own reflection API part to [KavaRef](https://github.com/HighCapable/KavaRef) (including the reflection API part demonstrated above). + +Now, you can make the `YukiHookAPI` more easy to use with the powerful reflection ability of `KavaRef`. + +::: \ No newline at end of file diff --git a/docs-source/src/en/guide/move-to-new-api.md b/docs-source/src/en/guide/move-to-new-api.md index 515a7d5e..f046f6b2 100644 --- a/docs-source/src/en/guide/move-to-new-api.md +++ b/docs-source/src/en/guide/move-to-new-api.md @@ -31,9 +31,10 @@ override fun onHook() = encase { loadApp(name = "com.demo.test") { // Member Hook "com.demo.test.TestClass".toClass() - .method { + .resolve() + .firstMethod { name = "test" - param(BooleanType) + parameters(Boolean::class) }.hook { after { // ... @@ -268,6 +269,16 @@ Here is a guide to avoid common pitfalls. Methods like `XposedHelpers.callMethod` and `XposedHelpers.callStaticMethod` automatically search and invoke all public methods (including those in superclasses), which is a feature of native Java reflection. In contrast, the reflection solution provided by `YukiHookAPI` first searches and then calls, and by default, the search process does not automatically look for methods in superclasses. +::: warning + +The reflection API of `YukiHookAPI` itself has been deprecated in `1.3.0` version. +The following content is only used as migration guidelines before `1.3.0` version, we will retain it but will not update the content again. + +You can migrate to [KavaRef](https://github.com/HighCapable/KavaRef), and this feature is also applicable to `KavaRef`. + +::: + + For example, class `A` inherits from `B`, and `B` has a public method `test`, while `A` does not. ```java diff --git a/docs-source/src/en/guide/quick-start.md b/docs-source/src/en/guide/quick-start.md index 4a028cab..3c92abc7 100644 --- a/docs-source/src/en/guide/quick-start.md +++ b/docs-source/src/en/guide/quick-start.md @@ -2,23 +2,15 @@ > Integrate `YukiHookAPI` into your project. -## Environment Requirements +## Project Requirements -- Windows 7 and above / macOS 10.14 and above / Linux distributions (Arch/Debian) +The project needs to be created using `Android Studio` or `IntelliJ IDEA` and be of type Android project and have integrated Kotlin environment dependencies. -- Android Studio 2021.1 and above +- Android Studio (It is recommended to get the latest version [from here](https://developer.android.com/studio)) -- IntelliJ IDEA 2021.1 and above +- IntelliJ IDEA (It is recommended to get the latest version [from here](https://www.jetbrains.com/idea)) -- Kotlin 1.7.0 and above - -- Android Gradle Plugin 7.0 and above - -- Gradle 7.0 and above - -- Java 11 and above (Since API `1.0.80`) - -- Java 17 and above (Since API `1.2.0`) +- Kotlin 1.9.0+, Gradle 8+, Java 11, 17+, Android Gradle Plugin 8+ ## Automatically Build Project @@ -49,9 +41,6 @@ repositories: # Must be added when used as an Xposed Module, otherwise optional rovo89-xposed-api: url: https://api.xposed.info/ - # MavenCentral has a 2-hour cache, - # if the latest version cannot be integrated, please add this - sonatype-oss-releases: plugins: # Must be added when used as an Xposed Module, otherwise optional @@ -72,6 +61,13 @@ libraries: # Must be added when used as an Xposed Module, otherwise optional ksp-xposed: version-ref: ::api + # YukiHookAPI version 1.3.0 uses KavaRef as core reflection API + # YukiHookAPI no longer binds its own reflection API, you can start trying to use KavaRef + com.highcapable.kavaref: + kavaref-core: + version: + + kavaref-extension: + version: + ... ``` @@ -97,6 +93,9 @@ Then, deploy dependencies in your project `build.gradle.kts`. dependencies { // Basic dependencies implementation(com.highcapable.yukihookapi.api) + // It is recommended to use KavaRef as the core reflection API + implementation(com.highcapable.kavaref.kavaref.core) + implementation(com.highcapable.kavaref.kavaref.extension) // Must be added when used as an Xposed Module, otherwise optional compileOnly(de.robv.android.xposed.api) // Must be added when used as an Xposed Module, otherwise optional @@ -104,9 +103,9 @@ dependencies { } ``` -#### Traditional Method +#### Version Catalog -Add repositories in your project `build.gradle.kts` or `build.gradle`. +Add repositories in your project `build.gradle.kts`. > Kotlin DSL @@ -116,25 +115,81 @@ repositories { mavenCentral() // Must be added when used as an Xposed Module, otherwise optional maven { url("https://api.xposed.info/") } - // MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL - maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") } } ``` -> Groovy DSL +Add dependency in your project's `gradle/libs.versions.toml`. -```groovy +> The following example + +```toml +[versions] +yukihookapi = "" +ksp = "" +kavaref-core = "" +kavaref-extension = "" + +[plugins] +# Must be added when used as an Xposed Module, otherwise optional +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } + +[libraries] +yukihookapi-api = { module = "com.highcapable.yukihookapi:api", version.ref = "yukihookapi" } +# Must be added when used as an Xposed Module, otherwise optional +yukihookapi-ksp-xposed = { module = "com.highcapable.yukihookapi:ksp-xposed", version.ref = "yukihookapi" } +# YukiHookAPI version 1.3.0 uses KavaRef as core reflection API +# YukiHookAPI no longer binds its own reflection API, you can start trying to use KavaRef +kavaref-core = { module = "com.highcapable.kavaref:kavaref-core", version.ref = "kavaref-core" } +kavaref-extension = { module = "com.highcapable.kavaref:kavaref-extension", version.ref = "kavaref-extension" } +# Must be added when used as an Xposed Module, otherwise optional +xposed-api = { module = "de.robv.android.xposed:api", version = "82" } +``` + +Next, deploy plugins in your project `build.gradle.kts`. + +> Kotlin DSL + +```kotlin +plugins { + // Must be added when used as an Xposed Module, otherwise optional + alias(libs.plugins.ksp) +} +``` + +Then, deploy dependencies in your project `build.gradle.kts`. + +> Kotlin DSL + +```kotlin +dependencies { + // Basic dependency + implementation(libs.yukihookapi.api) + // It is recommended to use KavaRef as the core reflection API + implementation(libs.kavaref.core) + implementation(libs.kavaref.extension) + // Must be added when used as an Xposed Module, otherwise optional + compileOnly(libs.xposed.api) + // Must be added when used as an Xposed Module, otherwise optional + ksp(libs.yukihookapi.ksp.xposed) +} +``` + +#### Traditional Method + +Add repositories in your project `build.gradle.kts`. + +> Kotlin DSL + +```kotlin repositories { google() mavenCentral() // Must be added when used as an Xposed Module, otherwise optional - maven { url 'https://api.xposed.info/' } - // MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL - maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } + maven { url("https://api.xposed.info/") } } ``` -Add plugins in your project `build.gradle.kts` or `build.gradle`. +Add plugins in your project `build.gradle.kts`. > Kotlin DSL @@ -145,16 +200,7 @@ plugins { } ``` -> Groovy DSL - -```groovy -plugins { - // Must be added when used as an Xposed Module, otherwise optional - id 'com.google.devtools.ksp' version '' -} -``` - -Add dependencies in your project `build.gradle.kts` or `build.gradle`. +Add dependencies in your project `build.gradle.kts`. > Kotlin DSL @@ -162,6 +208,9 @@ Add dependencies in your project `build.gradle.kts` or `build.gradle`. dependencies { // Basic dependency implementation("com.highcapable.yukihookapi:api:") + // It is recommended to use KavaRef as the core reflection API + implementation("com.highcapable.kavaref:kavaref-core:") + implementation("com.highcapable.kavaref:kavaref-extension:") // Must be added when used as an Xposed Module, otherwise optional compileOnly("de.robv.android.xposed:api:82") // Must be added when used as an Xposed Module, otherwise optional @@ -169,29 +218,16 @@ dependencies { } ``` -> Groovy DSL - -```groovy -dependencies { - // Basic dependency - implementation 'com.highcapable.yukihookapi:api:' - // Must be added when used as an Xposed Module, otherwise optional - compileOnly 'de.robv.android.xposed:api:82' - // Must be added when used as an Xposed Module, otherwise optional - ksp 'com.highcapable.yukihookapi:ksp-xposed:' -} -``` - Please modify **<ksp-version>** to the latest version found [here](https://github.com/google/ksp/releases) **(please note to select your current corresponding Kotlin version)**. Please change **<yuki-version>** to the latest version [here](../about/changelog). +Please change **<kavaref-version>** to the latest version [here](https://highcapable.github.io/KavaRef/en/about/changelog). + :::danger The **api** and **ksp-xposed** dependency versions of **YukiHookAPI** must correspond one-to-one, otherwise a version mismatch error will occur. -We recommend using [SweetDependency](https://github.com/HighCapable/SweetDependency) to autowire dependencies for you. - ::: #### Configure Java Version diff --git a/docs-source/src/en/guide/supportive.md b/docs-source/src/en/guide/supportive.md index b7848793..a4fd66cb 100644 --- a/docs-source/src/en/guide/supportive.md +++ b/docs-source/src/en/guide/supportive.md @@ -4,22 +4,22 @@ The following are the related functions, Xposed Frameworks, Hook Frameworks and > Basic Functions -| Name | ST | Description | -| -------------------------- | --- | ------------------------------------------------------------------------------------------------------------------ | +| Name | ST | Description | +| -------------------------- | --- | ----------------------------------------------------------------------------------------------------------------------- | | Xposed Module Auto Builder | ✅ | Will use [New Xposed Module Config Plan](https://github.com/HighCapable/YukiHookAPI/issues/49) on `YukiHookAPI` `2.0.0` | -| ART Dynamic Method Hook | ✅ | Stable use in multiple scenarios | -| Xposed Resources Hook | ❗ | Supported, but will be deprecated on `YukiHookAPI` `2.0.0` | +| ART Dynamic Method Hook | ✅ | Stable use in multiple scenarios | +| Xposed Resources Hook | ❗ | Supported, but will be removed on `YukiHookAPI` `2.0.0` | > Extended Functions -| Name | ST | Description | -| -------------------------------------------------------------------------------------------------- | --- | ------------------------------------------------------------------------------------------------------ | -| [Reflection Extensions](../api/special-features/reflection) | ⭕ | Will be merge into [YukiReflection](https://github.com/HighCapable/YukiReflection) on `YukiHookAPI` `2.0.0` | -| [Xposed Module Data Storage](../api/special-features/xposed-storage) | ✅ | Normal use | -| [Xposed Module and Host Channel](../api/special-features/xposed-channel) | ✅ | Normal use | -| [Host Lifecycle Extension](../api/special-features/host-lifecycle) | ✅ | Normal use | -| [Inject Module Apps Resources](../api/special-features/host-inject#inject-module-apps-resources) | ✅ | Normal use | -| [Register Module Apps Activity](../api/special-features/host-inject#register-module-apps-activity) | ✅ | Normal use | +| Name | ST | Description | +| -------------------------------------------------------------------------------------------------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| ~~[Reflection Extensions](../api/special-features/reflection)~~ | ❗ | Completely deprecated, recommended to migrate to [KavaRef](https://github.com/HighCapable/KavaRef), planned `YukiHookAPI` `2.0.0` version removed | +| [Xposed Module Data Storage](../api/special-features/xposed-storage) | ✅ | Normal use | +| [Xposed Module and Host Channel](../api/special-features/xposed-channel) | ✅ | Normal use | +| [Host Lifecycle Extension](../api/special-features/host-lifecycle) | ✅ | Normal use | +| [Inject Module Apps Resources](../api/special-features/host-inject#inject-module-apps-resources) | ✅ | Normal use | +| [Register Module Apps Activity](../api/special-features/host-inject#register-module-apps-activity) | ✅ | Normal use | > Xposed Frameworks diff --git a/docs-source/src/en/index.md b/docs-source/src/en/index.md index d06dd09a..dd85e999 100644 --- a/docs-source/src/en/index.md +++ b/docs-source/src/en/index.md @@ -29,9 +29,9 @@ footer: Apache-2.0 License | Copyright (C) 2019 HighCapable ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. diff --git a/docs-source/src/zh-cn/about/future.md b/docs-source/src/zh-cn/about/future.md index 580d4be9..6fb0002c 100644 --- a/docs-source/src/zh-cn/about/future.md +++ b/docs-source/src/zh-cn/about/future.md @@ -34,7 +34,9 @@ LSPosed 现已实验性推出了 [Modern Xposed API](https://github.com/libxpose 那么这里有一个好消息要告诉你: -`YukiHookAPI` 的核心反射 API 已被解耦合为 [YukiReflection](https://github.com/HighCapable/YukiReflection) 项目,它现在能在任何 Android 项目中使用。 +~~`YukiHookAPI` 的核心反射 API 已被解耦合为 [YukiReflection](https://github.com/HighCapable/YukiReflection) 项目,它现在能在任何 Android 项目中使用。~~ + +`YukiReflection` 项目由于很多未能解决的黑盒问题已被弃用,我们不再推荐任何人使用它,现在请迁移到全新设计的 [KavaRef](https://github.com/HighCapable/KavaRef)。 ::: tip 待讨论 @@ -52,4 +54,4 @@ API 已经提供了 Xposed 原生 API 监听接口,你可以 [在这里](../co - [New Xposed Module Config Plan](https://github.com/HighCapable/YukiHookAPI/issues/49) - [New Hook Entry Class](https://github.com/HighCapable/YukiHookAPI/issues/48) -- [New Hook Code Style](https://github.com/HighCapable/YukiHookAPI/issues/33) \ No newline at end of file +- ~~[New Hook Code Style](https://github.com/HighCapable/YukiHookAPI/issues/33)~~ (已由 [KavaRef](https://github.com/HighCapable/KavaRef) 取代) \ No newline at end of file diff --git a/docs-source/src/zh-cn/api/home.md b/docs-source/src/zh-cn/api/home.md index fa5af6e6..feddf474 100644 --- a/docs-source/src/zh-cn/api/home.md +++ b/docs-source/src/zh-cn/api/home.md @@ -8,6 +8,12 @@ next: > 这里的文档将同步最新 API 版本的相关用法,请保持 `YukiHookAPI` 为最新版本以使用最新版本的功能。 +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档,如遇到无法解决的问题,你可以通过 [联系我们](../about/contacts) 与我们联系。 + +::: + ## 功能描述说明 > 功能描述主要介绍当前 API 的相关用法和用途。 diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/YukiHookAPI.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/YukiHookAPI.md index e2f7a561..f7f37401 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/YukiHookAPI.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/YukiHookAPI.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiHookAPI - object ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md index 009933bf..c2e64c1a 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # InjectYukiHookWithXposed - annotation ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md index cc8eddef..9ea8031e 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # CurrentClass - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md index e0a00692..3f99d7ef 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # GenericClass - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md index 67e198c2..2c38986c 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # HookClass - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md index 5d176cce..d6898f06 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # VariousClass - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md index 0d203b72..9dc798d1 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiMemberHookCreator - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md index cccccbec..f97c50ec 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiResourcesHookCreator - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md index dd3d654a..8885e5d7 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ExecutorType - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md index 6f33ec19..2db22fa8 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiHookPriority - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md index 3d13071c..64f5c125 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # BaseFinder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md index 1c0cfc11..1160a2fe 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # CountRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md index e15bac47..e6afb419 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModifierRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md index 78abdbf5..e1d80173 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # NameRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md index c0f505b0..81bf7b06 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ObjectRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md index e63d4a7c..57a19664 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # DexClassFinder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md index 4f1892ac..796bbd80 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ConstructorRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md index b3a69bfc..8d99db43 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # FieldRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md index 4be49f48..07c285d9 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # MemberRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md index 47fdcb2f..2319f798 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # MethodRules - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md index c994730a..7b0bbd06 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # MemberRulesResult - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md index 94d4e7d0..0722af63 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ConstructorFinder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md index 07763c0e..977ccf73 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # FieldFinder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md index e31ad14a..ba227ff3 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # MethodFinder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md index c13d36ae..54cfe520 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiBaseHooker - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md index 71c60c36..95278040 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ReflectionFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md index 5a7e671c..eb53ed73 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiHookFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/YLog.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/YLog.md index 0716b436..bc90b38a 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/YLog.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/YLog.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YLog - object ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md index 2bdd6a14..7a86bb67 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/log/data/YLogData.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YLogData - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md index 4f2de3e1..1cdc201d 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/HookParam.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # HookParam - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md index 593c8484..b86a65e0 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # PackageParam - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md index 558311e8..d2500ee1 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ComponentTypeFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md index 8fe1c348..71bb2fe6 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # GraphicsTypeFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md index 5467903e..c5bf6512 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ViewTypeFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md index 83d675cd..5739a5c2 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # DefinedTypeFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md index 1d29004e..d35cf321 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # VariableTypeFactory - kt **变更记录** diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md index c99a9dce..2804f2fe 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModuleApplication - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md index ca1f7196..0ae6d0f2 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiXposedEvent - object ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md index 27cf91ea..5ac7918e 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiModuleResources - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md index f932d281..fc191ab7 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiResForwarder - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md index 2be9e709..15a66849 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiResources - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md index ffa4442b..b5b980b3 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiHookDataChannel - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md index 71dc977a..b980113c 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ChannelData - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md index c4beef9b..4798b2dc 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ChannelPriority - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md index 48b16b78..04091a10 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModuleAppActivity - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md index 217842ec..189c34ad 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModuleAppCompatActivity - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md index ad52e9b5..cb54fba7 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModuleContextThemeWrapper - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md index ee8750c6..73f09a07 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModuleClassLoader - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md index f6b65012..ac6894b1 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # YukiHookPrefsBridge - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md index 8cd2dd56..9b311098 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # PrefsData - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md index f40d4940..50a5b94a 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # ModulePreferenceFragment - class ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md index 16c6c485..e704ae90 100644 --- a/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md +++ b/docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.md @@ -2,6 +2,12 @@ pageClass: code-page --- +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且在 `2.0.0` 版本切换为 Dokka 插件自动生成的 API 文档。 + +::: + # IYukiHookXposedInit - interface ```kotlin:no-line-numbers diff --git a/docs-source/src/zh-cn/api/special-features/host-inject.md b/docs-source/src/zh-cn/api/special-features/host-inject.md index d2388213..4c316810 100644 --- a/docs-source/src/zh-cn/api/special-features/host-inject.md +++ b/docs-source/src/zh-cn/api/special-features/host-inject.md @@ -35,9 +35,9 @@ android { > 示例如下 ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { instance().also { @@ -86,9 +86,9 @@ onAppLifecycle { > 示例如下 ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { instance().registerModuleAppActivities() @@ -227,9 +227,9 @@ The style on this component requires your app theme to be Theme.AppCompat (or a > 示例如下 ```kotlin -method { - name = "onCreate" - param(BundleClass) +resolve().firstMethod { + name = "onCreate" + parameters(Bundle::class) }.hook { after { // 使用 applyModuleTheme 创建一个当前模块中的主题资源 @@ -249,9 +249,9 @@ method { > 示例如下 ```kotlin -method { +resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { after { // 定义当前模块中的主题资源 diff --git a/docs-source/src/zh-cn/api/special-features/logger.md b/docs-source/src/zh-cn/api/special-features/logger.md index 136f907d..59f261d8 100644 --- a/docs-source/src/zh-cn/api/special-features/logger.md +++ b/docs-source/src/zh-cn/api/special-features/logger.md @@ -2,6 +2,12 @@ > 日志是调试过程最重要的一环,`YukiHookAPI` 为开发者封装了一套稳定高效的调试日志功能。 +::: warning + +`KavaRef` 的日志将由其自身单独管理,详细的配置方案你可以参考 [这里](https://highcapable.github.io/KavaRef/zh-cn/library/kavaref-core#%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86),这将跳转到 `KavaRef` 的文档。 + +::: + ## 普通日志 你可以调用 `YLog.debug`、`YLog.info`、`YLog.warn` 来向控制台打印普通日志。 diff --git a/docs-source/src/zh-cn/api/special-features/reflection.md b/docs-source/src/zh-cn/api/special-features/reflection.md index d1698c0e..0a8ad3b7 100644 --- a/docs-source/src/zh-cn/api/special-features/reflection.md +++ b/docs-source/src/zh-cn/api/special-features/reflection.md @@ -1,12 +1,25 @@ -# 字节码与反射扩展 +# 字节码与反射扩展 (已迁移) > `YukiHookAPI` 为开发者封装了一套接近零反射写法的反射 API,它几乎可以完全取代原生 Java 的反射 API 相关用法。 -此功能的核心部分已被解耦合为 [YukiReflection](https://github.com/HighCapable/YukiReflection) 项目,它可以独立使用于任何 Java、Android 项目中。 +~~此功能的核心部分已被解耦合为 [YukiReflection](https://github.com/HighCapable/YukiReflection) 项目,它可以独立使用于任何 Java、Android 项目中。~~ -现在 `YukiReflection` 作为核心依赖集成于 `YukiHookAPI`。 +~~现在 `YukiReflection` 作为核心依赖集成于 `YukiHookAPI`。~~ -`YukiHookAPI` 在 `YukiReflection` 的基础上加入了针对 Hook 功能的相关扩展,使用 `YukiHookAPI` 无需引入此依赖。 +~~`YukiHookAPI` 在 `YukiReflection` 的基础上加入了针对 Hook 功能的相关扩展,使用 `YukiHookAPI` 无需引入此依赖。~~ + +::: warning + +从 `1.3.0` 版本开始,`YukiHookAPI` 已将自身的反射 API 部分迁移至 +[KavaRef](https://github.com/HighCapable/KavaRef),我们不再推荐使用 `YukiHookAPI` 自身的反射 API,这些 API 已被标记为弃用。 + +`YukiReflection` 项目由于很多未能解决的黑盒问题已被弃用,我们不再推荐任何人使用它。 + +如果你依然在使用 `YukiHookAPI` 的反射 API 部分,请参考 [这里](https://highcapable.github.io/KavaRef/zh-cn/config/migration) 的迁移文档,这将跳转到 `KavaRef` 的文档。 + +::: + +
## Class 扩展 @@ -1891,4 +1904,6 @@ Java 中共有 9 个**原始类型关键字**,其中 8 个为**原始类型** ::: -同时,欢迎你能贡献更多的常用类型。 \ No newline at end of file +同时,欢迎你能贡献更多的常用类型。 + +
\ No newline at end of file diff --git a/docs-source/src/zh-cn/config/api-example.md b/docs-source/src/zh-cn/config/api-example.md index 3cca431b..fd9d71e7 100644 --- a/docs-source/src/zh-cn/config/api-example.md +++ b/docs-source/src/zh-cn/config/api-example.md @@ -36,7 +36,7 @@ fun encase(initiate: PackageParam.() -> Unit) `encase` 方法是 Hook 一切生命的开始,在一个模块或一个 Hook 过程中,`encase` 方法只能作用一次,用于创建 Hooker。 -`PackageParam` 为宿主(目标 APP)的重要实例对象,通过 `PackageParam` 来实现对当前 Hook 作用对象的全部 Hook 操作。 +`PackageParam` 为宿主 (目标 APP) 的重要实例对象,通过 `PackageParam` 来实现对当前 Hook 作用对象的全部 Hook 操作。 ::: tip @@ -52,7 +52,8 @@ fun encase(initiate: PackageParam.() -> Unit) YukiHookAPI.encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -67,7 +68,8 @@ YukiHookAPI.encase { encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -127,7 +129,8 @@ object CustomHooker : YukiBaseHooker() { override fun onHook() { loadApp(name = "com.example.demo1") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -135,7 +138,8 @@ object CustomHooker : YukiBaseHooker() { } loadApp(name = "com.example.demo2") { "$packageName.CustomClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -161,7 +165,8 @@ object ChildCustomHooker : YukiBaseHooker() { override fun onHook() { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -179,7 +184,8 @@ object FirstHooker : YukiBaseHooker() { override fun onHook() { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -252,7 +258,8 @@ encase { encase { loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -272,7 +279,7 @@ encase { ```kotlin encase { loadZygote { - ActivityClass.hook { + Activity::class.resolve().firstMethod { // Your code here. } // 在 Zygote 中创建 Resources Hook @@ -282,7 +289,8 @@ encase { } loadApp(name = "com.example.demo") { "$packageName.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -321,7 +329,8 @@ encase { encase { // 错误的使用方法,不能直接开始 Hook "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -353,7 +362,8 @@ object CustomHooker : YukiBaseHooker() { override fun onHook() { // 错误的使用方法,由于外层没有任何判断对象,不能直接开始 Hook "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -384,7 +394,8 @@ encase { loadHooker(CustomHooker) // ✅ 正确的使用方法,在 APP 作用域内 Hook "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -413,7 +424,8 @@ object CustomHooker : YukiBaseHooker() { // ✅ 正确的使用方法,由于外层没有任何判断对象,需要判断 APP 作用域后再进行 Hook loadApp(/** name 参数可选 */) { "com.example.demo.DemoClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. diff --git a/docs-source/src/zh-cn/config/api-exception.md b/docs-source/src/zh-cn/config/api-exception.md index 03b1b700..2b01c519 100644 --- a/docs-source/src/zh-cn/config/api-exception.md +++ b/docs-source/src/zh-cn/config/api-exception.md @@ -8,6 +8,14 @@ pageClass: hidden-anchor-page 这里的异常说明只会同步最新的 API 版本,较旧的 API 版本的异常将不会再进行说明,请始终保持 API 版本为最新。 +::: warning + +由于维护成本,`YukiHookAPI` 从 `1.3.0` 版本开始将不再会对此文档进行更新且也不会有新的未说明异常在这里添加,如遇到无法解决的问题,你可以通过 [联系我们](../about/contacts) 与我们联系。 + +`KavaRef` 的异常将由其自身单独管理,详细的配置方案你可以参考 [这里](https://highcapable.github.io/KavaRef/zh-cn/library/kavaref-core#%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86),这将跳转到 `KavaRef` 的文档。 + +::: + ## 非阻断异常 > 这些异常不会导致 APP 停止运行 (FC),但是会在控制台打印 `E` 级别的日志,也可能会停止继续执行相关功能。 diff --git a/docs-source/src/zh-cn/config/move-to-api-1-2-x.md b/docs-source/src/zh-cn/config/move-to-api-1-2-x.md index a2644519..ddeea107 100644 --- a/docs-source/src/zh-cn/config/move-to-api-1-2-x.md +++ b/docs-source/src/zh-cn/config/move-to-api-1-2-x.md @@ -2,6 +2,14 @@ `YukiHookAPI` 从 `1.2.0` 版本开始进行了大量调整,你可以继续向下阅读以查看有哪些注意事项和新功能。 +::: warning + +如果你正在使用 `1.2.x` 之前版本的 `YukiHookAPI`,建议先参考此文档迁移到 `1.2.x` 版本。 + +如果你正在使用 `1.2.x` 版本的 `YukiHookAPI`,请直接阅读 [迁移到 YukiHookAPI 1.3.x](move-to-api-1-3-x) 而不是此文档。 + +::: + ## 默认行为变更 从 `1.2.0` 版本开始,`@InjectYukiHookWithXposed` 中 `isUsingResourcesHook` 功能默认不再启用,如有需要请手动启用。 diff --git a/docs-source/src/zh-cn/config/move-to-api-1-3-x.md b/docs-source/src/zh-cn/config/move-to-api-1-3-x.md new file mode 100644 index 00000000..5196943f --- /dev/null +++ b/docs-source/src/zh-cn/config/move-to-api-1-3-x.md @@ -0,0 +1,76 @@ +# 迁移到 YukiHookAPI 1.3.x + +`YukiHookAPI` 从 `1.3.0` 版本开始弃用了自身的反射 API,你可以继续向下阅读以查看有哪些注意事项和新功能。 + +::: warning + +如果你正在使用 `1.2.x` 及之前版本的 `YukiHookAPI`,建议先阅读 [迁移到 YukiHookAPI 1.2.x](move-to-api-1-2-x) 而不是此文档。 + +::: + +## 自身反射 API 弃用 + +`YukiHookAPI` 从 `1.3.0` 版本开始弃用了自身的反射 API,现在我们推荐所有开发者迁移到全新开发的 +[KavaRef](https://github.com/HighCapable/KavaRef),我们不再推荐使用 `YukiHookAPI` 自身的反射 API,这些 API 已被标记为弃用。 + +请参考 [这里](https://highcapable.github.io/KavaRef/zh-cn/config/migration) 的迁移文档,这将跳转到 `KavaRef` 的文档。 + +`YukiHookAPI` 目前已经实现了反射 API 的完全解耦合,其内部 API 使用的反射 API 同样迁移到了 `KavaRef`,且已经稳定测试通过。 + +在后期的 `2.0.0` 版本中,自身反射 API 将被完全移除,在此期间,你将有足够的时间来学习和迁移到这套全新的反射 API。 + +## FreeReflection 弃用 + +`YukiHookAPI` 从 `1.3.0` 版本开始弃用了 [FreeReflection](https://github.com/tiann/FreeReflection) 并迁移到由 LSPosed 团队维护的 +[AndroidHiddenApiBypass](https://github.com/LSPosed/AndroidHiddenApiBypass)。 + +在反射系统隐藏 API 时,你不可以像之前那样直接进行反射,而是需要进行一些操作。 + +`YukiHookAPI` 内置了 `KavaRef` 的 `第三方 Member 解析器` 中的 `AndroidHiddenApiBypassResolver`,现在你可以在需要反射系统隐藏 API 的地方这样去使用它。 + +> 示例如下 + +```kotlin +"android.app.ActivityThread".toClass() + .resolve() + // 添加自定义 Member 解析器 + .processor(AndroidHiddenApiBypassResolver.get()) + .firstMethod { + name = "currentActivityThread" + emptyParameters() + }.invoke() +``` + +::: warning + +`AndroidHiddenApiBypassResolver` 是暂定的功能,可能会在 `2.0.0` 版本迁移到单独的模块中,你也可以参考 +[第三方 Member 解析器](https://highcapable.github.io/KavaRef/zh-cn/config/processor-resolvers) 自己实现一份,这将跳转到 `KavaRef` 的文档。 + +::: + +## 方法原始调用 + +`Xposed` 提供了 `XposedBridge.invokeOriginalMethod` 功能,可以调用未经 Hook 的原始方法。 + +由于自身反射 API 的弃用,`method { ... }.get().original().call(...)` 的方式将不再可用。 + +所以,`YukiHookAPI` 为 `KavaRef` 添加了扩展功能,现在你依然可以实现这个功能。 + +`YukiHookAPI` 提供了以下方法来对接 `KavaRef` 的原始方法调用。 + +- `invokeOriginal(...)` → `invoke(...)` +- `invokeOriginalQuietly(...)` → `invokeQuietly(...)` + +> 示例如下 + +```kotlin +// 假设这就是 Test 类的实例 +val instance: Any +// 使用 KavaRef 的方法原始调用 +"com.example.Test".toClass() + .resolve() + .firstMethod { + name = "test" + emptyParameters() + }.of(instance).invokeOriginal() +``` \ No newline at end of file diff --git a/docs-source/src/zh-cn/guide/example.md b/docs-source/src/zh-cn/guide/example.md index 71bdb88f..faf70455 100644 --- a/docs-source/src/zh-cn/guide/example.md +++ b/docs-source/src/zh-cn/guide/example.md @@ -33,7 +33,25 @@ Host Environment > 上方的结构换做代码将可写为如下形式。 ```kotlin -// 新版写法 +// KavaRef 写法 +TargetClass.resolve().firstMethod { + // Your code here. +}.hook { + before { + // Your code here. + } + after { + // Your code here. + } +} +``` + +
+ +点击查看以往写法 + +```kotlin +// 旧版 (1.2.x-1.3.0 (不含)) 写法 TargetClass.method { // Your code here. }.hook { @@ -58,6 +76,11 @@ TargetClass.hook { } } } +``` + +
+ +```kotlin // Resources Hook (2.0.0 将停止支持) resources().hook { injectResource { @@ -83,6 +106,13 @@ resources().hook { > 这里给出了 Hook APP、Hook 系统框架与 Hook Resources 等例子,可供参考。 +::: tip + +从 `1.3.0` 版本开始,`YukiHookAPI` 已将自身的反射 API 部分迁移至 +[KavaRef](https://github.com/HighCapable/KavaRef),下方演示部分的反射 API 均使用了 `KavaRef` 的写法,我们不再推荐使用 `YukiHookAPI` 自身的反射 API。 + +::: + ### Hook APP 假设,我们要 Hook `com.android.browser` 中的 `onCreate` 方法并弹出一个对话框。 @@ -93,10 +123,9 @@ resources().hook { ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { AlertDialog.Builder(instance()) @@ -113,17 +142,16 @@ loadApp(name = "com.android.browser") { 那么,我想继续 Hook `onStart` 方法要怎么做呢? -我们可以对 `ActivityClass` 使用 Kotlin 的 `apply` 方法创建一个调用空间。 +我们可以对 `Activity::class.resolve()` 使用 Kotlin 的 `apply` 方法创建一个调用空间。 > 示例如下 ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.apply { - method { + Activity::class.resolve().apply { + firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { AlertDialog.Builder(instance()) @@ -133,10 +161,9 @@ loadApp(name = "com.android.browser") { .show() } } - method { + firstMethod { name = "onStart" - emptyParam() - returnType = UnitType + emptyParameters() }.hook { after { // Your code here. @@ -154,7 +181,8 @@ loadApp(name = "com.android.browser") { ```kotlin "com.example.demo.TestClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -167,7 +195,8 @@ loadApp(name = "com.android.browser") { ```kotlin "$packageName.TestClass".toClass() - .method { + .resolve() + .firstMethod { // Your code here. }.hook { // Your code here. @@ -187,7 +216,7 @@ val TestClass by lazyClass("com.example.demo.TestClass") 在适当的时候使用它。 ```kotlin -TestClass.method { +TestClass.resolve().firstMethod { // Your code here. }.hook { // Your code here. @@ -212,10 +241,9 @@ TestClass.method { ```kotlin loadZygote { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) - returnType = UnitType + parameters(Bundle::class) }.hook { after { // Your code here. @@ -242,12 +270,12 @@ loadZygote { ```kotlin loadSystem { - ApplicationInfoClass.method { + ApplicationInfo::class.resolve().firstMethod { // Your code here. }.hook { // Your code here. } - PackageInfoClass.method { + PackageInfo::class.resolve().firstMethod { // Your code here. }.hook { // Your code here. @@ -341,9 +369,9 @@ loadZygote { ```kotlin // 设置一个变量保存当前实例 val hookResult = - method { + resolve().firstMethod { name = "test" - returnType = UnitType + returnType = Void.TYPE }.hook { after { // ... @@ -358,9 +386,9 @@ hookResult.remove() > 示例如下 ```kotlin -method { +resolve().firstMethod { name = "test" - returnType = UnitType + returnType = Void.TYPE }.hook { after { // 直接调用如下方法即可 @@ -427,7 +455,7 @@ TargetClass.hook { } ``` -你还可以处理查找方法时的异常。 +**(旧版本适用)** 你还可以处理查找方法时的异常。 > 示例如下 @@ -447,6 +475,12 @@ method { 这里介绍了可能发生的常见异常,若要了解更多请参考 [API 异常处理](../config/api-exception)。 +::: warning + +`KavaRef` 的异常将由其自身单独管理,详细的配置方案你可以参考 [这里](https://highcapable.github.io/KavaRef/zh-cn/library/kavaref-core#%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86),这将跳转到 `KavaRef` 的文档。 + +::: + ### 抛出异常 在某些情况下,你可以**手动抛出异常**来达到提醒某些功能存在问题的目的。 @@ -593,7 +627,7 @@ override fun onHook() = encase { > 示例如下 ```kotlin -ActvityClass.method { +Activity::class.resolve().firstMethod { // Your code here. }.hook().after { // Your code here. diff --git a/docs-source/src/zh-cn/guide/home.md b/docs-source/src/zh-cn/guide/home.md index ff1c502f..4771e528 100644 --- a/docs-source/src/zh-cn/guide/home.md +++ b/docs-source/src/zh-cn/guide/home.md @@ -22,8 +22,6 @@ 文档全部的 Demo 示例代码都将使用 Kotlin 进行描述,如果你完全不会使用 Kotlin 那你将有可能无法使用 `YukiHookAPI`。 -部分 Java Demo 代码可在 [这里](https://github.com/HighCapable/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java) 找到,但不推荐使用。 - ## 灵感来源 以前,我们在构建 Xposed 模块的时候,首先需要在 `assets` 下创建 `xposed_init` 文件。 @@ -51,9 +49,9 @@ object HookEntry : IYukiHookXposedInit { override fun onHook() = encase { loadZygote { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. @@ -64,9 +62,9 @@ object HookEntry : IYukiHookXposedInit { } } loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. @@ -129,4 +127,12 @@ class HookEntry : IXposedHookZygoteInit, IXposedHookLoadPackage { 是的,你没有看错,仅仅就需要这些代码,就能完全取代传统的 Xposed API 实现同样的功能。 -现在,借助高效强大的 `YukiHookAPI`,你就可以实现一个非常简单的 Xposed 模块。 \ No newline at end of file +现在,借助高效强大的 `YukiHookAPI`,你就可以实现一个非常简单的 Xposed 模块。 + +::: tip + +从 `1.3.0` 版本开始,`YukiHookAPI` 已将自身的反射 API 部分迁移至 [KavaRef](https://github.com/HighCapable/KavaRef) (包括上方演示的反射 API 部分)。 + +现在,你可以借助 `KavaRef` 的强大反射能力让 `YukiHookAPI` 更加易用。 + +::: \ No newline at end of file diff --git a/docs-source/src/zh-cn/guide/move-to-new-api.md b/docs-source/src/zh-cn/guide/move-to-new-api.md index 9d7af282..f6491aea 100644 --- a/docs-source/src/zh-cn/guide/move-to-new-api.md +++ b/docs-source/src/zh-cn/guide/move-to-new-api.md @@ -31,9 +31,10 @@ override fun onHook() = encase { loadApp(name = "com.demo.test") { // Member Hook "com.demo.test.TestClass".toClass() - .method { + .resolve() + .firstMethod { name = "test" - param(BooleanType) + parameters(Boolean::class) }.hook { after { // ... @@ -267,6 +268,14 @@ override fun replaceHookedMethod(param: MethodHookParam) = null `XposedHelpers.callMethod`、`XposedHelpers.callStaticMethod` 等方法自动查找的方法会自动调用所有公开的方法 (包括 `super` 超类),这是 Java 原生反射的特性, 而 `YukiHookAPI` 提供的反射方案为先反射查找再调用,而查找过程默认不会自动查找 `super` 超类的方法。 +::: warning + +`YukiHookAPI` 自身的反射 API 在 `1.3.0` 版本已被弃用,以下内容仅作为 `1.3.0` 版本之前的迁移指引,我们会对其进行保留但不会再进行内容的更新。 + +你可以迁移至 [KavaRef](https://github.com/HighCapable/KavaRef),`KavaRef` 同样适用此特性。 + +::: + 例如,类 `A` 继承于 `B`, `B` 中存在公开的方法 `test`,而 `A` 中并不存在。 ```java diff --git a/docs-source/src/zh-cn/guide/quick-start.md b/docs-source/src/zh-cn/guide/quick-start.md index 77ee8872..74d847e6 100644 --- a/docs-source/src/zh-cn/guide/quick-start.md +++ b/docs-source/src/zh-cn/guide/quick-start.md @@ -2,23 +2,15 @@ > 集成 `YukiHookAPI` 到你的项目中。 -## 环境要求 +## 项目要求 -- Windows 7 及以上/macOS 10.14 及以上/Linux 发行版 (Arch/Debian) +项目需要使用 `Android Studio` 或 `IntelliJ IDEA` 创建且类型为 Android 项目并已集成 Kotlin 环境依赖。 -- Android Studio 2021.1 及以上 +- Android Studio (建议 [从这里](https://developer.android.com/studio) 获取最新版本) -- IntelliJ IDEA 2021.1 及以上 +- IntelliJ IDEA (建议 [从这里](https://www.jetbrains.com/idea) 获取最新版本) -- Kotlin 1.7.0 及以上 - -- Android Gradle Plugin 7.0 及以上 - -- Gradle 7.0 及以上 - -- Java 11 及以上 (Since API `1.0.80`) - -- Java 17 及以上 (Since API `1.2.0`) +- Kotlin 1.9.0+、Gradle 8+、Java 11、17+、Android Gradle Plugin 8+ ## 自动构建项目 @@ -49,8 +41,6 @@ repositories: # 作为 Xposed 模块使用务必添加,其它情况可选 rovo89-xposed-api: url: https://api.xposed.info/ - # MavenCentral 有 2 小时缓存,若无法集成最新版本请添加 - sonatype-oss-releases: plugins: # 作为 Xposed 模块使用务必添加,其它情况可选 @@ -71,6 +61,13 @@ libraries: # 作为 Xposed 模块使用务必添加,其它情况可选 ksp-xposed: version-ref: ::api + # YukiHookAPI 1.3.0 版本后使用 KavaRef 作为核心反射 API + # YukiHookAPI 不再绑定自身的反射 API,你可以开始尝试使用 KavaRef + com.highcapable.kavaref: + kavaref-core: + version: + + kavaref-extension: + version: + ... ``` @@ -96,6 +93,9 @@ plugins { dependencies { // 基础依赖 implementation(com.highcapable.yukihookapi.api) + // 推荐使用 KavaRef 作为核心反射 API + implementation(com.highcapable.kavaref.kavaref.core) + implementation(com.highcapable.kavaref.kavaref.extension) // 作为 Xposed 模块使用务必添加,其它情况可选 compileOnly(de.robv.android.xposed.api) // 作为 Xposed 模块使用务必添加,其它情况可选 @@ -103,9 +103,9 @@ dependencies { } ``` -#### 传统方式 +#### Version Catalog -在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加存储库。 +在你的项目 `build.gradle.kts` 中添加存储库。 > Kotlin DSL @@ -115,25 +115,81 @@ repositories { mavenCentral() // 作为 Xposed 模块使用务必添加,其它情况可选 maven { url("https://api.xposed.info/") } - // MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址 - maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") } } ``` -> Groovy DSL +在你的项目 `gradle/libs.versions.toml` 中添加依赖。 -```groovy +> 示例如下 + +```toml +[versions] +yukihookapi = "" +ksp = "" +kavaref-core = "" +kavaref-extension = "" + +[plugins] +# 作为 Xposed 模块使用务必添加,其它情况可选 +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } + +[libraries] +yukihookapi-api = { module = "com.highcapable.yukihookapi:api", version.ref = "yukihookapi" } +# 作为 Xposed 模块使用务必添加,其它情况可选 +yukihookapi-ksp-xposed = { module = "com.highcapable.yukihookapi:ksp-xposed", version.ref = "yukihookapi" } +# YukiHookAPI 1.3.0 版本后使用 KavaRef 作为核心反射 API +# YukiHookAPI 不再绑定自身的反射 API,你可以开始尝试使用 KavaRef +kavaref-core = { module = "com.highcapable.kavaref:kavaref-core", version.ref = "kavaref-core" } +kavaref-extension = { module = "com.highcapable.kavaref:kavaref-extension", version.ref = "kavaref-extension" } +# 作为 Xposed 模块使用务必添加,其它情况可选 +xposed-api = { module = "de.robv.android.xposed:api", version = "82" } +``` + +接下来,在你的项目 `build.gradle.kts` 中部署插件。 + +> Kotlin DSL + +```kotlin +plugins { + // 作为 Xposed 模块使用务必添加,其它情况可选 + alias(libs.plugins.ksp) +} +``` + +然后,在你的项目 `build.gradle.kts` 中部署依赖。 + +> Kotlin DSL + +```kotlin +dependencies { + // 基础依赖 + implementation(libs.yukihookapi.api) + // 推荐使用 KavaRef 作为核心反射 API + implementation(libs.kavaref.core) + implementation(libs.kavaref.extension) + // 作为 Xposed 模块使用务必添加,其它情况可选 + compileOnly(libs.xposed.api) + // 作为 Xposed 模块使用务必添加,其它情况可选 + ksp(libs.yukihookapi.ksp.xposed) +} +``` + +#### 传统方式 + +在你的项目 `build.gradle.kts` 中添加存储库。 + +> Kotlin DSL + +```kotlin repositories { google() mavenCentral() // 作为 Xposed 模块使用务必添加,其它情况可选 - maven { url 'https://api.xposed.info/' } - // MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址 - maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } + maven { url("https://api.xposed.info/") } } ``` -在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加插件。 +在你的项目 `build.gradle.kts` 中添加插件。 > Kotlin DSL @@ -144,16 +200,7 @@ plugins { } ``` -> Groovy DSL - -```groovy -plugins { - // 作为 Xposed 模块使用务必添加,其它情况可选 - id 'com.google.devtools.ksp' version '' -} -``` - -在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加依赖。 +在你的项目 `build.gradle.kts` 中添加依赖。 > Kotlin DSL @@ -161,6 +208,9 @@ plugins { dependencies { // 基础依赖 implementation("com.highcapable.yukihookapi:api:") + // 推荐使用 KavaRef 作为核心反射 API + implementation("com.highcapable.kavaref:kavaref-core:") + implementation("com.highcapable.kavaref:kavaref-extension:") // 作为 Xposed 模块使用务必添加,其它情况可选 compileOnly("de.robv.android.xposed:api:82") // 作为 Xposed 模块使用务必添加,其它情况可选 @@ -168,34 +218,21 @@ dependencies { } ``` -> Groovy DSL - -```groovy -dependencies { - // 基础依赖 - implementation 'com.highcapable.yukihookapi:api:' - // 作为 Xposed 模块使用务必添加,其它情况可选 - compileOnly 'de.robv.android.xposed:api:82' - // 作为 Xposed 模块使用务必添加,其它情况可选 - ksp 'com.highcapable.yukihookapi:ksp-xposed:' -} -``` - 请将 **<ksp-version>** 修改为 [这里](https://github.com/google/ksp/releases) 的最新版本 **(请注意选择你当前对应的 Kotlin 版本)**。 请将 **<yuki-version>** 修改为 [这里](../about/changelog) 的最新版本。 +请将 **<kavaref-version>** 修改为 [这里](https://highcapable.github.io/KavaRef/zh-cn/about/changelog) 的最新版本。 + ::: danger **YukiHookAPI** 的 **api** 与 **ksp-xposed** 依赖的版本必须一一对应,否则将会造成版本不匹配错误。 -我们推荐使用 [SweetDependency](https://github.com/HighCapable/SweetDependency) 来自动帮你装配依赖。 - ::: #### 配置 Java 版本 -在你的项目 `build.gradle.kts` 或 `build.gradle` 中修改 Kotlin 的 Java 版本为 17 及以上。 +在你的项目 `build.gradle.kts` 中修改 Kotlin 的 Java 版本为 17 及以上。 > Kotlin DSL @@ -211,20 +248,6 @@ android { } ``` -> Groovy DSL - -```groovy -android { - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } -} -``` - ::: warning 自 API **1.0.80** 版本后 Kotlin 使用的 Java 版本默认为 11,不再支持 1.8 及以下版本。 diff --git a/docs-source/src/zh-cn/guide/supportive.md b/docs-source/src/zh-cn/guide/supportive.md index 6450f574..3d0cf2c4 100644 --- a/docs-source/src/zh-cn/guide/supportive.md +++ b/docs-source/src/zh-cn/guide/supportive.md @@ -4,22 +4,22 @@ > 基本功能 -| Name | ST | Description | -| -------------------------------- | --- | --------------------------------------------------------------------------------------------------------------- | +| Name | ST | Description | +| -------------------------------- | --- | -------------------------------------------------------------------------------------------------------------------- | | 自动化 Xposed 模块构建 | ✅ | 计划 `YukiHookAPI` `2.0.0` 版本使用 [新的 Xposed 模块配置方案](https://github.com/HighCapable/YukiHookAPI/issues/49) | -| ART 动态方法 Hook | ✅ | 多场景下稳定使用 | -| Xposed 资源钩子 (Resources Hook) | ❗ | 支持,但计划 `YukiHookAPI` `2.0.0` 版本作废 | +| ART 动态方法 Hook | ✅ | 多场景下稳定使用 | +| Xposed 资源钩子 (Resources Hook) | ❗ | 支持,但计划 `YukiHookAPI` `2.0.0` 版本移除 | > 扩展功能 -| Name | ST | Description | -| -------------------------------------------------------------------------------------- | --- | ------------------------------------------------------------------------------------------------ | -| [字节码与反射扩展](../api/special-features/reflection) | ⭕ | 计划 `YukiHookAPI` `2.0.0` 版本合并到 [YukiReflection](https://github.com/HighCapable/YukiReflection) | -| [Xposed 模块数据存储](../api/special-features/xposed-storage) | ✅ | 正常使用 | -| [Xposed 模块与宿主通讯桥](../api/special-features/xposed-channel) | ✅ | 正常使用 | -| [宿主生命周期扩展](../api/special-features/host-lifecycle) | ✅ | 正常使用 | -| [注入模块资源 (Resources)](../api/special-features/host-inject#注入模块资源-resources) | ✅ | 正常使用 | -| [注册模块 Activity](../api/special-features/host-inject#注册模块-activity) | ✅ | 正常使用 | +| Name | ST | Description | +| -------------------------------------------------------------------------------------- | --- | ------------------------------------------------------------------------------------------------------------- | +| ~~[字节码与反射扩展](../api/special-features/reflection)~~ | ❗ | 已全面弃用,推荐迁移至 [KavaRef](https://github.com/HighCapable/KavaRef),计划 `YukiHookAPI` `2.0.0` 版本移除 | +| [Xposed 模块数据存储](../api/special-features/xposed-storage) | ✅ | 正常使用 | +| [Xposed 模块与宿主通讯桥](../api/special-features/xposed-channel) | ✅ | 正常使用 | +| [宿主生命周期扩展](../api/special-features/host-lifecycle) | ✅ | 正常使用 | +| [注入模块资源 (Resources)](../api/special-features/host-inject#注入模块资源-resources) | ✅ | 正常使用 | +| [注册模块 Activity](../api/special-features/host-inject#注册模块-activity) | ✅ | 正常使用 | > Xposed 框架 diff --git a/docs-source/src/zh-cn/index.md b/docs-source/src/zh-cn/index.md index 8d474e2c..850dc746 100644 --- a/docs-source/src/zh-cn/index.md +++ b/docs-source/src/zh-cn/index.md @@ -29,9 +29,9 @@ footer: Apache-2.0 License | Copyright (C) 2019 HighCapable ```kotlin loadApp(name = "com.android.browser") { - ActivityClass.method { + Activity::class.resolve().firstMethod { name = "onCreate" - param(BundleClass) + parameters(Bundle::class) }.hook { before { // Your code here. diff --git a/gradle/sweet-dependency/sweet-dependency-config.yaml b/gradle/sweet-dependency/sweet-dependency-config.yaml index 05a3fae8..bd138187 100644 --- a/gradle/sweet-dependency/sweet-dependency-config.yaml +++ b/gradle/sweet-dependency/sweet-dependency-config.yaml @@ -42,11 +42,9 @@ libraries: version: 82 repositories: rovo89-xposed-api - com.github.tiann: - FreeReflection: - version: 3.2.2 - repositories: - jit-pack + org.lsposed.hiddenapibypass: + hiddenapibypass: + version: 6.1 com.google.devtools.ksp: symbol-processing-api: version-ref: ::kotlin-ksp @@ -56,6 +54,11 @@ libraries: dev.zacsweers.autoservice: auto-service-ksp: version: 1.2.0 + com.highcapable.kavaref: + kavaref-core: + version: 1.0.0 + kavaref-extension: + version: 1.0.0 com.highcapable.hikage: hikage-core: version: 1.0.1 diff --git a/yukihookapi-core/build.gradle.kts b/yukihookapi-core/build.gradle.kts index 25004661..781119e6 100644 --- a/yukihookapi-core/build.gradle.kts +++ b/yukihookapi-core/build.gradle.kts @@ -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) diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/CurrentClass.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/CurrentClass.kt index 509df353..553c1fc9 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/CurrentClass.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/CurrentClass.kt @@ -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) diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/GenericClass.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/GenericClass.kt index 2915db1d..ea5a4877 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/GenericClass.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/GenericClass.kt @@ -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 argument(index: Int = 0) = type.actualTypeArguments[index].let { args -> diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/HookClass.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/HookClass.kt index 7d69b500..dee67f6e 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/HookClass.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/HookClass.kt @@ -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, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/VariousClass.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/VariousClass.kt index 9be83046..ce9ff4ab 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/VariousClass.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/bean/VariousClass.kt @@ -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 { diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt index 23703040..f7633ea6 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt @@ -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]") } } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt index a595aee6..3bcc55f0 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt @@ -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] 的功能 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt index 72b86d6f..1a114470 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt @@ -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().field { name = "TAG" }.ignored().get().string().takeIf { it.isNotBlank() } + XposedBridge::class.resolve() + .optional(silent = true) + .firstFieldOrNull { + name = "TAG" + modifiers(Modifiers.STATIC) + }?.get()?.takeIf { it.isNotBlank() } ?.replace("Bridge", "")?.replace("-", "")?.trim() ?: "unknown" }.getOrNull() ?: "invalid" } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt index 1c11db4f..03f2fe13 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt @@ -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] diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/AndroidHiddenApiBypassResolver.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/AndroidHiddenApiBypassResolver.kt new file mode 100644 index 00000000..f4c87acb --- /dev/null +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/AndroidHiddenApiBypassResolver.kt @@ -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 getDeclaredConstructors(declaringClass: Class): List> { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) + return super.getDeclaredConstructors(declaringClass) + val constructors = HiddenApiBypass.getDeclaredMethods(declaringClass) + .filterIsInstance>() + .toList() + return constructors + } + + override fun getDeclaredMethods(declaringClass: Class): List { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) + return super.getDeclaredMethods(declaringClass) + val methods = HiddenApiBypass.getDeclaredMethods(declaringClass) + .filterIsInstance() + .toList() + return methods + } +} \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/KavaRefExtension.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/KavaRefExtension.kt new file mode 100644 index 00000000..004888df --- /dev/null +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/reflect/KavaRefExtension.kt @@ -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 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 MethodResolver<*>.invokeOriginalQuietly(vararg args: Any?) = runCatching { invokeOriginal(*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() \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/ReflectionMigration.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/ReflectionMigration.kt new file mode 100644 index 00000000..0afc050b --- /dev/null +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/ReflectionMigration.kt @@ -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" +} \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt index 3ce56f1c..0fcde9da 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt @@ -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 -} +} \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt index 91963185..11d1e393 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt @@ -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 { diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt index 9f9a29e0..1ffc051a 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt @@ -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 { diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt index 354c1d65..e95ded10 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt @@ -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? = null, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt index 9c6c4405..a9032f83 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt @@ -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]" diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt index 17138710..6c16cc13 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt @@ -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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($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(" ($it)") } /** diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt index 3ef75a5a..ed3b5ef6 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt @@ -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]" diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt index 830b9a1a..1cdba2be 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt @@ -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 { diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt index bbe19ad0..3ff5e0d1 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt @@ -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().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 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 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 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) { /** @@ -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>) -> 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 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt index bdfe3d0a..6779752b 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt @@ -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 = 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)" } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt index 6cc41ca3..2a54bec1 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt @@ -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 } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt index cc88d5a9..78749a67 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt @@ -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 } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt index c0d7b5bc..0c0b5bc0 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt @@ -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 } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt index 2f889703..0d6e6678 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt @@ -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 } diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt index 5d855476..38600d6b 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt @@ -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 { diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt index 4f14657f..39e96b8b 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt @@ -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 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt index 152db093..92eac687 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt @@ -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>().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>.() -> 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.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().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.() -> 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 newInstance(vararg args: Any?) = baseCall(*args) as? T? override fun toString() = "[${constructor?.name ?: ""}]" diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt index 7583bd17..6b157fcd 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt @@ -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.() -> 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().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.() -> 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 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() /** @@ -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() ?: 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 array() = cast() ?: arrayOf() /** @@ -583,12 +627,14 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null) * - 请确认目标 [Field] 的类型 - 发生错误会返回空数组 * @return [List] 取不到返回空数组 */ + @Deprecated(ReflectionMigration.KAVAREF_INFO) inline fun list() = cast() ?: listOf() /** * 设置当前 [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() = diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt index 353d64a8..519689b4 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt @@ -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>().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.() -> 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.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().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.() -> 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 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(*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(*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 array(vararg args: Any?) = invoke(*args) ?: arrayOf() /** @@ -792,6 +847,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null) * - 请确认目标 [Method] 的返回值 - 发生错误会返回空数组 * @return [List] 取不到返回空数组 */ + @Deprecated(ReflectionMigration.KAVAREF_INFO) inline fun list(vararg args: Any?) = invoke(*args) ?: listOf() override fun toString() = "[${method?.name ?: ""}] in [${instance?.javaClass?.name ?: ""}]" diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt index ad3a6582..34ebc37b 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt @@ -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>? = null, var paramTypesConditions: ObjectsConditions? = null, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt index 72c998f2..7940c865 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt @@ -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, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt index 999d6022..402266c7 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt @@ -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, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt index 01433e9d..aa11a4cd 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt @@ -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, diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt index 44f98955..8c928cfd 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt @@ -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 { /** 当前工具类的标签 */ diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt index c02df142..f14fa5c6 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt @@ -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>) -> Boolean \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt index 15595990..a8040a06 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt @@ -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 internal constructor( private val instance: Any, private val initialize: Boolean, @@ -161,6 +166,7 @@ open class LazyClass 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(), 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 String.toClass(loader: ClassLoader? = null, initialize: Boolean = false) = ReflectionTool.findClassByName(name = this, loader, initialize) as? Class? ?: error("Target Class type cannot cast to ${T::class.java}") @@ -331,6 +346,7 @@ inline fun 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 String.toClassOrNull(loader: ClassLoader? = null, initialize: Boolean = false) = runCatching { toClass(loader, initialize) }.getOrNull() @@ -352,6 +369,7 @@ inline fun String.toClassOrNull(loader: ClassLoader? = null, initial * @return [Class]<[T]> * @throws NoClassDefFoundError 如果找不到 [Class] 或设置了错误的 [ClassLoader] */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) inline fun classOf(loader: ClassLoader? = null, initialize: Boolean = false) = loader?.let { T::class.java.name.toClass(loader, initialize) as Class } ?: T::class.java @@ -362,6 +380,7 @@ inline fun 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(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 lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = null) = LazyClass.NonNull(name, initialize, loader) @@ -383,6 +403,7 @@ inline fun 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(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(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 lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = null) = LazyClass.Nullable(name, initialize, loader) @@ -414,6 +437,7 @@ inline fun 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(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 T.current(ignored: Boolean = false) = CurrentClass(javaClass, instance = this).apply { isIgnoreErrorLogs = ignored } @@ -511,6 +547,7 @@ inline fun T.current(ignored: Boolean = false) = * @param initiate 方法体 * @return [T] */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) inline fun 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 Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions = { emptyParam() }) = constructor(initiate).get().newInstance(*args) @@ -551,6 +590,7 @@ inline fun 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 }) } \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt index 83368267..07f2d239 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt @@ -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() diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/YLog.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/YLog.kt index 8a02ccc6..6b0a1b0b 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/YLog.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/YLog.kt @@ -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 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt index 2f5c4a32..09344f77 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt @@ -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 result() = result as? T? + inline fun result() = result as? T? /** * 获取当前 Hook 实例的对象 [T] * @return [T] * @throws IllegalStateException 如果对象为空或对象类型不是 [T] */ - inline fun instance() = instance as? T? ?: error("HookParam instance cannot cast to ${classOf().name}") + inline fun instance() = instance as? T? ?: error("HookParam instance cannot cast to ${classOf().name}") /** * 获取当前 Hook 实例的对象 [T] * @return [T] or null */ - inline fun instanceOrNull() = instanceOrNull as? T? + inline fun instanceOrNull() = instanceOrNull as? T? /** * 获取当前 Hook 对象的 [method] or [constructor] 的参数数组下标实例化类 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt index 1ed7ec29..07aba862 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt @@ -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 String.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = + inline fun String.toClass(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = toClassGlobal(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 String.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = + inline fun String.toClassOrNull(loader: ClassLoader? = appClassLoader, initialize: Boolean = false) = toClassOrNullGlobal(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 lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) = + inline fun lazyClass(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) = lazyClassGlobal(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 lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) = + inline fun lazyClassOrNull(name: String, initialize: Boolean = false, noinline loader: ClassLoaderInitializer? = appLoaderInit) = lazyClassOrNullGlobal(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>.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>.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.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>.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.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)) } /** diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt index afd04790..3f37bbbf 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt @@ -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() /** * 获得 [Context] 类型 * @return [Class]<[Context]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ContextClass get() = classOf() /** * 获得 [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() /** * 获得 [Application] 类型 * @return [Class]<[Application]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ApplicationClass get() = classOf() /** * 获得 [ApplicationInfo] 类型 * @return [Class]<[ApplicationInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ApplicationInfoClass get() = classOf() /** * 获得 [Instrumentation] 类型 * @return [Class]<[Instrumentation]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val InstrumentationClass get() = classOf() /** * 获得 [PackageInfo] 类型 * @return [Class]<[PackageInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PackageInfoClass get() = classOf() /** * 获得 [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() /** * 获得 [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() /** * 获得 [Looper] 类型 * @return [Class]<[Looper]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val LooperClass get() = classOf() /** * 获得 [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() /** * 获得 [Binder] 类型 * @return [Class]<[Binder]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BinderClass get() = classOf() /** * 获得 [IBinder] 类型 * @return [Class]<[IBinder]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val IBinderClass get() = classOf() /** * 获得 [BroadcastReceiver] 类型 * @return [Class]<[BroadcastReceiver]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BroadcastReceiverClass get() = classOf() /** * 获得 [Bundle] 类型 * @return [Class]<[Bundle]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BundleClass get() = classOf() /** * 获得 [BaseBundle] 类型 * @return [Class]<[BaseBundle]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BaseBundleClass get() = classOf() /** * 获得 [Resources] 类型 * @return [Class]<[Resources]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ResourcesClass get() = classOf() /** * 获得 [Configuration] 类型 * @return [Class]<[Configuration]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ConfigurationClass get() = classOf() /** * 获得 [ConfigurationInfo] 类型 * @return [Class]<[ConfigurationInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ConfigurationInfoClass get() = classOf() /** * 获得 [ContentResolver] 类型 * @return [Class]<[ContentResolver]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ContentResolverClass get() = classOf() /** * 获得 [ContentProvider] 类型 * @return [Class]<[ContentProvider]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ContentProviderClass get() = classOf() /** * 获得 [Settings] 类型 * @return [Class]<[Settings]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SettingsClass get() = classOf() /** * 获得 [Settings.System] 类型 * @return [Class]<[Settings.System]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Settings_SystemClass get() = classOf() /** * 获得 [Settings.Secure] 类型 * @return [Class]<[Settings.Secure]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Settings_SecureClass get() = classOf() /** * 获得 [TypedArray] 类型 * @return [Class]<[TypedArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TypedArrayClass get() = classOf() /** * 获得 [TypedValue] 类型 * @return [Class]<[TypedValue]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TypedValueClass get() = classOf() /** * 获得 [SparseArray] 类型 * @return [Class]<[SparseArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SparseArrayClass get() = classOf>() /** * 获得 [SparseIntArray] 类型 * @return [Class]<[SparseIntArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SparseIntArrayClass get() = classOf() /** * 获得 [SparseBooleanArray] 类型 * @return [Class]<[SparseBooleanArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SparseBooleanArrayClass get() = classOf() /** * 获得 [SparseLongArray] 类型 * @return [Class]<[SparseLongArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SparseLongArrayClass get() = classOf() /** * 获得 [LongSparseArray] 类型 * @return [Class]<[LongSparseArray]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val LongSparseArrayClass get() = classOf>() /** * 获得 [ArrayMap] 类型 * @return [Class]<[ArrayMap]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ArrayMapClass get() = classOf>() /** @@ -348,42 +397,49 @@ val ArrayMapClass get() = classOf>() * - 在 Android M (23) 及以上系统加入 * @return [Class]<[ArraySet]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ArraySetClass get() = if (Build.VERSION.SDK_INT >= 23) classOf>() else null /** * 获得 [Handler] 类型 * @return [Class]<[Handler]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val HandlerClass get() = classOf() /** * 获得 [Handler.Callback] 类型 * @return [Class]<[Handler.Callback]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Handler_CallbackClass get() = classOf() /** * 获得 [Message] 类型 * @return [Class]<[Message]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val MessageClass get() = classOf() /** * 获得 [MessageQueue] 类型 * @return [Class]<[MessageQueue]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val MessageQueueClass get() = classOf() /** * 获得 [Messenger] 类型 * @return [Class]<[Messenger]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val MessengerClass get() = classOf() /** * 获得 [AsyncTask] 类型 * @return [Class]<[AsyncTask]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AsyncTaskClass get() = classOf>() /** @@ -392,18 +448,21 @@ val AsyncTaskClass get() = classOf>() * - 在 Android N (24) 及以上系统加入 * @return [Class]<[SimpleDateFormat]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SimpleDateFormatClass_Android get() = if (Build.VERSION.SDK_INT >= 24) classOf() else null /** * 获得 [Base64] 类型 * @return [Class]<[Base64]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Base64Class_Android get() = classOf() /** * 获得 [Window] 类型 * @return [Class]<[Window]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowClass get() = classOf() /** @@ -412,12 +471,14 @@ val WindowClass get() = classOf() * - 在 Android R (30) 及以上系统加入 * @return [Class]<[WindowMetrics]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowMetricsClass get() = if (Build.VERSION.SDK_INT >= 30) classOf() else null /** * 获得 [WindowInsets] 类型 * @return [Class]<[WindowInsets]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowInsetsClass get() = classOf() /** @@ -426,216 +487,252 @@ val WindowInsetsClass get() = classOf() * - 在 Android R (30) 及以上系统加入 * @return [Class]<[WindowInsets.Type]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowInsets_TypeClass get() = if (Build.VERSION.SDK_INT >= 30) classOf() else null /** * 获得 [WindowManager] 类型 * @return [Class]<[WindowManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowManagerClass get() = classOf() /** * 获得 [WindowManager.LayoutParams] 类型 * @return [Class]<[WindowManager.LayoutParams]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WindowManager_LayoutParamsClass get() = classOf() /** * 获得 [ViewManager] 类型 * @return [Class]<[ViewManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ViewManagerClass get() = classOf() /** * 获得 [Parcel] 类型 * @return [Class]<[Parcel]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ParcelClass get() = classOf() /** * 获得 [Parcelable] 类型 * @return [Class]<[Parcelable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ParcelableClass get() = classOf() /** * 获得 [Parcelable.Creator] 类型 * @return [Class]<[Parcelable.Creator]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Parcelable_CreatorClass get() = classOf>() /** * 获得 [Dialog] 类型 * @return [Class]<[Dialog]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DialogClass get() = classOf() /** * 获得 [AlertDialog] 类型 * @return [Class]<[AlertDialog]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AlertDialogClass get() = classOf() /** * 获得 [DisplayMetrics] 类型 * @return [Class]<[DisplayMetrics]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DisplayMetricsClass get() = classOf() /** * 获得 [Display] 类型 * @return [Class]<[Display]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DisplayClass get() = classOf() /** * 获得 [Toast] 类型 * @return [Class]<[Toast]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ToastClass get() = classOf() /** * 获得 [Intent] 类型 * @return [Class]<[Intent]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val IntentClass get() = classOf() /** * 获得 [ComponentInfo] 类型 * @return [Class]<[ComponentInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ComponentInfoClass get() = classOf() /** * 获得 [ComponentName] 类型 * @return [Class]<[ComponentName]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ComponentNameClass get() = classOf() /** * 获得 [PendingIntent] 类型 * @return [Class]<[PendingIntent]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PendingIntentClass get() = classOf() /** * 获得 [ColorStateList] 类型 * @return [Class]<[ColorStateList]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ColorStateListClass get() = classOf() /** * 获得 [ContentValues] 类型 * @return [Class]<[ContentValues]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ContentValuesClass get() = classOf() /** * 获得 [SharedPreferences] 类型 * @return [Class]<[SharedPreferences]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SharedPreferencesClass get() = classOf() /** * 获得 [MediaPlayer] 类型 * @return [Class]<[MediaPlayer]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val MediaPlayerClass get() = classOf() /** * 获得 [ProgressDialog] 类型 * @return [Class]<[ProgressDialog]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ProgressDialogClass get() = classOf() /** * 获得 [Log] 类型 * @return [Class]<[Log]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val LogClass get() = classOf() /** * 获得 [Build] 类型 * @return [Class]<[Build]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BuildClass get() = classOf() /** * 获得 [Xml] 类型 * @return [Class]<[Xml]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val XmlClass get() = classOf() /** * 获得 [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() /** * 获得 [Notification] 类型 * @return [Class]<[Notification]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val NotificationClass get() = classOf() /** * 获得 [Notification.Builder] 类型 * @return [Class]<[Notification.Builder]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Notification_BuilderClass get() = classOf() /** * 获得 [Notification.Action] 类型 * @return [Class]<[Notification.Action]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Notification_ActionClass get() = classOf() /** * 获得 [DialogInterface] 类型 * @return [Class]<[DialogInterface]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DialogInterfaceClass get() = classOf() /** * 获得 [DialogInterface.OnClickListener] 类型 * @return [Class]<[DialogInterface.OnClickListener]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DialogInterface_OnClickListenerClass get() = classOf() /** * 获得 [DialogInterface.OnCancelListener] 类型 * @return [Class]<[DialogInterface.OnCancelListener]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DialogInterface_OnCancelListenerClass get() = classOf() /** * 获得 [DialogInterface.OnDismissListener] 类型 * @return [Class]<[DialogInterface.OnDismissListener]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DialogInterface_OnDismissListenerClass get() = classOf() /** * 获得 [Environment] 类型 * @return [Class]<[Environment]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val EnvironmentClass get() = classOf() /** * 获得 [Process] 类型 * @return [Class]<[Process]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ProcessClass get() = classOf() /** * 获得 [Vibrator] 类型 * @return [Class]<[Vibrator]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val VibratorClass get() = classOf() /** @@ -644,6 +741,7 @@ val VibratorClass get() = classOf() * - 在 Android O (26) 及以上系统加入 * @return [Class]<[VibrationEffect]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val VibrationEffectClass get() = if (Build.VERSION.SDK_INT >= 26) classOf() else null /** @@ -652,30 +750,35 @@ val VibrationEffectClass get() = if (Build.VERSION.SDK_INT >= 26) classOf or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val VibrationAttributesClass get() = if (Build.VERSION.SDK_INT >= 30) classOf() else null /** * 获得 [SystemClock] 类型 * @return [Class]<[SystemClock]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SystemClockClass get() = classOf() /** * 获得 [PowerManager] 类型 * @return [Class]<[PowerManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PowerManagerClass get() = classOf() /** * 获得 [PowerManager.WakeLock] 类型 * @return [Class]<[PowerManager.WakeLock]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PowerManager_WakeLockClass get() = classOf() /** * 获得 [UserHandle] 类型 * @return [Class]<[UserHandle]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val UserHandleClass get() = classOf() /** @@ -684,6 +787,7 @@ val UserHandleClass get() = classOf() * - 在 Android N_MR1 (25) 及以上系统加入 * @return [Class]<[ShortcutInfo]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ShortcutInfoClass get() = if (Build.VERSION.SDK_INT >= 25) classOf() else null /** @@ -692,6 +796,7 @@ val ShortcutInfoClass get() = if (Build.VERSION.SDK_INT >= 25) classOf or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ShortcutManagerClass get() = if (Build.VERSION.SDK_INT >= 30) classOf() else null /** @@ -700,118 +805,138 @@ val ShortcutManagerClass get() = if (Build.VERSION.SDK_INT >= 30) classOf or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ShortcutQueryClass get() = if (Build.VERSION.SDK_INT >= 25) classOf() else null /** * 获得 [KeyboardShortcutInfo] 类型 * @return [Class]<[KeyboardShortcutInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val KeyboardShortcutInfoClass get() = classOf() /** * 获得 [KeyboardShortcutGroup] 类型 * @return [Class]<[KeyboardShortcutGroup]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val KeyboardShortcutGroupClass get() = classOf() /** * 获得 [ShortcutIconResource] 类型 * @return [Class]<[ShortcutIconResource]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ShortcutIconResourceClass get() = classOf() /** * 获得 [AssetManager] 类型 * @return [Class]<[AssetManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AssetManagerClass get() = classOf() /** * 获得 [AppWidgetManager] 类型 * @return [Class]<[AppWidgetManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AppWidgetManagerClass get() = classOf() /** * 获得 [AppWidgetProvider] 类型 * @return [Class]<[AppWidgetProvider]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AppWidgetProviderClass get() = classOf() /** * 获得 [AppWidgetProviderInfo] 类型 * @return [Class]<[AppWidgetProviderInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AppWidgetProviderInfoClass get() = classOf() /** * 获得 [AppWidgetHost] 类型 * @return [Class]<[AppWidgetHost]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AppWidgetHostClass get() = classOf() /** * 获得 [ActivityInfo] 类型 * @return [Class]<[ActivityInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ActivityInfoClass get() = classOf() /** * 获得 [ResolveInfo] 类型 * @return [Class]<[ResolveInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ResolveInfoClass get() = classOf() /** * 获得 [Property] 类型 * @return [Class]<[Property]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PropertyClass get() = classOf>() /** * 获得 [IntProperty] 类型 * @return [Class]<[IntProperty]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val IntPropertyClass get() = classOf>() /** * 获得 [FloatProperty] 类型 * @return [Class]<[FloatProperty]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val FloatPropertyClass get() = classOf>() /** * 获得 [SQLiteDatabase] 类型 * @return [Class]<[SQLiteDatabase]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SQLiteDatabaseClass get() = classOf() /** * 获得 [StrictMode] 类型 * @return [Class]<[StrictMode]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val StrictModeClass get() = classOf() /** * 获得 [AccessibilityManager] 类型 * @return [Class]<[AccessibilityManager]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AccessibilityManagerClass get() = classOf() /** * 获得 [AccessibilityEvent] 类型 * @return [Class]<[AccessibilityEvent]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AccessibilityEventClass get() = classOf() /** * 获得 [AccessibilityNodeInfo] 类型 * @return [Class]<[AccessibilityNodeInfo]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AccessibilityNodeInfoClass get() = classOf() /** * 获得 [IInterface] 类型 * @return [Class]<[IInterface]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val IInterfaceClass get() = classOf() \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt index ec7b1934..bb2bf997 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt @@ -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() /** * 获得 [Bitmap] 类型 * @return [Class]<[Bitmap]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BitmapClass get() = classOf() /** @@ -72,166 +75,194 @@ val BitmapClass get() = classOf() * - 在 Android M (23) 及以上系统加入 * @return [Class]<[Icon]> or null */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val IconClass get() = if (Build.VERSION.SDK_INT >= 23) classOf() else null /** * 获得 [Outline] 类型 * @return [Class]<[Outline]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val OutlineClass get() = classOf() /** * 获得 [Drawable] 类型 * @return [Class]<[Drawable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val DrawableClass get() = classOf() /** * 获得 [GradientDrawable] 类型 * @return [Class]<[GradientDrawable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val GradientDrawableClass get() = classOf() /** * 获得 [ColorDrawable] 类型 * @return [Class]<[ColorDrawable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ColorDrawableClass get() = classOf() /** * 获得 [BitmapDrawable] 类型 * @return [Class]<[BitmapDrawable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BitmapDrawableClass get() = classOf() /** * 获得 [Size] 类型 * @return [Class]<[Size]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SizeClass get() = classOf() /** * 获得 [SizeF] 类型 * @return [Class]<[SizeF]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SizeFClass get() = classOf() /** * 获得 [Rect] 类型 * @return [Class]<[Rect]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val RectClass get() = classOf() /** * 获得 [RectF] 类型 * @return [Class]<[RectF]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val RectFClass get() = classOf() /** * 获得 [NinePatch] 类型 * @return [Class]<[NinePatch]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val NinePatchClass get() = classOf() /** * 获得 [Paint] 类型 * @return [Class]<[Paint]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PaintClass get() = classOf() /** * 获得 [TextPaint] 类型 * @return [Class]<[TextPaint]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TextPaintClass get() = classOf() /** * 获得 [Canvas] 类型 * @return [Class]<[Canvas]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val CanvasClass get() = classOf() /** * 获得 [Point] 类型 * @return [Class]<[Point]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PointClass get() = classOf() /** * 获得 [PointF] 类型 * @return [Class]<[PointF]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val PointFClass get() = classOf() /** * 获得 [Matrix] 类型 * @return [Class]<[Matrix]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val MatrixClass get() = classOf() /** * 获得 [ColorMatrix] 类型 * @return [Class]<[ColorMatrix]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ColorMatrixClass get() = classOf() /** * 获得 [ColorMatrixColorFilter] 类型 * @return [Class]<[ColorMatrixColorFilter]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ColorMatrixColorFilterClass get() = classOf() /** * 获得 [TextUtils] 类型 * @return [Class]<[TextUtils]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TextUtilsClass get() = classOf() /** * 获得 [Editable] 类型 * @return [Class]<[Editable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val EditableClass get() = classOf() /** * 获得 [TextWatcher] 类型 * @return [Class]<[TextWatcher]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TextWatcherClass get() = classOf() /** * 获得 [Editable.Factory] 类型 * @return [Class]<[Editable.Factory]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val Editable_FactoryClass get() = classOf() /** * 获得 [GetChars] 类型 * @return [Class]<[GetChars]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val GetCharsClass get() = classOf() /** * 获得 [Spannable] 类型 * @return [Class]<[Spannable]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SpannableClass get() = classOf() /** * 获得 [SpannableStringBuilder] 类型 * @return [Class]<[SpannableStringBuilder]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SpannableStringBuilderClass get() = classOf() /** * 获得 [BitmapFactory] 类型 * @return [Class]<[BitmapFactory]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BitmapFactoryClass get() = classOf() /** * 获得 [BitmapFactory.Options] 类型 * @return [Class]<[BitmapFactory.Options]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val BitmapFactory_OptionsClass get() = classOf() \ No newline at end of file diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt index a916e5f4..27832cfc 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt @@ -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() /** * 获得 [Surface] 类型 * @return [Class]<[Surface]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SurfaceClass get() = classOf() /** * 获得 [SurfaceView] 类型 * @return [Class]<[SurfaceView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val SurfaceViewClass get() = classOf() /** * 获得 [TextureView] 类型 * @return [Class]<[TextureView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TextureViewClass get() = classOf() /** * 获得 [WebView] 类型 * @return [Class]<[WebView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WebViewClass get() = classOf() /** * 获得 [WebViewClient] 类型 * @return [Class]<[WebViewClient]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val WebViewClientClass get() = classOf() /** * 获得 [ViewStructure] 类型 * @return [Class]<[ViewStructure]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ViewStructureClass get() = classOf() /** * 获得 [ViewGroup] 类型 * @return [Class]<[ViewGroup]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ViewGroupClass get() = classOf() /** * 获得 [ViewParent] 类型 * @return [Class]<[ViewParent]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ViewParentClass get() = classOf() /** * 获得 [AppWidgetHostView] 类型 * @return [Class]<[AppWidgetHostView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val AppWidgetHostViewClass get() = classOf() /** * 获得 [RemoteViews] 类型 * @return [Class]<[RemoteViews]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val RemoteViewsClass get() = classOf() /** * 获得 [RemoteView] 类型 * @return [Class]<[RemoteView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val RemoteViewClass get() = classOf() /** * 获得 [TextView] 类型 * @return [Class]<[TextView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val TextViewClass get() = classOf() /** * 获得 [ImageView] 类型 * @return [Class]<[ImageView]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ImageViewClass get() = classOf() /** * 获得 [ImageButton] 类型 * @return [Class]<[ImageButton]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ImageButtonClass get() = classOf() /** * 获得 [EditText] 类型 * @return [Class]<[EditText]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val EditTextClass get() = classOf() /** * 获得 [Button] 类型 * @return [Class]<[Button]> */ +@Deprecated(ReflectionMigration.KAVAREF_INFO) val ButtonClass get() = classOf