manager: use global mnt shell to aovid nsenter
This commit is contained in:
@@ -25,10 +25,13 @@ private fun getKsuDaemonPath(): String {
|
|||||||
|
|
||||||
object KsuCli {
|
object KsuCli {
|
||||||
val SHELL: Shell = createRootShell()
|
val SHELL: Shell = createRootShell()
|
||||||
|
val GLOBAL_MNT_SHELL: Shell = createRootShell(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRootShell(): Shell {
|
fun getRootShell(globalMnt: Boolean = false): Shell {
|
||||||
return KsuCli.SHELL
|
return if (globalMnt) KsuCli.GLOBAL_MNT_SHELL else {
|
||||||
|
KsuCli.SHELL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createRootShell(globalMnt: Boolean = false): Shell {
|
fun createRootShell(globalMnt: Boolean = false): Shell {
|
||||||
@@ -156,8 +159,8 @@ fun overlayFsAvailable(): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun hasMagisk(): Boolean {
|
fun hasMagisk(): Boolean {
|
||||||
val shell = getRootShell()
|
val shell = getRootShell(true)
|
||||||
val result = shell.newJob().add("nsenter --mount=/proc/1/ns/mnt which magisk").exec()
|
val result = shell.newJob().add("which magisk").exec()
|
||||||
Log.i(TAG, "has magisk: ${result.isSuccess}")
|
Log.i(TAG, "has magisk: ${result.isSuccess}")
|
||||||
return result.isSuccess
|
return result.isSuccess
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user