Commit 82f303e1 authored by vvb2060's avatar vvb2060 Committed by John Wu

Allow save app log when not activated

may be useful for patch boot.
parent c038683b
package com.topjohnwu.magisk.data.repository
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.model.su.SuLog
import com.topjohnwu.magisk.data.database.SuLogDao
import com.topjohnwu.magisk.ktx.await
......@@ -27,7 +28,11 @@ class LogRepository(
}
}
}
Shell.su("cat ${Const.MAGISK_LOG}").to(list).await()
if (Info.env.isActive) {
Shell.su("cat ${Const.MAGISK_LOG} || logcat -d -s Magisk").to(list).await()
} else {
Shell.sh("logcat -d").to(list).await()
}
return list.buf.toString()
}
......
......@@ -99,7 +99,6 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
super.onResume()
binding.mainNavigation.menu.apply {
findItem(R.id.superuserFragment)?.isEnabled = Utils.showSuperUser()
findItem(R.id.logFragment)?.isEnabled = Info.env.isActive
}
}
......
......@@ -66,7 +66,7 @@ class LogViewModel(
ProcessBuilder("getprop").start()
.inputStream.reader().use { it.copyTo(file) }
file.write("---System MountInfo---\n\n")
file.write("\n\n---System MountInfo---\n\n")
FileInputStream("/proc/self/mountinfo").reader().use { it.copyTo(file) }
file.write("\n---Magisk Logs---\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment