mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Fix non-null context when YukiHookDataChannel sending broadcast
This commit is contained in:
@@ -37,10 +37,12 @@ import android.content.IntentFilter
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
|
import com.highcapable.yukihookapi.hook.log.yLoggerW
|
||||||
import com.highcapable.yukihookapi.hook.utils.putIfAbsentCompat
|
import com.highcapable.yukihookapi.hook.utils.putIfAbsentCompat
|
||||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
|
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
|
||||||
import com.highcapable.yukihookapi.hook.xposed.bridge.YukiHookBridge
|
import com.highcapable.yukihookapi.hook.xposed.bridge.YukiHookBridge
|
||||||
import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData
|
import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.helper.YukiHookAppHelper
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +149,7 @@ class YukiHookDataChannel private constructor() {
|
|||||||
*/
|
*/
|
||||||
internal fun nameSpace(context: Context? = null, packageName: String): NameSpace {
|
internal fun nameSpace(context: Context? = null, packageName: String): NameSpace {
|
||||||
checkApi()
|
checkApi()
|
||||||
return NameSpace(context = context ?: receiverContext, packageName)
|
return NameSpace(context = context ?: receiverContext ?: YukiHookAppHelper.currentApplication(), packageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,7 +281,10 @@ class YukiHookDataChannel private constructor() {
|
|||||||
else -> error("Key-Value type ${it.value?.javaClass?.name} is not allowed")
|
else -> error("Key-Value type ${it.value?.javaClass?.name} is not allowed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}) ?: yLoggerW(
|
||||||
|
msg = "Failed to sendBroadcast like \"${data.takeIf { it.isNotEmpty() }?.get(0)?.key ?: "unknown"}\", " +
|
||||||
|
"because got non-null context in \"$packageName\""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user