manager: Show module conflict state with Magisk

This commit is contained in:
tiann
2023-03-01 12:12:31 +08:00
parent ee09b9f9f4
commit 9f6e9f5db6
4 changed files with 14 additions and 0 deletions

View File

@@ -103,6 +103,12 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
}
return@Scaffold
}
if (hasMagisk()) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(stringResource(R.string.module_magisk_conflict))
}
return@Scaffold
}
SwipeRefresh(
state = swipeState, onRefresh = {
scope.launch { viewModel.fetchModuleList() }

View File

@@ -108,4 +108,10 @@ fun overlayFsAvailable(): Boolean {
val shell = createRootShell()
// check /proc/filesystems
return ShellUtils.fastCmdResult(shell, "cat /proc/filesystems | grep overlay")
}
fun hasMagisk(): Boolean {
val shell = createRootShell()
val result = shell.newJob().add("nsenter --mount=/proc/1/ns/mnt which magisk").exec()
return result.isSuccess
}