diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/bean/GenericClass.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/bean/GenericClass.kt index ed40c287..934267d0 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/bean/GenericClass.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/bean/GenericClass.kt @@ -25,6 +25,8 @@ * * This file is Created by fankes on 2022/9/20. */ +@file:Suppress("unused") + package com.highcapable.yukihookapi.hook.bean import java.lang.reflect.ParameterizedType diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt index 82ea7506..0a468ab2 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt @@ -236,7 +236,7 @@ internal object ReflectionTool { } findDexClassList(loaderSet).takeIf { it.isNotEmpty() }?.forEach { className -> /** 分离包名 → com.demo.Test → com.demo (获取最后一个 "." + 简单类名的长度) → 由于末位存在 "." 最后要去掉 1 个长度 */ - (if (className.contains(other = ".")) + (if (className.contains(".")) className.substring(0, className.length - className.split(".").let { it[it.lastIndex] }.length - 1) else className).also { packageName -> if ((fromPackages.isEmpty() || fromPackages.any { diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt index 1ded2af8..2751e59d 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt @@ -411,7 +411,7 @@ inline fun Class<*>.allFields(result: (index: Int, field: Field) -> Unit) = @PublishedApi internal fun Class<*>.checkingInternal() { if (name == classOf().name) return - if (name == classOf().name || name.startsWith(prefix = "com.highcapable.yukihookapi.hook")) throw RuntimeException( + if (name == classOf().name || name.startsWith("com.highcapable.yukihookapi.hook")) throw RuntimeException( "!!!DO NOT ALLOWED!!! You cannot hook or reflection to call the internal class of the YukiHookAPI itself, " + "The called class is [$this]" ) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt index 62714acf..42e2c255 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt @@ -143,7 +143,7 @@ internal object AppParasitics { if (YukiHookAPI.Configs.isEnableHookSharedPreferences && type == HookEntryType.PACKAGE) YukiHookHelper.hook(ContextImplClass.method { name = "setFilePermissionsFromMode" }, object : YukiMemberHook() { override fun beforeHookedMember(param: Param) { - if ((param.args?.get(0) as? String?)?.endsWith(suffix = "preferences.xml") == true) param.args?.set(1, 1) + if ((param.args?.get(0) as? String?)?.endsWith("preferences.xml") == true) param.args?.set(1, 1) } }) if (YukiHookAPI.Configs.isEnableHookModuleStatus) classOf(loader).apply { diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/HandlerDelegate.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/HandlerDelegate.kt index 53238b36..ad12efdb 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/HandlerDelegate.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/HandlerDelegate.kt @@ -82,7 +82,7 @@ internal class HandlerDelegate private constructor(private val baseInstance: Han EXECUTE_TRANSACTION -> msg.obj?.runCatching client@{ ClientTransactionClass.method { name = "getCallbacks" }.ignored().get(this).list().takeIf { it.isNotEmpty() } ?.forEach { item -> - item?.current(ignored = true)?.takeIf { it.name.contains(other = "LaunchActivityItem") }?.field { name = "mIntent" } + item?.current(ignored = true)?.takeIf { it.name.contains("LaunchActivityItem") }?.field { name = "mIntent" } ?.apply { cast()?.also { intent -> IntentClass.field { name = "mExtras" }.ignored().get(intent).cast()