mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Fix YukiHookDataChannel cannot received current Activity in some device's system
This commit is contained in:
@@ -136,7 +136,8 @@ class YukiHookDataChannel private constructor() {
|
|||||||
*/
|
*/
|
||||||
private fun isCurrentBroadcast(context: Context?) = runCatching {
|
private fun isCurrentBroadcast(context: Context?) = runCatching {
|
||||||
isXposedEnvironment || context?.javaClass?.name == ((context ?: receiverContext)
|
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 }
|
}.getOrNull() ?: loggerW(msg = "Couldn't got current Activity status because a SecurityException blocked it").let { false }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user