manager: module requires KernelSU 8+

This commit is contained in:
tiann
2023-01-04 14:39:20 +08:00
parent 237539ac45
commit 3f9b1cb74b
3 changed files with 11 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import kotlinx.coroutines.launch
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
@@ -85,6 +86,12 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
val failedDisable = stringResource(R.string.module_failed_to_disable)
val swipeState = rememberSwipeRefreshState(viewModel.isRefreshing)
// TODO: Replace SwipeRefresh with RefreshIndicator when it's ready
if (Natives.getVersion() < 8) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text(stringResource(R.string.require_kernel_version_8))
}
return@Scaffold
}
SwipeRefresh(
state = swipeState,
onRefresh = {

View File

@@ -1,6 +1,7 @@
package me.weishu.kernelsu.ui.util
import android.net.Uri
import android.os.SystemClock
import android.util.Log
import com.topjohnwu.superuser.CallbackList
import com.topjohnwu.superuser.Shell
@@ -37,8 +38,9 @@ fun execKsud(args: String): Boolean {
}
fun install() {
val start = SystemClock.elapsedRealtime()
val result = execKsud("install")
Log.w(TAG, "install ksud result: $result")
Log.w(TAG, "install result: $result, cost: ${SystemClock.elapsedRealtime() - start}ms")
}
fun listModules(): String {

View File

@@ -31,4 +31,5 @@
<string name="settings_system_rw">Make system writable</string>
<string name="settings_system_rw_summary">Use overlayfs to make system partition writable, reboot to take effect.</string>
<string name="about">About</string>
<string name="require_kernel_version_8">Require KernelSU version 8+</string>
</resources>