11 Commits

21 changed files with 87 additions and 91 deletions

2
.idea/kotlinc.xml generated
View File

@@ -7,6 +7,6 @@
<option name="additionalArguments" value="-version -Xopt-in=kotlin.RequiresOptIn" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.1.10" />
<option name="version" value="2.2.10" />
</component>
</project>

View File

@@ -31,6 +31,11 @@
有关支持性的相关信息,你可以直接 [点击这里](https://highcapable.github.io/YukiHookAPI/zh-cn/guide/supportive) 进行查看。
| <img src="https://github.com/HighCapable/KavaRef/blob/main/img-src/icon.svg?raw=true" width = "30" height = "30" alt="LOGO"/> | [KavaRef](https://github.com/HighCapable/KavaRef) |
|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
🚀 `YukiHookAPI` 正使用 `KavaRef` 作为反射 API 强力驱动,**点击上方链接 star 这个项目**,你也可以优雅地使用它!
## 合作项目
以下是经过合作并稳定使用 `YukiHookAPI` 的项目。

View File

@@ -32,6 +32,12 @@ Formerly the Innocent Xposed API used in [Development Learning Project](https://
For supportive related information, you can check it directly [click here](https://highcapable.github.io/YukiHookAPI/en/guide/supportive).
| <img src="https://github.com/HighCapable/KavaRef/blob/main/img-src/icon.svg?raw=true" width = "30" height = "30" alt="LOGO"/> | [KavaRef](https://github.com/HighCapable/KavaRef) |
|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
🚀 `YukiHookAPI` is using `KavaRef` as a powerful driver for the reflection API.
**Click on the link above star project**, and you can also use it gracefully!
## Cooperations
The following are projects that have collaborated and are using `YukiHookAPI`.

View File

@@ -1,7 +1,23 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
autowire(libs.plugins.android.application) apply false
autowire(libs.plugins.android.library) apply false
autowire(libs.plugins.kotlin.jvm) apply false
autowire(libs.plugins.kotlin.android) apply false
autowire(libs.plugins.kotlin.ksp) apply false
}
allprojects {
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs.addAll(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
}

View File

@@ -1,6 +1,6 @@
# Contact Us
> If you have any questions in use, or have any constructive suggestions, you can contact us.
> If you have any questions during usage, or have any constructive suggestions, you can contact us.
Join our developers group.

View File

@@ -1,4 +1,4 @@
# Looking for Future
# Looking Toward the Future
> The future is bright and uncertain, let us look forward to the future development space of `YukiHookAPI`.

View File

@@ -1,4 +1,4 @@
# Introduce
# Introduction
> `YukiHookAPI` is an integrated Hook API Framework, which does not provide any Hook functions, and needs the support of Xposed related basic APIs.

View File

@@ -6,9 +6,9 @@
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 (It is recommended to get the latest version [from here](https://developer.android.com/studio))
- Android Studio (It is recommended to get the latest version from [here](https://developer.android.com/studio))
- IntelliJ IDEA (It is recommended to get the latest version [from here](https://www.jetbrains.com/idea))
- IntelliJ IDEA (It is recommended to get the latest version from [here](https://www.jetbrains.com/idea))
- Kotlin 1.9.0+, Gradle 8+, Java 11, 17+, Android Gradle Plugin 8+
@@ -73,7 +73,7 @@ libraries:
After adding it, run Gradle Sync and all dependencies will be autowired.
Next, deploy plugins in your project `build.gradle.kts`.
Next, deploy plugins in your project's `build.gradle.kts`.
> The following example
@@ -85,7 +85,7 @@ plugins {
}
```
Then, deploy dependencies in your project `build.gradle.kts`.
Then, deploy dependencies in your project's `build.gradle.kts`.
> The following example
@@ -105,7 +105,7 @@ dependencies {
#### Version Catalog
Add repositories in your project `build.gradle.kts`.
Add repositories in your project's `build.gradle.kts`.
> Kotlin DSL
@@ -113,8 +113,8 @@ Add repositories in your project `build.gradle.kts`.
repositories {
google()
mavenCentral()
// Must be added when used as an Xposed Module, otherwise optional
maven { url("https://api.xposed.info/") }
// Must be added when used as an Xposed Module, otherwise optional
maven("https://api.xposed.info/")
}
```
@@ -145,7 +145,7 @@ kavaref-extension = { module = "com.highcapable.kavaref:kavaref-extension", vers
xposed-api = { module = "de.robv.android.xposed:api", version = "82" }
```
Next, deploy plugins in your project `build.gradle.kts`.
Next, deploy plugins in your project's `build.gradle.kts`.
> Kotlin DSL
@@ -156,7 +156,7 @@ plugins {
}
```
Then, deploy dependencies in your project `build.gradle.kts`.
Then, deploy dependencies in your project's `build.gradle.kts`.
> Kotlin DSL
@@ -176,7 +176,7 @@ dependencies {
#### Traditional Method
Add repositories in your project `build.gradle.kts`.
Add repositories in your project's `build.gradle.kts`.
> Kotlin DSL
@@ -185,11 +185,11 @@ repositories {
google()
mavenCentral()
// Must be added when used as an Xposed Module, otherwise optional
maven { url("https://api.xposed.info/") }
maven("https://api.xposed.info/")
}
```
Add plugins in your project `build.gradle.kts`.
Add plugins in your project's `build.gradle.kts`.
> Kotlin DSL
@@ -200,7 +200,7 @@ plugins {
}
```
Add dependencies in your project `build.gradle.kts`.
Add dependencies in your project's `build.gradle.kts`.
> Kotlin DSL

View File

@@ -20,7 +20,7 @@ features:
details: Natively supports multiple Xposed API usages and natively connects to multiple Xposed APIs, Hook Frameworks within the supported range can be quickly integrated.
- title: Obfuscate Support
details: The built Xposed Module simply supports R8, obfuscate will not destroy the hook entry point, and no other configuration is required under R8.
- title: Quickly Started
- title: Quick to Start
details: Simple and easy to use it now! Do not need complex configuration and full development experience, Integrate dependencies and enjoy yourself.
footer: Apache-2.0 License | Copyright (C) 2019 HighCapable
---

View File

@@ -6,9 +6,9 @@
项目需要使用 `Android Studio``IntelliJ IDEA` 创建且类型为 Android 项目并已集成 Kotlin 环境依赖。
- Android Studio (建议 [这里](https://developer.android.com/studio) 获取最新版本)
- Android Studio (建议 [这里](https://developer.android.com/studio) 获取最新版本)
- IntelliJ IDEA (建议 [这里](https://www.jetbrains.com/idea) 获取最新版本)
- IntelliJ IDEA (建议 [这里](https://www.jetbrains.com/idea) 获取最新版本)
- Kotlin 1.9.0+、Gradle 8+、Java 11、17+、Android Gradle Plugin 8+
@@ -114,7 +114,7 @@ repositories {
google()
mavenCentral()
// 作为 Xposed 模块使用务必添加,其它情况可选
maven { url("https://api.xposed.info/") }
maven("https://api.xposed.info/")
}
```
@@ -185,7 +185,7 @@ repositories {
google()
mavenCentral()
// 作为 Xposed 模块使用务必添加,其它情况可选
maven { url("https://api.xposed.info/") }
maven("https://api.xposed.info/")
}
```

View File

@@ -3,7 +3,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.code.style=official
kotlin.incremental.useClasspathSnapshot=true
# Project Configuration
project.name=YukiHookAPI
project.url=https://github.com/HighCapable/YukiHookAPI
@@ -12,9 +11,9 @@ project.yukihookapi-core.moduleName=api
project.yukihookapi-core.version="1.3.0"
project.yukihookapi-ksp-xposed.moduleName=ksp-xposed
project.yukihookapi-ksp-xposed.version=${project.yukihookapi-core.version}
project.android.compileSdk=35
project.android.compileSdk=36
project.android.minSdk=21
project.android.targetSdk=35
project.android.targetSdk=36
project.samples-demo-app.packageName=${project.groupName}.demo_app
project.samples-demo-app.versionName=universal
project.samples-demo-app.versionCode=1

View File

@@ -19,22 +19,22 @@ repositories:
plugins:
org.jetbrains.kotlin.jvm:
alias: kotlin-jvm
version: 2.1.10
version: 2.2.10
org.jetbrains.kotlin.android:
alias: kotlin-android
version-ref: kotlin-jvm
com.google.devtools.ksp:
alias: kotlin-ksp
version: 2.1.10-1.0.31
version: 2.2.10-2.0.2
com.android.application:
alias: android-application
version: 8.9.3
version: 8.12.1
com.android.library:
alias: android-library
version-ref: android-application
com.vanniktech.maven.publish:
alias: maven-publish
version: 0.33.0
version: 0.34.0
libraries:
de.robv.android.xposed:
@@ -56,9 +56,9 @@ libraries:
version: 1.2.0
com.highcapable.kavaref:
kavaref-core:
version: 1.0.0
version: 1.0.1
kavaref-extension:
version: 1.0.0
version: 1.0.1
com.highcapable.hikage:
hikage-core:
version: 1.0.1
@@ -72,11 +72,11 @@ libraries:
version: 1.0.0
com.highcapable.betterandroid:
ui-component:
version: 1.0.7
version: 1.0.8
ui-extension:
version: 1.0.6
version: 1.0.7
system-extension:
version: 1.0.2
version: 1.0.3
androidx.annotation:
annotation:
version: 1.9.1
@@ -85,13 +85,13 @@ libraries:
version: 1.2.1
androidx.core:
core-ktx:
version: 1.16.0
version: 1.17.0
androidx.appcompat:
appcompat:
version: 1.7.1
androidx.lifecycle:
lifecycle-viewmodel-ktx:
version: 2.9.1
version: 2.9.2
com.google.android.material:
material:
version: 1.11.0
@@ -101,10 +101,10 @@ libraries:
version: 2.2.1
androidx.test.ext:
junit:
version: 1.2.1
version: 1.3.0
androidx.test.espresso:
espresso-core:
version: 3.6.1
version: 3.7.0
junit:
junit:
version: 4.13.2

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@@ -26,14 +26,6 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
buildFeatures {
buildConfig = true
viewBinding = true

View File

@@ -26,14 +26,6 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
buildFeatures {
buildConfig = true
viewBinding = true

View File

@@ -25,7 +25,7 @@ import android.graphics.drawable.Drawable
import android.util.TypedValue
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import com.highcapable.kavaref.KavaRef.Companion.resolve
import com.highcapable.kavaref.KavaRef.Companion.asResolver
/**
* Fixed [AlertDialog] dialog button issue after injecting Module App's Resources in some Host Apps
@@ -38,9 +38,9 @@ import com.highcapable.kavaref.KavaRef.Companion.resolve
* @return [AlertDialog]
*/
fun AlertDialog.compatStyle(): AlertDialog {
resolve().firstField {
asResolver().firstField {
name = "mAlert"
}.get()?.resolve()?.apply {
}.get()?.asResolver()?.apply {
listOf(
firstField { name = "mButtonPositive" }.get<Button>(),
firstField { name = "mButtonNegative" }.get<Button>(),

View File

@@ -8,7 +8,7 @@ pluginManagement {
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.5"
id("com.highcapable.sweetproperty") version "1.0.8"
}
sweetProperty {
global {

View File

@@ -27,14 +27,6 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
lint { checkReleaseBuilds = false }
}

View File

@@ -42,7 +42,8 @@ import android.os.Handler
import android.os.UserHandle
import androidx.annotation.RequiresApi
import com.highcapable.betterandroid.system.extension.component.registerReceiver
import com.highcapable.betterandroid.system.extension.tool.SystemVersion
import com.highcapable.betterandroid.system.extension.tool.AndroidVersion
import com.highcapable.kavaref.KavaRef.Companion.asResolver
import com.highcapable.kavaref.KavaRef.Companion.resolve
import com.highcapable.kavaref.extension.classOf
import com.highcapable.kavaref.extension.lazyClass
@@ -158,9 +159,9 @@ internal object AppParasitics {
name = "currentActivityThread"
emptyParameters()
}?.invoke()
val currentScope = current?.resolve()?.optional(silent = true)
val currentScope = current?.asResolver()?.optional(silent = true)
val mBoundApplication = currentScope?.firstFieldOrNull { name = "mBoundApplication" }?.get()
val appScope = mBoundApplication?.resolve()?.optional(silent = true)
val appScope = mBoundApplication?.asResolver()?.optional(silent = true)
appScope?.firstFieldOrNull { name = "appInfo" }?.get<ApplicationInfo>()
}
@@ -402,7 +403,7 @@ internal object AppParasitics {
if (YukiXposedModule.isXposedEnvironment) runCatching {
if (currentPackageName == YukiXposedModule.modulePackageName)
return YLog.innerE("You cannot inject module resources into yourself")
hostResources.assets.resolve()
hostResources.assets.asResolver()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstMethodOrNull {
@@ -419,13 +420,13 @@ internal object AppParasitics {
* @param context 当前 [Context]
* @param proxy 代理的 [Activity]
*/
@RequiresApi(SystemVersion.N)
@RequiresApi(AndroidVersion.N)
internal fun registerModuleAppActivities(context: Context, proxy: Any?) {
if (isActivityProxyRegistered) return
if (YukiXposedModule.isXposedEnvironment.not()) return YLog.innerW("You can only register Activity Proxy in Xposed Environment")
if (context.packageName == YukiXposedModule.modulePackageName) return YLog.innerE("You cannot register Activity Proxy into yourself")
@SuppressLint("ObsoleteSdkInt")
if (SystemVersion.isLowTo(SystemVersion.N)) return YLog.innerE("Activity Proxy only support for Android 7.0 (API 24) or higher")
if (AndroidVersion.isAtMost(AndroidVersion.N)) return YLog.innerE("Activity Proxy only support for Android 7.0 (API 24) or higher")
runCatching {
ActivityProxyConfig.apply {
proxyIntentName = "${YukiXposedModule.modulePackageName}.ACTIVITY_PROXY_INTENT"
@@ -457,17 +458,17 @@ internal object AppParasitics {
.optional(silent = true)
.firstFieldOrNull { name = "sCurrentActivityThread" }
?.get()
val instrumentation = sCurrentActivityThread?.resolve()
val instrumentation = sCurrentActivityThread?.asResolver()
?.processor(AndroidHiddenApiBypassResolver.get())
?.optional(silent = true)
?.firstMethodOrNull { name = "getInstrumentation" }
?.invoke<Instrumentation>() ?: error("Could not found Instrumentation in ActivityThread")
sCurrentActivityThread.resolve()
sCurrentActivityThread.asResolver()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstFieldOrNull { name = "mInstrumentation" }
?.set(InstrumentationDelegate.wrapper(instrumentation))
val mH = sCurrentActivityThread.resolve()
val mH = sCurrentActivityThread.asResolver()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstFieldOrNull { name = "mH" }

View File

@@ -30,7 +30,8 @@ import android.os.Bundle
import android.os.Handler
import android.os.IBinder
import android.os.Message
import com.highcapable.betterandroid.system.extension.tool.SystemVersion
import com.highcapable.betterandroid.system.extension.tool.AndroidVersion
import com.highcapable.kavaref.KavaRef.Companion.asResolver
import com.highcapable.kavaref.KavaRef.Companion.resolve
import com.highcapable.kavaref.extension.lazyClass
import com.highcapable.yukihookapi.hook.core.api.reflect.AndroidHiddenApiBypassResolver
@@ -64,7 +65,7 @@ internal object HandlerDelegateCaller {
internal fun callHandleMessage(baseInstance: Handler.Callback?, msg: Message): Boolean {
when (msg.what) {
LAUNCH_ACTIVITY -> {
val intentResolver = msg.obj.resolve()
val intentResolver = msg.obj.asResolver()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstFieldOrNull { name = "intent" }
@@ -85,7 +86,7 @@ internal object HandlerDelegateCaller {
?.invokeQuietly<List<Any>>()
?.takeIf { it.isNotEmpty() }
callbacks?.filter { it.javaClass.name.contains("LaunchActivityItem") }?.forEach { item ->
val itemResolver = item.resolve().optional(silent = true)
val itemResolver = item.asResolver().optional(silent = true)
.firstFieldOrNull { name = "mIntent" }
val intent = itemResolver?.get<Intent>()
val mExtras = mExtrasResolver?.copy()?.of(intent)?.getQuietly<Bundle>()
@@ -93,25 +94,25 @@ internal object HandlerDelegateCaller {
if (intent?.hasExtra(ActivityProxyConfig.proxyIntentName) == true) {
@Suppress("DEPRECATION")
val subIntent = intent.getParcelableExtra<Intent>(ActivityProxyConfig.proxyIntentName)
if (SystemVersion.isHighOrEqualsTo(SystemVersion.S)) {
if (AndroidVersion.isAtLeast(AndroidVersion.S)) {
val currentActivityThread = ActivityThreadClass.resolve()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstMethodOrNull { name = "currentActivityThread" }
?.invoke()
val token = msg.obj.resolve()
val token = msg.obj.asResolver()
.processor(AndroidHiddenApiBypassResolver.get())
.optional(silent = true)
.firstMethodOrNull { name = "getActivityToken" }
?.invokeQuietly()
val launchingActivity = currentActivityThread?.resolve()
val launchingActivity = currentActivityThread?.asResolver()
?.processor(AndroidHiddenApiBypassResolver.get())
?.optional(silent = true)
?.firstMethodOrNull {
name = "getLaunchingActivity"
parameters(IBinder::class)
}?.invokeQuietly(token)
launchingActivity?.resolve()
launchingActivity?.asResolver()
?.processor(AndroidHiddenApiBypassResolver.get())
?.optional(silent = true)
?.firstFieldOrNull { name = "intent" }

View File

@@ -21,14 +21,6 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
lint { checkReleaseBuilds = false }
}