refactor: big modified

- update dependencies
- migration reflection api to KavaRef
- merge to new api usage
This commit is contained in:
2025-06-16 17:05:06 +08:00
parent cca6e1d2a8
commit c8f1e3441e
191 changed files with 2794 additions and 583 deletions

View File

@@ -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()
```