ksud: implement magic_mount

This commit is contained in:
New Author Name
2024-12-08 00:23:16 +06:00
committed by rifsxd
parent e1107e514d
commit 169ebb1df7
53 changed files with 653 additions and 1142 deletions
@@ -362,20 +362,6 @@ 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(
@@ -351,12 +351,6 @@ 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,7 +11,6 @@ import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.weishu.kernelsu.ui.util.listModules
import me.weishu.kernelsu.ui.util.overlayFsAvailable
import org.json.JSONArray
import org.json.JSONObject
import java.text.Collator
@@ -49,9 +48,6 @@ class ModuleViewModel : ViewModel() {
var isRefreshing by mutableStateOf(false)
private set
var isOverlayAvailable by mutableStateOf(overlayFsAvailable())
private set
val moduleList by derivedStateOf {
val comparator = compareBy(Collator.getInstance(Locale.getDefault()), ModuleInfo::id)
modules.sortedWith(comparator).also {
@@ -75,8 +71,6 @@ class ModuleViewModel : ViewModel() {
val start = SystemClock.elapsedRealtime()
kotlin.runCatching {
isOverlayAvailable = overlayFsAvailable()
val result = listModules()
Log.i(TAG, "result: $result")