From 809976cbd766d3e70b54a1d8463ef19f01f0614e Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Sun, 29 May 2022 01:46:02 +0800 Subject: [PATCH] Fix YukiHookDataChannel cannot received current Activity in some device's system --- .../yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt index ab13e459..00448c28 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt @@ -136,7 +136,8 @@ class YukiHookDataChannel private constructor() { */ private fun isCurrentBroadcast(context: Context?) = runCatching { isXposedEnvironment || context?.javaClass?.name == ((context ?: receiverContext) - ?.getSystemService(ACTIVITY_SERVICE) as? ActivityManager?)?.getRunningTasks(1)?.get(0)?.topActivity?.className + ?.getSystemService(ACTIVITY_SERVICE) as? ActivityManager?) + ?.getRunningTasks(9999)?.let { it[it.lastIndex]?.topActivity?.className } }.getOrNull() ?: loggerW(msg = "Couldn't got current Activity status because a SecurityException blocked it").let { false } /**