mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
Compare commits
7 Commits
61c0c5960b
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
a82de55694 | ||
59c4b9870b
|
|||
|
bab5068484 | ||
e1544a8ae3
|
|||
276503ccf4
|
|||
36bb1bf108
|
|||
edb22f1bd3
|
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
@@ -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>
|
@@ -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"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
@@ -19,16 +19,16 @@ 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
|
||||
@@ -61,15 +61,15 @@ libraries:
|
||||
version: 1.0.1
|
||||
com.highcapable.hikage:
|
||||
hikage-core:
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
hikage-compiler:
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
hikage-extension:
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
hikage-widget-androidx:
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
hikage-widget-material:
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
com.highcapable.betterandroid:
|
||||
ui-component:
|
||||
version: 1.0.8
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
@@ -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 }
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
package com.highcapable.yukihookapi.hook.core
|
||||
|
||||
import com.highcapable.kavaref.extension.classOf
|
||||
import com.highcapable.kavaref.extension.isNotSubclassOf
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
import com.highcapable.yukihookapi.hook.bean.HookClass
|
||||
@@ -545,6 +546,7 @@ class YukiMemberHookCreator internal constructor(private val packageParam: Packa
|
||||
*/
|
||||
private fun checkingReturnType(origin: Class<*>?, target: Class<*>?) {
|
||||
if (origin == null || target == null) return
|
||||
if (origin == classOf<Any>()) return
|
||||
origin.toJavaPrimitiveType().also { o ->
|
||||
target.toJavaPrimitiveType().also { t ->
|
||||
if (o isNotSubclassOf t && t isNotSubclassOf o)
|
||||
@@ -843,7 +845,7 @@ class YukiMemberHookCreator internal constructor(private val packageParam: Packa
|
||||
* 监听 [members] 重复 Hook 的回调方法
|
||||
*
|
||||
* - 此方法及功能已被移除 - 在之后的版本中将直接被删除
|
||||
*
|
||||
*
|
||||
* - 不再限制重复 Hook 操作
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
|
@@ -42,7 +42,7 @@ 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
|
||||
@@ -216,7 +216,7 @@ internal object AppParasitics {
|
||||
if (isClassLoaderHooked) return
|
||||
val loadClass = ClassLoader::class.resolve()
|
||||
.optional(silent = true)
|
||||
.firstMethodOrNull {
|
||||
.firstMethodOrNull {
|
||||
name = "loadClass"
|
||||
parameters(String::class, Boolean::class)
|
||||
}
|
||||
@@ -420,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"
|
||||
@@ -509,16 +509,18 @@ internal object AppParasitics {
|
||||
?.optional(silent = true)
|
||||
?.firstFieldOrNull { name = "IActivityTaskManagerSingleton" }
|
||||
?.get()
|
||||
SingletonClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional(silent = true)
|
||||
.firstMethodOrNull { name = "get" }
|
||||
?.of(singleton)
|
||||
?.invokeQuietly()
|
||||
val mInstanceResolver2 = mInstanceResolver?.copy()?.of(singleton)
|
||||
val mInstance2 = mInstanceResolver2?.get()
|
||||
mInstance2?.let {
|
||||
mInstanceResolver2.set(IActivityManagerProxyImpl.createWrapper(IActivityTaskManagerClass, it))
|
||||
singleton?.let {
|
||||
SingletonClass.resolve()
|
||||
.processor(AndroidHiddenApiBypassResolver.get())
|
||||
.optional(silent = true)
|
||||
.firstMethodOrNull { name = "get" }
|
||||
?.of(singleton)
|
||||
?.invokeQuietly()
|
||||
val mInstanceResolver2 = mInstanceResolver?.copy()?.of(singleton)
|
||||
val mInstance2 = mInstanceResolver2?.get()
|
||||
mInstance2?.let {
|
||||
mInstanceResolver2.set(IActivityManagerProxyImpl.createWrapper(IActivityTaskManagerClass, it))
|
||||
}
|
||||
}
|
||||
isActivityProxyRegistered = true
|
||||
}.onFailure { YLog.innerE("Activity Proxy initialization failed because got an exception", it) }
|
||||
|
@@ -30,7 +30,7 @@ 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
|
||||
@@ -94,7 +94,7 @@ 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)
|
||||
|
@@ -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 }
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user