Magisk/app/src/main/java/com/topjohnwu/magisk/utils/XSU.kt
Viktor De Pasquale b018124226 Added (ported back) features from initial design [retrofit,moshi,kotpref]
Marked most of the old classes using Networking as deprecated to clearly visualise their future removal
2019-05-06 19:03:28 +02:00

19 lines
542 B
Kotlin

package com.topjohnwu.magisk.utils
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFileInputStream
import com.topjohnwu.superuser.io.SuFileOutputStream
import java.io.File
fun reboot(recovery: Boolean = false): Shell.Result {
val command = StringBuilder("/system/bin/reboot")
.appendIf(recovery) {
append(" recovery")
}
.toString()
return Shell.su(command).exec()
}
fun File.suOutputStream() = SuFileOutputStream(this)
fun File.suInputStream() = SuFileInputStream(this)