Add mount info to log file

This commit is contained in:
vvb2060 2021-07-27 12:03:43 +08:00 committed by John Wu
parent e990ffd4a0
commit 2cbc048352

View File

@ -21,6 +21,7 @@ import com.topjohnwu.magisk.view.TextItem
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.FileInputStream
class LogViewModel( class LogViewModel(
private val repo: LogRepository private val repo: LogRepository
@ -62,10 +63,12 @@ class LogViewModel(
val logFile = MediaStoreUtils.getFile(filename, true) val logFile = MediaStoreUtils.getFile(filename, true)
logFile.uri.outputStream().bufferedWriter().use { file -> logFile.uri.outputStream().bufferedWriter().use { file ->
file.write("---System Properties---\n\n") file.write("---System Properties---\n\n")
ProcessBuilder("getprop").start() ProcessBuilder("getprop").start()
.inputStream.reader().use { it.copyTo(file) } .inputStream.reader().use { it.copyTo(file) }
file.write("---System MountInfo---\n\n")
FileInputStream("/proc/self/mountinfo").reader().use { it.copyTo(file) }
file.write("\n---Magisk Logs---\n") file.write("\n---Magisk Logs---\n")
file.write("${Info.env.magiskVersionString} (${Info.env.magiskVersionCode})\n\n") file.write("${Info.env.magiskVersionString} (${Info.env.magiskVersionCode})\n\n")
file.write(consoleText) file.write(consoleText)