Modify remove stub-jar and add stub-project and change the compiled class

This commit is contained in:
2022-09-27 00:34:24 +08:00
parent 3a932dc8b4
commit 1d22f634e1
14 changed files with 127 additions and 30 deletions

View File

@@ -46,6 +46,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
dependencies {
// Used 82 API Version
compileOnly 'de.robv.android.xposed:api:82'
compileOnly project(':yukihookapi-stub')
compileOnly fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.annotation:annotation:1.4.0'
}

Binary file not shown.

Binary file not shown.

View File

@@ -92,7 +92,7 @@ object YukiHookAPI {
* 获取项目编译完成的时间戳 (当前本地时间)
* @return [Long]
*/
val compiledTimestamp get() = YukiHookBridge.moduleGeneratedVersion.toLongOrNull() ?: 0L
val compiledTimestamp get() = YukiHookBridge.compiledTimestamp
/**
* 获取当前是否为 (Xposed) 宿主环境

View File

@@ -31,7 +31,6 @@ import android.app.Application
import android.content.Context
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
import com.highcapable.yukihookapi.hook.xposed.application.inject.ModuleApplication_Injector
import com.highcapable.yukihookapi.hook.xposed.channel.YukiHookDataChannel
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
import com.highcapable.yukihookapi.thirdparty.me.weishu.reflection.Reflection
@@ -82,10 +81,8 @@ open class ModuleApplication : Application() {
override fun onCreate() {
super.onCreate()
currentContext = this
callApiInit()
/** 调用 Hook 入口类的 [IYukiHookXposedInit.onInit] 方法 */
runCatching { ModuleApplication_Impl.callHookEntryInit() }
YukiHookDataChannel.instance().register(context = this)
}
/** 调用入口类的 [IYukiHookXposedInit.onInit] 方法 */
private fun callApiInit() = runCatching { ModuleApplication_Injector.callApiInit() }
}

View File

@@ -39,7 +39,6 @@ import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.param.type.HookEntryType
import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper
import com.highcapable.yukihookapi.hook.xposed.bridge.dummy.YukiResources
import com.highcapable.yukihookapi.hook.xposed.bridge.inject.YukiHookBridge_Injector
import com.highcapable.yukihookapi.hook.xposed.helper.YukiHookAppHelper
import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics
import dalvik.system.PathClassLoader
@@ -88,11 +87,19 @@ object YukiHookBridge {
*/
internal val hostProcessName get() = if (isInitializingZygote) "android-zygote" else YukiHookAppHelper.currentPackageName() ?: "unknown"
/**
* 获取项目编译完成的时间戳 (当前本地时间)
* @return [Long]
*/
internal val compiledTimestamp get() = runCatching { YukiHookBridge_Impl.compiledTimestamp }.getOrNull() ?: 0L
/**
* 自动生成的 Xposed 模块构建版本号
*
* 获取 [compiledTimestamp] 并转换为字符串
* @return [String]
*/
internal val moduleGeneratedVersion get() = YukiHookBridge_Injector.getModuleGeneratedVersion()
internal val moduleGeneratedVersion get() = compiledTimestamp.toString()
/**
* 预设的 Xposed 模块包名