Fix YukiHookDataChannel cannot received current Activity in some device's system

This commit is contained in:
2022-05-29 01:46:02 +08:00
parent ffc141346c
commit 809976cbd7

View File

@@ -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 }
/**