manager: check overlayfs support

This commit is contained in:
tiann
2023-01-26 17:27:06 +08:00
parent cf5bcc09e8
commit 6e8771b8d9
6 changed files with 19 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ import me.weishu.kernelsu.Natives
import me.weishu.kernelsu.R
import me.weishu.kernelsu.ui.screen.destinations.InstallScreenDestination
import me.weishu.kernelsu.ui.util.LocalSnackbarHost
import me.weishu.kernelsu.ui.util.overlayFsAvailable
import me.weishu.kernelsu.ui.util.toggleModule
import me.weishu.kernelsu.ui.util.uninstallModule
import me.weishu.kernelsu.ui.viewmodel.ModuleViewModel
@@ -105,6 +106,14 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
.padding(16.dp)
.fillMaxSize()
) {
val isOverlayAvailable = overlayFsAvailable()
if (!isOverlayAvailable) {
swipeState.isRefreshing = false
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(stringResource(R.string.module_overlay_fs_not_available))
}
return@SwipeRefresh
}
val isEmpty = viewModel.moduleList.isEmpty()
if (isEmpty) {
swipeState.isRefreshing = false

View File

@@ -102,4 +102,10 @@ fun reboot(reason: String = "") {
ShellUtils.fastCmd(shell, "/system/bin/input keyevent 26")
}
ShellUtils.fastCmd(shell, "/system/bin/svc power reboot $reason || /system/bin/reboot $reason")
}
fun overlayFsAvailable(): Boolean {
val shell = createRootShell()
// check /proc/filesystems
return ShellUtils.fastCmdResult(shell, "cat /proc/filesystems | grep overlay")
}