manager: Show module conflict state with Magisk
This commit is contained in:
@@ -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() }
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user