Don't use root for logging getprop

Might contain sensitive info that shouldn't be shared
This commit is contained in:
topjohnwu 2020-12-19 23:09:13 -08:00
parent 8ed2dd6687
commit d089698475

View File

@ -18,12 +18,9 @@ import com.topjohnwu.magisk.ktx.timeFormatStandard
import com.topjohnwu.magisk.ktx.toTime import com.topjohnwu.magisk.ktx.toTime
import com.topjohnwu.magisk.utils.set import com.topjohnwu.magisk.utils.set
import com.topjohnwu.magisk.view.TextItem import com.topjohnwu.magisk.view.TextItem
import com.topjohnwu.superuser.CallbackList
import com.topjohnwu.superuser.Shell
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.util.concurrent.Executor
class LogViewModel( class LogViewModel(
private val repo: LogRepository private val repo: LogRepository
@ -66,13 +63,8 @@ class LogViewModel(
logFile.uri.outputStream().bufferedWriter().use { file -> logFile.uri.outputStream().bufferedWriter().use { file ->
file.write("---System Properties---\n\n") file.write("---System Properties---\n\n")
val fileList = object : CallbackList<String>(Executor { it.run() }) { ProcessBuilder("getprop").start()
override fun onAddElement(e: String) { .inputStream.reader().use { it.copyTo(file) }
file.write(e)
file.newLine()
}
}
Shell.su("getprop").to(fileList).exec()
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")