mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Fix a bug when register receiver to system framework (android) in YukiHookDataChannel and AppParasitics
This commit is contained in:
@@ -161,8 +161,7 @@ class YukiHookDataChannel private constructor() {
|
||||
* @param packageName 包名 - 为空获取 [context] 的 [Context.getPackageName]
|
||||
*/
|
||||
internal fun register(context: Context?, packageName: String = context?.packageName ?: "") {
|
||||
if (context == null) return
|
||||
if (YukiHookAPI.Configs.isEnableDataChannel.not() || receiverContext != null) return
|
||||
if (YukiHookAPI.Configs.isEnableDataChannel.not() || context == null) return
|
||||
receiverContext = context
|
||||
context.registerReceiver(
|
||||
handlerReceiver, IntentFilter().apply {
|
||||
|
@@ -69,9 +69,6 @@ import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.Instr
|
||||
*/
|
||||
internal object AppParasitics {
|
||||
|
||||
/** [YukiHookDataChannel] 是否已经注册 */
|
||||
private var isDataChannelRegister = false
|
||||
|
||||
/** [Activity] 代理是否已经注册 */
|
||||
private var isActivityProxyRegister = false
|
||||
|
||||
@@ -230,8 +227,6 @@ internal object AppParasitics {
|
||||
}
|
||||
}, IntentFilter().apply { e.first.forEach { e -> addAction(e) } })
|
||||
}
|
||||
if (isDataChannelRegister) return
|
||||
isDataChannelRegister = true
|
||||
runCatching { YukiHookDataChannel.instance().register(it, packageName) }
|
||||
}
|
||||
}.onFailure { wrapper.throwable = it }
|
||||
|
Reference in New Issue
Block a user