You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
manager: brought back isOverlayAvailable()
This commit is contained in:
@@ -428,6 +428,20 @@ private fun ModuleList(
|
||||
},
|
||||
) {
|
||||
when {
|
||||
!viewModel.isOverlayAvailable -> {
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier.fillParentMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.module_overlay_fs_not_available),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.moduleList.isEmpty() -> {
|
||||
item {
|
||||
Box(
|
||||
@@ -537,6 +551,19 @@ fun ModuleItem(
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.run {
|
||||
if (module.hasWebUi) {
|
||||
toggleable(
|
||||
value = isChecked,
|
||||
interactionSource = interactionSource,
|
||||
role = Role.Button,
|
||||
indication = indication,
|
||||
onValueChange = { onClick(module) }
|
||||
)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
.padding(22.dp, 18.dp, 22.dp, 12.dp)
|
||||
) {
|
||||
Row(
|
||||
|
||||
@@ -403,6 +403,12 @@ suspend fun getSupportedKmis(): List<String> = withContext(Dispatchers.IO) {
|
||||
out.filter { it.isNotBlank() }.map { it.trim() }
|
||||
}
|
||||
|
||||
fun overlayFsAvailable(): Boolean {
|
||||
val shell = getRootShell()
|
||||
// check /proc/filesystems
|
||||
return ShellUtils.fastCmdResult(shell, "cat /proc/filesystems | grep overlay")
|
||||
}
|
||||
|
||||
fun hasMagisk(): Boolean {
|
||||
val shell = getRootShell(true)
|
||||
val result = shell.newJob().add("which magisk").exec()
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import com.rifsxd.ksunext.ui.util.listModules
|
||||
import com.rifsxd.ksunext.ui.util.overlayFsAvailable
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.text.Collator
|
||||
@@ -45,6 +46,9 @@ class ModuleViewModel : ViewModel() {
|
||||
val changelog: String,
|
||||
)
|
||||
|
||||
var isOverlayAvailable by mutableStateOf(overlayFsAvailable())
|
||||
private set
|
||||
|
||||
var isRefreshing by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
@@ -71,6 +75,8 @@ class ModuleViewModel : ViewModel() {
|
||||
val start = SystemClock.elapsedRealtime()
|
||||
|
||||
kotlin.runCatching {
|
||||
isOverlayAvailable = overlayFsAvailable()
|
||||
|
||||
val result = listModules()
|
||||
|
||||
Log.i(TAG, "result: $result")
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<string name="module_restore_failed">恢复失败: %s</string>
|
||||
<string name="module_version">版本</string>
|
||||
<string name="module_author">作者</string>
|
||||
<string name="module_overlay_fs_not_available">OverlayFS被内核禁用,模块不可用。</string>
|
||||
<string name="refresh">刷新</string>
|
||||
<string name="show_system_apps">显示系统应用</string>
|
||||
<string name="hide_system_apps">隐藏系统应用</string>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<string name="module_restore_failed">Failed to restore: %s</string>
|
||||
<string name="module_version">Version</string>
|
||||
<string name="module_author">Author</string>
|
||||
<string name="module_overlay_fs_not_available">Modules are unavailable as OverlayFS is disabled by the kernel.</string>
|
||||
<string name="refresh">Refresh</string>
|
||||
<string name="show_system_apps">Show system apps</string>
|
||||
<string name="hide_system_apps">Hide system apps</string>
|
||||
|
||||
Reference in New Issue
Block a user