diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 88db84ad..f30bc2c7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -56,6 +56,9 @@ + { - if (action == "start") { - context.startService(Intent(context, HttpService::class.java)) - } else if (action == "stop") { - context.stopService(Intent(context, HttpService::class.java)) + Intent(context, HttpService::class.java).also { + if (action == "start") { + context.startService(it) + } else if (action == "stop") { + context.stopService(it) + } + } + } + "system" -> { + //判断是否已root + if (!DeviceUtils.isDeviceRooted()) return + + if (action == "reboot") { + DeviceUtils.reboot() + } else if (action == "shutdown") { + DeviceUtils.shutdown() } } }