mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-05 18:25:28 +08:00
Modify ignored CurrentClass error in AppParasitics and HandlerDelegate
This commit is contained in:
@@ -258,7 +258,7 @@ internal object AppParasitics {
|
|||||||
internal fun injectModuleAppResources(hostResources: Resources) {
|
internal fun injectModuleAppResources(hostResources: Resources) {
|
||||||
if (injectedHostResourcesHashCodes.contains(hostResources.hashCode())) return
|
if (injectedHostResourcesHashCodes.contains(hostResources.hashCode())) return
|
||||||
if (YukiHookBridge.hasXposedBridge) runCatching {
|
if (YukiHookBridge.hasXposedBridge) runCatching {
|
||||||
hostResources.assets.current().method { name = "addAssetPath"; param(StringType) }.call(moduleAppFilePath)
|
hostResources.assets.current(ignored = true).method { name = "addAssetPath"; param(StringType) }.call(moduleAppFilePath)
|
||||||
injectedHostResourcesHashCodes.add(hostResources.hashCode())
|
injectedHostResourcesHashCodes.add(hostResources.hashCode())
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
yLoggerE(msg = "Failed to inject module resources into [$hostResources]", e = it)
|
yLoggerE(msg = "Failed to inject module resources into [$hostResources]", e = it)
|
||||||
@@ -297,7 +297,7 @@ internal object AppParasitics {
|
|||||||
else error("Could not found \"$proxyClassName\" or Class is not a type of Activity"))
|
else error("Could not found \"$proxyClassName\" or Class is not a type of Activity"))
|
||||||
}
|
}
|
||||||
/** Patched [Instrumentation] */
|
/** Patched [Instrumentation] */
|
||||||
ActivityThreadClass.field { name = "sCurrentActivityThread" }.ignored().get().any()?.current {
|
ActivityThreadClass.field { name = "sCurrentActivityThread" }.ignored().get().any()?.current(ignored = true) {
|
||||||
method { name = "getInstrumentation" }
|
method { name = "getInstrumentation" }
|
||||||
.invoke<Instrumentation>()
|
.invoke<Instrumentation>()
|
||||||
?.also { field { name = "mInstrumentation" }.set(InstrumentationDelegate.wrapper(it)) }
|
?.also { field { name = "mInstrumentation" }.set(InstrumentationDelegate.wrapper(it)) }
|
||||||
|
@@ -70,7 +70,7 @@ internal class HandlerDelegate private constructor(private val baseInstance: Han
|
|||||||
override fun handleMessage(msg: Message): Boolean {
|
override fun handleMessage(msg: Message): Boolean {
|
||||||
when (msg.what) {
|
when (msg.what) {
|
||||||
LAUNCH_ACTIVITY -> runCatching {
|
LAUNCH_ACTIVITY -> runCatching {
|
||||||
msg.obj.current().field { name = "intent" }.apply {
|
msg.obj.current(ignored = true).field { name = "intent" }.apply {
|
||||||
cast<Intent?>()?.also { intent ->
|
cast<Intent?>()?.also { intent ->
|
||||||
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
||||||
?.classLoader = YukiHookAppHelper.currentApplication()?.classLoader
|
?.classLoader = YukiHookAppHelper.currentApplication()?.classLoader
|
||||||
@@ -82,23 +82,24 @@ internal class HandlerDelegate private constructor(private val baseInstance: Han
|
|||||||
EXECUTE_TRANSACTION -> msg.obj?.runCatching client@{
|
EXECUTE_TRANSACTION -> msg.obj?.runCatching client@{
|
||||||
ClientTransactionClass.method { name = "getCallbacks" }.ignored().get(this).list<Any?>().takeIf { it.isNotEmpty() }
|
ClientTransactionClass.method { name = "getCallbacks" }.ignored().get(this).list<Any?>().takeIf { it.isNotEmpty() }
|
||||||
?.forEach { item ->
|
?.forEach { item ->
|
||||||
item?.current()?.takeIf { it.name.contains(other = "LaunchActivityItem") }?.field { name = "mIntent" }?.apply {
|
item?.current(ignored = true)?.takeIf { it.name.contains(other = "LaunchActivityItem") }?.field { name = "mIntent" }
|
||||||
cast<Intent?>()?.also { intent ->
|
?.apply {
|
||||||
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
cast<Intent?>()?.also { intent ->
|
||||||
?.classLoader = YukiHookAppHelper.currentApplication()?.classLoader
|
IntentClass.field { name = "mExtras" }.ignored().get(intent).cast<Bundle?>()
|
||||||
if (intent.hasExtra(ActivityProxyConfig.proxyIntentName))
|
?.classLoader = YukiHookAppHelper.currentApplication()?.classLoader
|
||||||
intent.getParcelableExtra<Intent>(ActivityProxyConfig.proxyIntentName).also { subIntent ->
|
if (intent.hasExtra(ActivityProxyConfig.proxyIntentName))
|
||||||
if (Build.VERSION.SDK_INT >= 31)
|
intent.getParcelableExtra<Intent>(ActivityProxyConfig.proxyIntentName).also { subIntent ->
|
||||||
ActivityThreadClass.method {
|
if (Build.VERSION.SDK_INT >= 31)
|
||||||
name = "getLaunchingActivity"
|
ActivityThreadClass.method { name = "currentActivityThread" }.ignored().get().call()
|
||||||
param(IBinderClass)
|
?.current(ignored = true)?.method {
|
||||||
}.ignored().get(ActivityThreadClass.method { name = "currentActivityThread" }.ignored().get().call())
|
name = "getLaunchingActivity"
|
||||||
.call(this@client.current().method { name = "getActivityToken" }.call())
|
param(IBinderClass)
|
||||||
?.current()?.field { name = "intent" }?.set(subIntent)
|
}?.call(this@client.current(ignored = true).method { name = "getActivityToken" }.call())
|
||||||
set(subIntent)
|
?.current(ignored = true)?.field { name = "intent" }?.set(subIntent)
|
||||||
}
|
set(subIntent)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}?.onFailure { yLoggerE(msg = "Activity Proxy got an Exception in msg.what [$EXECUTE_TRANSACTION]", e = it) }
|
}?.onFailure { yLoggerE(msg = "Activity Proxy got an Exception in msg.what [$EXECUTE_TRANSACTION]", e = it) }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user