manager: check overlayfs support
This commit is contained in:
@@ -32,6 +32,7 @@ import me.weishu.kernelsu.Natives
|
|||||||
import me.weishu.kernelsu.R
|
import me.weishu.kernelsu.R
|
||||||
import me.weishu.kernelsu.ui.screen.destinations.InstallScreenDestination
|
import me.weishu.kernelsu.ui.screen.destinations.InstallScreenDestination
|
||||||
import me.weishu.kernelsu.ui.util.LocalSnackbarHost
|
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.toggleModule
|
||||||
import me.weishu.kernelsu.ui.util.uninstallModule
|
import me.weishu.kernelsu.ui.util.uninstallModule
|
||||||
import me.weishu.kernelsu.ui.viewmodel.ModuleViewModel
|
import me.weishu.kernelsu.ui.viewmodel.ModuleViewModel
|
||||||
@@ -105,6 +106,14 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
.fillMaxSize()
|
.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()
|
val isEmpty = viewModel.moduleList.isEmpty()
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
swipeState.isRefreshing = false
|
swipeState.isRefreshing = false
|
||||||
|
|||||||
@@ -102,4 +102,10 @@ fun reboot(reason: String = "") {
|
|||||||
ShellUtils.fastCmd(shell, "/system/bin/input keyevent 26")
|
ShellUtils.fastCmd(shell, "/system/bin/input keyevent 26")
|
||||||
}
|
}
|
||||||
ShellUtils.fastCmd(shell, "/system/bin/svc power reboot $reason || /system/bin/reboot $reason")
|
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")
|
||||||
}
|
}
|
||||||
@@ -45,4 +45,5 @@
|
|||||||
<string name="module_uninstall_failed">卸载失败: %s</string>
|
<string name="module_uninstall_failed">卸载失败: %s</string>
|
||||||
<string name="module_version">版本</string>
|
<string name="module_version">版本</string>
|
||||||
<string name="module_author">作者</string>
|
<string name="module_author">作者</string>
|
||||||
|
<string name="module_overlay_fs_not_available">内核不支持 overlayfs,模块功能无法运作!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -45,4 +45,5 @@
|
|||||||
<string name="module_uninstall_failed">卸載失敗: %s</string>
|
<string name="module_uninstall_failed">卸載失敗: %s</string>
|
||||||
<string name="module_version">版本</string>
|
<string name="module_version">版本</string>
|
||||||
<string name="module_author">作者</string>
|
<string name="module_author">作者</string>
|
||||||
|
<string name="module_overlay_fs_not_available">內核不支持 overlayfs,模塊功能無法運作!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -45,4 +45,5 @@
|
|||||||
<string name="module_uninstall_failed">卸載失敗: %s</string>
|
<string name="module_uninstall_failed">卸載失敗: %s</string>
|
||||||
<string name="module_version">版本</string>
|
<string name="module_version">版本</string>
|
||||||
<string name="module_author">作者</string>
|
<string name="module_author">作者</string>
|
||||||
|
<string name="module_overlay_fs_not_available">內核不支持 overlayfs,模塊功能無法運作!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -49,5 +49,6 @@
|
|||||||
<string name="module_uninstall_failed">Failed to uninstall: %s</string>
|
<string name="module_uninstall_failed">Failed to uninstall: %s</string>
|
||||||
<string name="module_version">Version</string>
|
<string name="module_version">Version</string>
|
||||||
<string name="module_author">Author</string>
|
<string name="module_author">Author</string>
|
||||||
|
<string name="module_overlay_fs_not_available">overlayfs is not available, module cannot work!</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user