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 return@Scaffold
} }
if (hasMagisk()) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(stringResource(R.string.module_magisk_conflict))
}
return@Scaffold
}
SwipeRefresh( SwipeRefresh(
state = swipeState, onRefresh = { state = swipeState, onRefresh = {
scope.launch { viewModel.fetchModuleList() } scope.launch { viewModel.fetchModuleList() }

View File

@@ -108,4 +108,10 @@ fun overlayFsAvailable(): Boolean {
val shell = createRootShell() val shell = createRootShell()
// check /proc/filesystems // check /proc/filesystems
return ShellUtils.fastCmdResult(shell, "cat /proc/filesystems | grep overlay") 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
} }

View File

@@ -51,4 +51,5 @@
<string name="send_log">发送日志</string> <string name="send_log">发送日志</string>
<string name="safe_mode">安全模式</string> <string name="safe_mode">安全模式</string>
<string name="reboot_to_apply">重启生效</string> <string name="reboot_to_apply">重启生效</string>
<string name="module_magisk_conflict">所有模块已被禁用,因为它与 Magisk 的模块系统有冲突!</string>
</resources> </resources>

View File

@@ -55,5 +55,6 @@
<string name="send_log">Send Log</string> <string name="send_log">Send Log</string>
<string name="safe_mode">Safe mode</string> <string name="safe_mode">Safe mode</string>
<string name="reboot_to_apply">Reboot to take effect</string> <string name="reboot_to_apply">Reboot to take effect</string>
<string name="module_magisk_conflict">Modules are disabled because it is conflict with Magisk\'s!</string>
</resources> </resources>