Fix dataChannel cannot callback in Xposed Environment in YukiHookDataChannel

This commit is contained in:
2022-10-04 05:21:28 +08:00
parent 69465d0405
commit 9da3ecaefe

View File

@@ -136,7 +136,7 @@ class YukiHookDataChannel private constructor() {
* @return [Boolean] * @return [Boolean]
*/ */
private fun isCurrentBroadcast(context: Context?) = runCatching { private fun isCurrentBroadcast(context: Context?) = runCatching {
isXposedEnvironment || (((context ?: receiverContext) context is Application || isXposedEnvironment || (((context ?: receiverContext)
?.getSystemService(ACTIVITY_SERVICE) as? ActivityManager?) ?.getSystemService(ACTIVITY_SERVICE) as? ActivityManager?)
?.getRunningTasks(9999)?.filter { context?.javaClass?.name == it?.topActivity?.className }?.size ?: 0) > 0 ?.getRunningTasks(9999)?.filter { context?.javaClass?.name == it?.topActivity?.className }?.size ?: 0) > 0
}.getOrNull() ?: yLoggerW(msg = "Couldn't got current Activity status because a SecurityException blocked it").let { false } }.getOrNull() ?: yLoggerW(msg = "Couldn't got current Activity status because a SecurityException blocked it").let { false }