mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-02 17:07:41 +08:00
新增:短信指令smsf#system#reboot
和smsf#system#shutdown
(试验性,仅适用root过的机器)
This commit is contained in:
parent
197fb7ac36
commit
fded1d1e3c
@ -56,6 +56,9 @@
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_LOGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission
|
||||
android:name="android.permission.REBOOT"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
|
@ -19,6 +19,7 @@ import com.idormy.sms.forwarder.utils.Worker
|
||||
import com.idormy.sms.forwarder.workers.SendWorker
|
||||
import com.xuexiang.xrouter.utils.TextUtils
|
||||
import com.xuexiang.xutil.file.FileUtils
|
||||
import com.xuexiang.xutil.system.DeviceUtils
|
||||
import frpclib.Frpclib
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -192,10 +193,22 @@ class SmsReceiver : BroadcastReceiver() {
|
||||
}
|
||||
}
|
||||
"httpserver" -> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user