From fded1d1e3c992b9a56254c29a546a13a6b39fdde Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Sat, 4 Mar 2023 23:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E6=8C=87=E4=BB=A4`smsf#system#reboot`=E5=92=8C`smsf#system#shu?= =?UTF-8?q?tdown`=EF=BC=88=E8=AF=95=E9=AA=8C=E6=80=A7=EF=BC=8C=E4=BB=85?= =?UTF-8?q?=E9=80=82=E7=94=A8root=E8=BF=87=E7=9A=84=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 3 +++ .../sms/forwarder/receiver/SmsReceiver.kt | 21 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) 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() } } }