mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-30 22:16:38 +00:00
Don't do broadcast tests from app
Running broadcast tests from the app does not accurately verifies whether the broadcasts can be delivered when the app is not running in the foreground, which is why we are running the test. The only sane way to verify broadcasts is to trigger the broadcast test directly from the daemon on boot complete. If it is not deliverable, then activity mode shall be chosen. In the meantime, cleanup AndroidManifest.xml
This commit is contained in:
@@ -24,7 +24,7 @@ object Const {
|
||||
|
||||
object Version {
|
||||
const val MIN_SUPPORT = 18000
|
||||
const val CONNECT_MODE = 20002
|
||||
const val CONNECT_MODE = 20100
|
||||
}
|
||||
|
||||
object ID {
|
||||
|
||||
@@ -37,13 +37,8 @@ object Info {
|
||||
val code = ShellUtils.fastCmd("magisk -V").toInt()
|
||||
val hide = Shell.su("magiskhide --status").exec().isSuccess
|
||||
var mode = -1
|
||||
if (code >= Const.Version.CONNECT_MODE) {
|
||||
if (code >= Const.Version.CONNECT_MODE)
|
||||
mode = Shell.su("magisk --connect-mode").exec().code
|
||||
if (mode == 0) {
|
||||
// Manually trigger broadcast test
|
||||
Shell.su("magisk --broadcast-test").exec()
|
||||
}
|
||||
}
|
||||
Env(code, str, hide, mode)
|
||||
}.getOrElse { Env() }
|
||||
|
||||
|
||||
@@ -51,23 +51,14 @@ open class GeneralReceiver : BaseReceiver() {
|
||||
}
|
||||
|
||||
when (intent.action ?: return) {
|
||||
Intent.ACTION_REBOOT, Intent.ACTION_BOOT_COMPLETED -> {
|
||||
val action = intent.getStringExtra("action")
|
||||
if (action == null) {
|
||||
// Actual boot completed event
|
||||
Shell.su("mm_patch_dtbo").submit {
|
||||
if (it.isSuccess)
|
||||
Notifications.dtboPatched(context)
|
||||
}
|
||||
return
|
||||
}
|
||||
when (action) {
|
||||
Intent.ACTION_REBOOT -> {
|
||||
when (val action = intent.getStringExtra("action") ?: return) {
|
||||
REQUEST -> {
|
||||
val i = context.intent<SuRequestActivity>()
|
||||
.setAction(action)
|
||||
.putExtra("socket", intent.getStringExtra("socket"))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
||||
.setAction(action)
|
||||
.putExtra("socket", intent.getStringExtra("socket"))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
||||
if (SDK_INT >= 29) {
|
||||
// Android Q does not allow starting activity from background
|
||||
i.startActivityWithRoot()
|
||||
@@ -92,7 +83,7 @@ open class GeneralReceiver : BaseReceiver() {
|
||||
Intent.ACTION_PACKAGE_FULLY_REMOVED -> {
|
||||
val pkg = getPkg(intent)
|
||||
policyDB.delete(pkg).blockingGet()
|
||||
"magiskhide --rm $pkg".su().blockingGet()
|
||||
Shell.su("magiskhide --rm $pkg").submit()
|
||||
}
|
||||
Intent.ACTION_LOCALE_CHANGED -> Shortcuts.setup(context)
|
||||
Const.Key.BROADCAST_MANAGER_UPDATE -> {
|
||||
|
||||
@@ -60,6 +60,11 @@ open class SplashActivity : Activity() {
|
||||
// Setup shortcuts
|
||||
Shortcuts.setup(this)
|
||||
|
||||
Shell.su("mm_patch_dtbo").submit {
|
||||
if (it.isSuccess)
|
||||
Notifications.dtboPatched(this)
|
||||
}
|
||||
|
||||
DONE = true
|
||||
|
||||
startActivity(intent<MainActivity>().apply { intent?.also { putExtras(it) } })
|
||||
|
||||
Reference in New Issue
Block a user