From f65aaff4e39445b504f980db509bbbc680c327d0 Mon Sep 17 00:00:00 2001 From: Whale Choi Date: Sun, 29 Sep 2024 13:31:06 +0800 Subject: [PATCH 1/4] api: spawn CallbackList use UiThreadHandler::runAndWait executor (#2096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![jsexception](https://github.com/user-attachments/assets/e8a4744d-bd0a-40bf-869c-def915b66075) Because the exit callback in js cleans up the ChildProcess, when the last callback of stdout is executed after the exit callback, an error like “emitData ReferenceError: spawn_callback_1727358276092_68 is not defined” will occur. --- .../java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt index aabd7038427f..394c237f0f81 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt @@ -14,6 +14,7 @@ import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.ShellUtils +import com.topjohnwu.superuser.internal.UiThreadHandler import me.weishu.kernelsu.ui.util.listModules import me.weishu.kernelsu.ui.util.createRootShell import me.weishu.kernelsu.ui.util.withNewRootShell @@ -110,13 +111,13 @@ class WebViewInterface(val context: Context, private val webView: WebView, priva } } - val stdout = object : CallbackList() { + val stdout = object : CallbackList(UiThreadHandler::runAndWait) { override fun onAddElement(s: String) { emitData("stdout", s) } } - val stderr = object : CallbackList() { + val stderr = object : CallbackList(UiThreadHandler::runAndWait) { override fun onAddElement(s: String) { emitData("stderr", s) } From fbf3d3945bbc7872b0240f6c98b3f51c656efb9f Mon Sep 17 00:00:00 2001 From: Light_summer <93428659+lightsummer233@users.noreply.github.com> Date: Sun, 29 Sep 2024 15:45:52 +0800 Subject: [PATCH 2/4] manager: Insets stuffs for Android 15 (#2100) Fix insets on Android 15 Bump dependencies Migrate Compose Destination to v2 Ready for review now --- manager/app/build.gradle.kts | 4 +- manager/app/src/main/AndroidManifest.xml | 1 - .../me/weishu/kernelsu/ui/MainActivity.kt | 33 ++++-- .../me/weishu/kernelsu/ui/component/Dialog.kt | 9 +- .../weishu/kernelsu/ui/component/SearchBar.kt | 7 +- .../ui/component/profile/RootProfileConfig.kt | 58 +++++---- .../ui/component/profile/TemplateConfig.kt | 3 +- .../weishu/kernelsu/ui/screen/AppProfile.kt | 19 +-- .../ui/screen/BottomBarDestination.kt | 6 +- .../me/weishu/kernelsu/ui/screen/Flash.kt | 14 ++- .../java/me/weishu/kernelsu/ui/screen/Home.kt | 111 ++++++++++-------- .../me/weishu/kernelsu/ui/screen/Install.kt | 43 ++++--- .../me/weishu/kernelsu/ui/screen/Module.kt | 100 +++++++++------- .../me/weishu/kernelsu/ui/screen/Settings.kt | 60 +++++----- .../me/weishu/kernelsu/ui/screen/SuperUser.kt | 8 +- .../me/weishu/kernelsu/ui/screen/Template.kt | 13 +- .../kernelsu/ui/screen/TemplateEditor.kt | 78 ++++++------ .../java/me/weishu/kernelsu/ui/theme/Theme.kt | 18 --- .../me/weishu/kernelsu/ui/util/LogEvent.kt | 4 - .../weishu/kernelsu/ui/util/SELinuxChecker.kt | 2 +- .../weishu/kernelsu/ui/webui/WebUIActivity.kt | 35 +++++- .../kernelsu/ui/webui/WebViewInterface.kt | 35 +++--- .../src/main/res/values-night-v27/themes.xml | 7 -- .../app/src/main/res/values-night/themes.xml | 12 +- .../app/src/main/res/values-v27/themes.xml | 7 -- manager/app/src/main/res/values/themes.xml | 9 +- manager/gradle/libs.versions.toml | 23 ++-- 27 files changed, 406 insertions(+), 313 deletions(-) delete mode 100644 manager/app/src/main/res/values-night-v27/themes.xml delete mode 100644 manager/app/src/main/res/values-v27/themes.xml diff --git a/manager/app/build.gradle.kts b/manager/app/build.gradle.kts index 7cfb9959f742..7d3792f4056b 100644 --- a/manager/app/build.gradle.kts +++ b/manager/app/build.gradle.kts @@ -61,7 +61,6 @@ android { val output = it as BaseVariantOutputImpl output.outputFileName = "KernelSU_${managerVersionName}_${managerVersionCode}-$name.apk" } - kotlin.sourceSets { getByName(name) { kotlin.srcDir("build/generated/ksp/$name/kotlin") @@ -90,10 +89,9 @@ dependencies { implementation(libs.com.google.accompanist.drawablepainter) implementation(libs.com.google.accompanist.navigation.animation) - implementation(libs.com.google.accompanist.systemuicontroller) implementation(libs.com.google.accompanist.webview) - implementation(libs.compose.destinations.animations.core) + implementation(libs.compose.destinations.core) ksp(libs.compose.destinations.ksp) implementation(libs.com.github.topjohnwu.libsu.core) diff --git a/manager/app/src/main/AndroidManifest.xml b/manager/app/src/main/AndroidManifest.xml index 32c920ab4c3b..618dd974cda7 100644 --- a/manager/app/src/main/AndroidManifest.xml +++ b/manager/app/src/main/AndroidManifest.xml @@ -22,7 +22,6 @@ android:theme="@style/Theme.KernelSU"> - diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt index 042155fbee62..469bf18fb82d 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt @@ -1,9 +1,15 @@ package me.weishu.kernelsu.ui +import android.os.Build import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem @@ -21,12 +27,12 @@ import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.rememberNavController import com.ramcosta.composedestinations.DestinationsNavHost -import com.ramcosta.composedestinations.navigation.popBackStack +import com.ramcosta.composedestinations.generated.NavGraphs import com.ramcosta.composedestinations.utils.isRouteOnBackStackAsState +import com.ramcosta.composedestinations.utils.rememberDestinationsNavigator import me.weishu.kernelsu.Natives import me.weishu.kernelsu.ksuApp import me.weishu.kernelsu.ui.screen.BottomBarDestination -import me.weishu.kernelsu.ui.screen.NavGraphs import me.weishu.kernelsu.ui.theme.KernelSUTheme import me.weishu.kernelsu.ui.util.LocalSnackbarHost import me.weishu.kernelsu.ui.util.rootAvailable @@ -34,6 +40,13 @@ import me.weishu.kernelsu.ui.util.rootAvailable class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { + + // Enable edge to edge + enableEdgeToEdge() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + window.isNavigationBarContrastEnforced = false + } + super.onCreate(savedInstanceState) setContent { @@ -42,7 +55,8 @@ class MainActivity : ComponentActivity() { val snackbarHostState = remember { SnackbarHostState() } Scaffold( bottomBar = { BottomBar(navController) }, - snackbarHost = { SnackbarHost(snackbarHostState) } + snackbarHost = { SnackbarHost(snackbarHostState) }, + contentWindowInsets = WindowInsets(0, 0, 0, 0) ) { innerPadding -> CompositionLocalProvider( LocalSnackbarHost provides snackbarHostState, @@ -61,9 +75,13 @@ class MainActivity : ComponentActivity() { @Composable private fun BottomBar(navController: NavHostController) { + val navigator = navController.rememberDestinationsNavigator() val isManager = Natives.becomeManager(ksuApp.packageName) val fullFeatured = isManager && !Natives.requireNewKernel() && rootAvailable() - NavigationBar(tonalElevation = 8.dp) { + NavigationBar( + tonalElevation = 8.dp, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom + WindowInsetsSides.Horizontal) + ) { BottomBarDestination.entries.forEach { destination -> if (!fullFeatured && destination.rootRequired) return@forEach val isCurrentDestOnBackStack by navController.isRouteOnBackStackAsState(destination.direction) @@ -71,11 +89,10 @@ private fun BottomBar(navController: NavHostController) { selected = isCurrentDestOnBackStack, onClick = { if (isCurrentDestOnBackStack) { - navController.popBackStack(destination.direction, false) + navigator.popBackStack(destination.direction, false) } - - navController.navigate(destination.direction.route) { - popUpTo(NavGraphs.root.route) { + navigator.navigate(destination.direction) { + popUpTo(NavGraphs.root) { saveState = true } launchSingleTop = true diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/Dialog.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/Dialog.kt index e2c3fa453e0d..27adc3f03ccc 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/Dialog.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/Dialog.kt @@ -1,6 +1,7 @@ package me.weishu.kernelsu.ui.component import android.graphics.text.LineBreaker +import android.os.Build import android.os.Parcelable import android.text.Layout import android.text.method.LinkMovementMethod @@ -96,8 +97,8 @@ interface ConfirmDialogHandle : DialogHandle { } private abstract class DialogHandleBase( - protected val visible: MutableState, - protected val coroutineScope: CoroutineScope + val visible: MutableState, + val coroutineScope: CoroutineScope ) : DialogHandle { override val isShown: Boolean get() = visible.value @@ -432,7 +433,9 @@ private fun MarkdownContent(content: String) { TextView(context).apply { movementMethod = LinkMovementMethod.getInstance() setSpannableFactory(NoCopySpannableFactory.getInstance()) - breakStrategy = LineBreaker.BREAK_STRATEGY_SIMPLE + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + breakStrategy = LineBreaker.BREAK_STRATEGY_SIMPLE + } hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE layoutParams = ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt index 8195cdddd40b..b6f7dbe75390 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt @@ -5,8 +5,12 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons @@ -132,7 +136,8 @@ fun SearchAppBar( dropdownContent() } - } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt index d2cb3f342e51..1a39dcc35ea5 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt @@ -1,11 +1,10 @@ -@file:OptIn(ExperimentalMaterial3Api::class) - package me.weishu.kernelsu.ui.component.profile import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardActions @@ -20,12 +19,14 @@ import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.Icon import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.MenuAnchorType import androidx.compose.material3.OutlinedCard import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -86,7 +87,7 @@ fun RootProfileConfig( ) { OutlinedTextField( modifier = Modifier - .menuAnchor() + .menuAnchor(MenuAnchorType.PrimaryNotEditable) .fillMaxWidth(), readOnly = true, label = { Text(stringResource(R.string.profile_namespace)) }, @@ -184,7 +185,7 @@ fun RootProfileConfig( } } -@OptIn(ExperimentalLayoutApi::class) +@OptIn(ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class) @Composable fun GroupsPanel(selected: List, closeSelection: (selection: Set) -> Unit) { val selectGroupsDialog = rememberCustomDialog { dismiss: () -> Unit -> @@ -234,14 +235,20 @@ fun GroupsPanel(selected: List, closeSelection: (selection: Set) ) } - OutlinedCard(modifier = Modifier - .fillMaxWidth() - .padding(16.dp) - .clickable { - selectGroupsDialog.show() - }) { + OutlinedCard( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + ) { - Column(modifier = Modifier.padding(16.dp)) { + Column( + modifier = Modifier + .fillMaxSize() + .clickable { + selectGroupsDialog.show() + } + .padding(16.dp) + ) { Text(stringResource(R.string.profile_groups)) FlowRow { selected.forEach { group -> @@ -256,7 +263,7 @@ fun GroupsPanel(selected: List, closeSelection: (selection: Set) } } -@OptIn(ExperimentalLayoutApi::class) +@OptIn(ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class) @Composable fun CapsPanel( selected: Collection, @@ -299,14 +306,20 @@ fun CapsPanel( ) } - OutlinedCard(modifier = Modifier - .fillMaxWidth() - .padding(16.dp) - .clickable { - selectCapabilitiesDialog.show() - }) { + OutlinedCard( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + ) { - Column(modifier = Modifier.padding(16.dp)) { + Column( + modifier = Modifier + .fillMaxSize() + .clickable { + selectCapabilitiesDialog.show() + } + .padding(16.dp) + ) { Text(stringResource(R.string.profile_capabilities)) FlowRow { selected.forEach { group -> @@ -329,10 +342,10 @@ private fun UidPanel(uid: Int, label: String, onUidChange: (Int) -> Unit) { mutableStateOf(false) } var lastValidUid by remember { - mutableStateOf(uid) + mutableIntStateOf(uid) } - val keyboardController = LocalSoftwareKeyboardController.current + OutlinedTextField( modifier = Modifier.fillMaxWidth(), label = { Text(label) }, @@ -365,6 +378,7 @@ private fun UidPanel(uid: Int, label: String, onUidChange: (Int) -> Unit) { }) } +@OptIn(ExperimentalMaterial3Api::class) @Composable private fun SELinuxPanel( profile: Natives.Profile, @@ -452,7 +466,7 @@ private fun SELinuxPanel( ), label = { Text(text = stringResource(R.string.profile_selinux_context)) }, value = profile.context, - onValueChange = { }, + onValueChange = { } ) }) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt index d09a23434f85..b60e8ea46495 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt @@ -12,6 +12,7 @@ import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem +import androidx.compose.material3.MenuAnchorType import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -54,7 +55,7 @@ fun TemplateConfig( ) { OutlinedTextField( modifier = Modifier - .menuAnchor() + .menuAnchor(MenuAnchorType.PrimaryNotEditable) .fillMaxWidth(), readOnly = true, label = { Text(stringResource(R.string.profile_template)) }, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt index ca53388f8ea4..f7035a678452 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt @@ -7,10 +7,14 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -50,6 +54,9 @@ import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.AppProfileTemplateScreenDestination +import com.ramcosta.composedestinations.generated.destinations.TemplateEditorScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlinx.coroutines.launch import me.weishu.kernelsu.Natives @@ -58,8 +65,6 @@ import me.weishu.kernelsu.ui.component.SwitchItem import me.weishu.kernelsu.ui.component.profile.AppProfileConfig import me.weishu.kernelsu.ui.component.profile.RootProfileConfig import me.weishu.kernelsu.ui.component.profile.TemplateConfig -import me.weishu.kernelsu.ui.screen.destinations.AppProfileTemplateScreenDestination -import me.weishu.kernelsu.ui.screen.destinations.TemplateEditorScreenDestination import me.weishu.kernelsu.ui.util.LocalSnackbarHost import me.weishu.kernelsu.ui.util.forceStopApp import me.weishu.kernelsu.ui.util.getSepolicy @@ -73,7 +78,7 @@ import me.weishu.kernelsu.ui.viewmodel.getTemplateInfoById * @author weishu * @date 2023/5/16. */ -@Destination +@Destination @Composable fun AppProfileScreen( navigator: DestinationsNavigator, @@ -82,10 +87,8 @@ fun AppProfileScreen( val context = LocalContext.current val snackbarHost = LocalSnackbarHost.current val scope = rememberCoroutineScope() - val failToUpdateAppProfile = - stringResource(R.string.failed_to_update_app_profile).format(appInfo.label) - val failToUpdateSepolicy = - stringResource(R.string.failed_to_update_sepolicy).format(appInfo.label) + val failToUpdateAppProfile = stringResource(R.string.failed_to_update_app_profile).format(appInfo.label) + val failToUpdateSepolicy = stringResource(R.string.failed_to_update_sepolicy).format(appInfo.label) val packageName = appInfo.packageName val initialProfile = Natives.getAppProfile(packageName, appInfo.uid) @@ -98,6 +101,7 @@ fun AppProfileScreen( Scaffold( topBar = { TopBar { navigator.popBackStack() } }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { paddingValues -> AppProfileInner( modifier = Modifier @@ -248,6 +252,7 @@ private fun TopBar(onBack: () -> Unit) { onClick = onBack ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt index 9345ced52ff0..c9637ed2e979 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt @@ -5,11 +5,11 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.* import androidx.compose.material.icons.outlined.* import androidx.compose.ui.graphics.vector.ImageVector +import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination +import com.ramcosta.composedestinations.generated.destinations.ModuleScreenDestination +import com.ramcosta.composedestinations.generated.destinations.SuperUserScreenDestination import com.ramcosta.composedestinations.spec.DirectionDestinationSpec import me.weishu.kernelsu.R -import me.weishu.kernelsu.ui.screen.destinations.HomeScreenDestination -import me.weishu.kernelsu.ui.screen.destinations.SuperUserScreenDestination -import me.weishu.kernelsu.ui.screen.destinations.ModuleScreenDestination enum class BottomBarDestination( val direction: DirectionDestinationSpec, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt index 1e3d48fdae05..3afdfb856168 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt @@ -4,8 +4,12 @@ import android.net.Uri import android.os.Environment import android.os.Parcelable import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -35,6 +39,7 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.navigation.EmptyDestinationsNavigator import kotlinx.coroutines.Dispatchers @@ -66,7 +71,7 @@ enum class FlashingStatus { * @date 2023/1/1. */ @Composable -@Destination +@Destination fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) { var text by rememberSaveable { mutableStateOf("") } @@ -139,8 +144,8 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) { text = { Text(text = reboot) }, ) } - - } + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { innerPadding -> KeyEventBlocker { it.key == Key.VolumeDown || it.key == Key.VolumeUp @@ -227,7 +232,8 @@ private fun TopBar(status: FlashingStatus, onBack: () -> Unit = {}, onSave: () - contentDescription = "Localized description" ) } - } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt index b1e998888ca6..7fcbb2df281c 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt @@ -27,32 +27,35 @@ import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.core.content.pm.PackageInfoCompat import com.ramcosta.composedestinations.annotation.Destination -import com.ramcosta.composedestinations.annotation.RootNavGraph +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination +import com.ramcosta.composedestinations.generated.destinations.SettingScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import me.weishu.kernelsu.* import me.weishu.kernelsu.R import me.weishu.kernelsu.ui.component.rememberConfirmDialog -import me.weishu.kernelsu.ui.screen.destinations.InstallScreenDestination -import me.weishu.kernelsu.ui.screen.destinations.SettingScreenDestination import me.weishu.kernelsu.ui.util.* import me.weishu.kernelsu.ui.util.module.LatestVersionInfo -@RootNavGraph(start = true) -@Destination +@Destination(start = true) @Composable fun HomeScreen(navigator: DestinationsNavigator) { val kernelVersion = getKernelVersion() - Scaffold(topBar = { - TopBar(kernelVersion, onSettingsClick = { - navigator.navigate(SettingScreenDestination) - }, onInstallClick = { - navigator.navigate(InstallScreenDestination) - }) - }) { innerPadding -> + Scaffold( + topBar = { + TopBar(kernelVersion, onSettingsClick = { + navigator.navigate(SettingScreenDestination) + }, onInstallClick = { + navigator.navigate(InstallScreenDestination) + }) + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) { innerPadding -> Column( modifier = Modifier .padding(innerPadding) @@ -103,12 +106,11 @@ fun UpdateCard() { val context = LocalContext.current val latestVersionInfo = LatestVersionInfo() val newVersion by produceState(initialValue = latestVersionInfo) { - value = withContext(Dispatchers.IO){ + value = withContext(Dispatchers.IO) { checkNewVersion() } } - val currentVersionCode = getManagerVersion(context).second val newVersionCode = newVersion.versionCode val newVersionUrl = newVersion.downloadUrl @@ -158,50 +160,54 @@ private fun TopBar( onInstallClick: () -> Unit, onSettingsClick: () -> Unit ) { - TopAppBar(title = { Text(stringResource(R.string.app_name)) }, actions = { - if (kernelVersion.isGKI()) { - IconButton(onClick = onInstallClick) { - Icon( - imageVector = Icons.Filled.Archive, - contentDescription = stringResource(id = R.string.install) - ) + TopAppBar( + title = { Text(stringResource(R.string.app_name)) }, + actions = { + if (kernelVersion.isGKI()) { + IconButton(onClick = onInstallClick) { + Icon( + imageVector = Icons.Filled.Archive, + contentDescription = stringResource(id = R.string.install) + ) + } } - } - var showDropdown by remember { mutableStateOf(false) } - IconButton(onClick = { - showDropdown = true - }) { - Icon( - imageVector = Icons.Filled.Refresh, - contentDescription = stringResource(id = R.string.reboot) - ) - - DropdownMenu(expanded = showDropdown, onDismissRequest = { - showDropdown = false + var showDropdown by remember { mutableStateOf(false) } + IconButton(onClick = { + showDropdown = true }) { + Icon( + imageVector = Icons.Filled.Refresh, + contentDescription = stringResource(id = R.string.reboot) + ) + + DropdownMenu(expanded = showDropdown, onDismissRequest = { + showDropdown = false + }) { - RebootDropdownItem(id = R.string.reboot) + RebootDropdownItem(id = R.string.reboot) - val pm = - LocalContext.current.getSystemService(Context.POWER_SERVICE) as PowerManager? - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && pm?.isRebootingUserspaceSupported == true) { - RebootDropdownItem(id = R.string.reboot_userspace, reason = "userspace") + val pm = + LocalContext.current.getSystemService(Context.POWER_SERVICE) as PowerManager? + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && pm?.isRebootingUserspaceSupported == true) { + RebootDropdownItem(id = R.string.reboot_userspace, reason = "userspace") + } + RebootDropdownItem(id = R.string.reboot_recovery, reason = "recovery") + RebootDropdownItem(id = R.string.reboot_bootloader, reason = "bootloader") + RebootDropdownItem(id = R.string.reboot_download, reason = "download") + RebootDropdownItem(id = R.string.reboot_edl, reason = "edl") } - RebootDropdownItem(id = R.string.reboot_recovery, reason = "recovery") - RebootDropdownItem(id = R.string.reboot_bootloader, reason = "bootloader") - RebootDropdownItem(id = R.string.reboot_download, reason = "download") - RebootDropdownItem(id = R.string.reboot_edl, reason = "edl") } - } - IconButton(onClick = onSettingsClick) { - Icon( - imageVector = Icons.Filled.Settings, - contentDescription = stringResource(id = R.string.settings) - ) - } - }) + IconButton(onClick = onSettingsClick) { + Icon( + imageVector = Icons.Filled.Settings, + contentDescription = stringResource(id = R.string.settings) + ) + } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) } @Composable @@ -415,9 +421,10 @@ private fun InfoCard() { } } -fun getManagerVersion(context: Context): Pair { +fun getManagerVersion(context: Context): Pair { val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!! - return Pair(packageInfo.versionName!!, packageInfo.versionCode) + val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo) + return Pair(packageInfo.versionName!!, versionCode) } @Preview diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt index 71b5c9756909..b0f5d7ac2331 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt @@ -9,8 +9,12 @@ import androidx.annotation.StringRes import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.FileUpload @@ -40,13 +44,14 @@ import com.maxkeppeler.sheets.list.ListDialog import com.maxkeppeler.sheets.list.models.ListOption import com.maxkeppeler.sheets.list.models.ListSelection import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.FlashScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.navigation.EmptyDestinationsNavigator import me.weishu.kernelsu.R import me.weishu.kernelsu.ui.component.DialogHandle import me.weishu.kernelsu.ui.component.rememberConfirmDialog import me.weishu.kernelsu.ui.component.rememberCustomDialog -import me.weishu.kernelsu.ui.screen.destinations.FlashScreenDestination import me.weishu.kernelsu.ui.util.LkmSelection import me.weishu.kernelsu.ui.util.getCurrentKmi import me.weishu.kernelsu.ui.util.getSupportedKmis @@ -58,7 +63,7 @@ import me.weishu.kernelsu.ui.util.rootAvailable * @author weishu * @date 2024/3/12. */ -@Destination +@Destination @Composable fun InstallScreen(navigator: DestinationsNavigator) { var installMethod by remember { @@ -113,11 +118,14 @@ fun InstallScreen(navigator: DestinationsNavigator) { }) } - Scaffold(topBar = { - TopBar( - onBack = { navigator.popBackStack() }, onLkmUpload = onLkmUpload - ) - }) { + Scaffold( + topBar = { + TopBar( + onBack = { navigator.popBackStack() }, onLkmUpload = onLkmUpload + ) + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) { Column(modifier = Modifier.padding(it)) { SelectInstallMethod { method -> installMethod = method @@ -293,15 +301,18 @@ fun rememberSelectKmiDialog(onSelected: (String?) -> Unit): DialogHandle { @OptIn(ExperimentalMaterial3Api::class) @Composable private fun TopBar(onBack: () -> Unit = {}, onLkmUpload: () -> Unit = {}) { - TopAppBar(title = { Text(stringResource(R.string.install)) }, navigationIcon = { - IconButton( - onClick = onBack - ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } - }, actions = { - IconButton(onClick = onLkmUpload) { - Icon(Icons.Filled.FileUpload, contentDescription = null) - } - }) + TopAppBar( + title = { Text(stringResource(R.string.install)) }, navigationIcon = { + IconButton( + onClick = onBack + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } + }, actions = { + IconButton(onClick = onLkmUpload) { + Icon(Icons.Filled.FileUpload, contentDescription = null) + } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) } @Composable diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt index 9812e87ebba6..c224dfa3a24f 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt @@ -14,11 +14,15 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape @@ -29,7 +33,6 @@ import androidx.compose.material.pullrefresh.PullRefreshIndicator import androidx.compose.material.pullrefresh.pullRefresh import androidx.compose.material.pullrefresh.rememberPullRefreshState import androidx.compose.material3.Button -import androidx.compose.material3.CardDefaults import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExtendedFloatingActionButton @@ -64,6 +67,8 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.FlashScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -73,7 +78,6 @@ import me.weishu.kernelsu.R import me.weishu.kernelsu.ui.component.ConfirmResult import me.weishu.kernelsu.ui.component.rememberConfirmDialog import me.weishu.kernelsu.ui.component.rememberLoadingDialog -import me.weishu.kernelsu.ui.screen.destinations.FlashScreenDestination import me.weishu.kernelsu.ui.util.DownloadListener import me.weishu.kernelsu.ui.util.LocalSnackbarHost import me.weishu.kernelsu.ui.util.download @@ -85,7 +89,7 @@ import me.weishu.kernelsu.ui.viewmodel.ModuleViewModel import me.weishu.kernelsu.ui.webui.WebUIActivity import okhttp3.OkHttpClient -@Destination +@Destination @Composable fun ModuleScreen(navigator: DestinationsNavigator) { val viewModel = viewModel() @@ -102,41 +106,46 @@ fun ModuleScreen(navigator: DestinationsNavigator) { val hideInstallButton = isSafeMode || hasMagisk - Scaffold(topBar = { - TopBar() - }, floatingActionButton = if (hideInstallButton) { - { /* Empty */ } - } else { - { - val moduleInstall = stringResource(id = R.string.module_install) - val selectZipLauncher = rememberLauncherForActivityResult( - contract = ActivityResultContracts.StartActivityForResult() - ) { - if (it.resultCode != RESULT_OK) { - return@rememberLauncherForActivityResult - } - val data = it.data ?: return@rememberLauncherForActivityResult - val uri = data.data ?: return@rememberLauncherForActivityResult + Scaffold( + topBar = { + TopBar() + }, + floatingActionButton = { + if (hideInstallButton) { + /* Empty */ + } else { + val moduleInstall = stringResource(id = R.string.module_install) + val selectZipLauncher = rememberLauncherForActivityResult( + contract = ActivityResultContracts.StartActivityForResult() + ) { + if (it.resultCode != RESULT_OK) { + return@rememberLauncherForActivityResult + } + val data = it.data ?: return@rememberLauncherForActivityResult + val uri = data.data ?: return@rememberLauncherForActivityResult - navigator.navigate(FlashScreenDestination(FlashIt.FlashModule(uri))) + navigator.navigate(FlashScreenDestination(FlashIt.FlashModule(uri))) - viewModel.markNeedRefresh() + viewModel.markNeedRefresh() - Log.i("ModuleScreen", "select zip result: ${it.data}") - } + Log.i("ModuleScreen", "select zip result: ${it.data}") + } - ExtendedFloatingActionButton( - onClick = { - // select the zip file to install - val intent = Intent(Intent.ACTION_GET_CONTENT) - intent.type = "application/zip" - selectZipLauncher.launch(intent) - }, - icon = { Icon(Icons.Filled.Add, moduleInstall) }, - text = { Text(text = moduleInstall) }, - ) - } - }) { innerPadding -> + ExtendedFloatingActionButton( + onClick = { + // select the zip file to install + val intent = Intent(Intent.ACTION_GET_CONTENT) + intent.type = "application/zip" + selectZipLauncher.launch(intent) + }, + icon = { Icon(Icons.Filled.Add, moduleInstall) }, + text = { Text(text = moduleInstall) }, + ) + + } + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) { innerPadding -> when { hasMagisk -> { @@ -163,10 +172,11 @@ fun ModuleScreen(navigator: DestinationsNavigator) { navigator.navigate(FlashScreenDestination(FlashIt.FlashModule(it))) }, onClickModule = { id, name, hasWebUi -> if (hasWebUi) { - context.startActivity(Intent(context, WebUIActivity::class.java) - .setData(Uri.parse("kernelsu://webui/$id")) - .putExtra("id", id) - .putExtra("name", name) + context.startActivity( + Intent(context, WebUIActivity::class.java) + .setData(Uri.parse("kernelsu://webui/$id")) + .putExtra("id", id) + .putExtra("name", name) ) } }) @@ -419,7 +429,10 @@ private fun ModuleList( @OptIn(ExperimentalMaterial3Api::class) @Composable private fun TopBar() { - TopAppBar(title = { Text(stringResource(R.string.module)) }) + TopAppBar( + title = { Text(stringResource(R.string.module)) }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) } @Composable @@ -433,13 +446,16 @@ private fun ModuleItem( onClick: (ModuleViewModel.ModuleInfo) -> Unit ) { ElevatedCard( - modifier = Modifier.fillMaxWidth(), - colors = CardDefaults.elevatedCardColors(containerColor = MaterialTheme.colorScheme.surface) + modifier = Modifier.fillMaxWidth() ) { val textDecoration = if (!module.remove) null else TextDecoration.LineThrough - Column(modifier = Modifier.clickable { onClick(module) }.padding(24.dp, 16.dp, 24.dp, 0.dp)) { + Column( + modifier = Modifier + .clickable { onClick(module) } + .padding(24.dp, 16.dp, 24.dp, 0.dp) + ) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt index 4f970f7ee331..a0f32d801529 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt @@ -1,18 +1,18 @@ package me.weishu.kernelsu.ui.screen -import android.content.ContentResolver import android.content.Context import android.content.Intent -import android.database.Cursor import android.net.Uri -import android.provider.OpenableColumns -import android.util.Log import android.widget.Toast import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -29,7 +29,6 @@ import androidx.compose.material.icons.filled.RemoveModerator import androidx.compose.material.icons.filled.Save import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.filled.Update -import androidx.compose.material3.BottomSheetScaffold import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -62,6 +61,9 @@ import com.maxkeppeler.sheets.list.ListDialog import com.maxkeppeler.sheets.list.models.ListOption import com.maxkeppeler.sheets.list.models.ListSelection import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.AppProfileTemplateScreenDestination +import com.ramcosta.composedestinations.generated.destinations.FlashScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.navigation.EmptyDestinationsNavigator import kotlinx.coroutines.Dispatchers @@ -77,20 +79,16 @@ import me.weishu.kernelsu.ui.component.SwitchItem import me.weishu.kernelsu.ui.component.rememberConfirmDialog import me.weishu.kernelsu.ui.component.rememberCustomDialog import me.weishu.kernelsu.ui.component.rememberLoadingDialog -import me.weishu.kernelsu.ui.screen.destinations.AppProfileTemplateScreenDestination -import me.weishu.kernelsu.ui.screen.destinations.FlashScreenDestination import me.weishu.kernelsu.ui.util.getBugreportFile import me.weishu.kernelsu.ui.util.getFileNameFromUri import me.weishu.kernelsu.ui.util.shrinkModules -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter /** * @author weishu * @date 2023/1/1. */ @OptIn(ExperimentalMaterial3Api::class) -@Destination +@Destination @Composable fun SettingScreen(navigator: DestinationsNavigator) { Scaffold( @@ -98,7 +96,8 @@ fun SettingScreen(navigator: DestinationsNavigator) { TopBar(onBack = { navigator.popBackStack() }) - } + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { paddingValues -> val aboutDialog = rememberCustomDialog { AboutDialog(it) @@ -184,17 +183,20 @@ fun SettingScreen(navigator: DestinationsNavigator) { showBottomsheet = true } ) - if (showBottomsheet){ + if (showBottomsheet) { ModalBottomSheet( onDismissRequest = { showBottomsheet = false }, content = { - Row(modifier = Modifier.padding(10.dp) - .align(Alignment.CenterHorizontally) + Row( + modifier = Modifier + .padding(10.dp) + .align(Alignment.CenterHorizontally) ) { - Box{ + Box { Column( - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) .clickable { scope.launch { val bugreport = loadingDialog.withLoading { @@ -209,14 +211,15 @@ fun SettingScreen(navigator: DestinationsNavigator) { "${BuildConfig.APPLICATION_ID}.fileprovider", bugreport ) - val filename = getFileNameFromUri(context , uri) - val savefile = Intent(Intent.ACTION_CREATE_DOCUMENT).apply { - addCategory(Intent.CATEGORY_OPENABLE) - type = "application/zip" - putExtra(Intent.EXTRA_STREAM, uri) - putExtra(Intent.EXTRA_TITLE, filename) - flags = Intent.FLAG_GRANT_READ_URI_PERMISSION - } + val filename = getFileNameFromUri(context, uri) + val savefile = + Intent(Intent.ACTION_CREATE_DOCUMENT).apply { + addCategory(Intent.CATEGORY_OPENABLE) + type = "application/zip" + putExtra(Intent.EXTRA_STREAM, uri) + putExtra(Intent.EXTRA_TITLE, filename) + flags = Intent.FLAG_GRANT_READ_URI_PERMISSION + } context.startActivity( Intent.createChooser( savefile, @@ -245,9 +248,10 @@ fun SettingScreen(navigator: DestinationsNavigator) { } } - Box{ + Box { Column( - modifier = Modifier.padding(16.dp) + modifier = Modifier + .padding(16.dp) .clickable { scope.launch { val bugreport = loadingDialog.withLoading { @@ -350,6 +354,7 @@ fun SettingScreen(navigator: DestinationsNavigator) { } } } + @Composable fun UninstallItem( navigator: DestinationsNavigator, @@ -374,11 +379,9 @@ fun UninstallItem( UninstallType.PERMANENT -> navigator.navigate( FlashScreenDestination(FlashIt.FlashUninstall) ) - UninstallType.RESTORE_STOCK_IMAGE -> navigator.navigate( FlashScreenDestination(FlashIt.FlashRestore) ) - UninstallType.NONE -> Unit } } @@ -464,6 +467,7 @@ private fun TopBar(onBack: () -> Unit = {}) { onClick = onBack ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/SuperUser.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/SuperUser.kt index 2eb2e770bb9d..e41345b05e52 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/SuperUser.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/SuperUser.kt @@ -26,16 +26,17 @@ import androidx.lifecycle.viewmodel.compose.viewModel import coil.compose.AsyncImage import coil.request.ImageRequest import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.AppProfileScreenDestination 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.component.SearchAppBar -import me.weishu.kernelsu.ui.screen.destinations.AppProfileScreenDestination import me.weishu.kernelsu.ui.viewmodel.SuperUserViewModel @OptIn(ExperimentalMaterialApi::class) -@Destination +@Destination @Composable fun SuperUserScreen(navigator: DestinationsNavigator) { val viewModel = viewModel() @@ -92,7 +93,8 @@ fun SuperUserScreen(navigator: DestinationsNavigator) { } }, ) - } + }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { innerPadding -> val refreshState = rememberPullRefreshState( refreshing = viewModel.isRefreshing, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt index bf353b0afa84..1ba58059b6a9 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt @@ -7,8 +7,12 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.ExperimentalMaterialApi @@ -47,13 +51,14 @@ import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.TemplateEditorScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.ResultRecipient import com.ramcosta.composedestinations.result.getOr import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import me.weishu.kernelsu.R -import me.weishu.kernelsu.ui.screen.destinations.TemplateEditorScreenDestination import me.weishu.kernelsu.ui.viewmodel.TemplateViewModel /** @@ -62,7 +67,7 @@ import me.weishu.kernelsu.ui.viewmodel.TemplateViewModel */ @OptIn(ExperimentalMaterialApi::class) -@Destination +@Destination @Composable fun AppProfileTemplateScreen( navigator: DestinationsNavigator, @@ -141,6 +146,7 @@ fun AppProfileTemplateScreen( text = { Text(stringResource(id = R.string.app_profile_template_create)) }, ) }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { innerPadding -> val refreshState = rememberPullRefreshState( refreshing = viewModel.isRefreshing, @@ -254,6 +260,7 @@ private fun TopBar( }) } } - } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) } \ No newline at end of file diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt index b6b7cc8028ec..53f5beff02dc 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt @@ -3,8 +3,12 @@ package me.weishu.kernelsu.ui.screen import android.widget.Toast import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions @@ -37,6 +41,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.result.ResultBackNavigator import me.weishu.kernelsu.Natives import me.weishu.kernelsu.R @@ -52,7 +57,7 @@ import me.weishu.kernelsu.ui.viewmodel.toJSON * @date 2023/10/20. */ @OptIn(ExperimentalComposeUiApi::class) -@Destination +@Destination @Composable fun TemplateEditorScreen( navigator: ResultBackNavigator, @@ -108,6 +113,7 @@ fun TemplateEditorScreen( } }) }, + contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) ) { innerPadding -> Column( modifier = Modifier @@ -242,37 +248,40 @@ private fun TopBar( onDelete: () -> Unit = {}, onSave: () -> Unit = {} ) { - TopAppBar(title = { - Column { - Text(title) - if (summary.isNotBlank()) { - Text( - text = summary, - style = MaterialTheme.typography.bodyMedium, + TopAppBar( + title = { + Column { + Text(title) + if (summary.isNotBlank()) { + Text( + text = summary, + style = MaterialTheme.typography.bodyMedium, + ) + } + } + }, navigationIcon = { + IconButton( + onClick = onBack + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } + }, actions = { + if (readOnly) { + return@TopAppBar + } + IconButton(onClick = onDelete) { + Icon( + Icons.Filled.DeleteForever, + contentDescription = stringResource(id = R.string.app_profile_template_delete) ) } - } - }, navigationIcon = { - IconButton( - onClick = onBack - ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } - }, actions = { - if (readOnly) { - return@TopAppBar - } - IconButton(onClick = onDelete) { - Icon( - Icons.Filled.DeleteForever, - contentDescription = stringResource(id = R.string.app_profile_template_delete) - ) - } - IconButton(onClick = onSave) { - Icon( - imageVector = Icons.Filled.Save, - contentDescription = stringResource(id = R.string.app_profile_template_save) - ) - } - }) + IconButton(onClick = onSave) { + Icon( + imageVector = Icons.Filled.Save, + contentDescription = stringResource(id = R.string.app_profile_template_save) + ) + } + }, + windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) + ) } @Composable @@ -289,17 +298,16 @@ private fun TextEdit( value = text, modifier = Modifier.fillMaxWidth(), label = { Text(label) }, - suffix = - if (errorHint.isNotBlank()) { - { + suffix = { + if (errorHint.isNotBlank()) { Text( text = if (isError) errorHint else "", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error ) + } else { + null } - } else { - null }, isError = isError, keyboardOptions = KeyboardOptions( diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt index 3b3945d0cdc5..903ee94e0b54 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt @@ -7,12 +7,8 @@ import androidx.compose.material3.darkColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme -import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import com.google.accompanist.systemuicontroller.rememberSystemUiController private val DarkColorScheme = darkColorScheme( primary = YELLOW, @@ -42,20 +38,6 @@ fun KernelSUTheme( else -> LightColorScheme } - val systemUiController = rememberSystemUiController() - SideEffect { - systemUiController.setStatusBarColor( - color = colorScheme.surface, - darkIcons = !darkTheme - ) - - // To match the App Navbar color - systemUiController.setNavigationBarColor( - color = colorScheme.surfaceColorAtElevation(8.dp), - darkIcons = !darkTheme, - ) - } - MaterialTheme( colorScheme = colorScheme, typography = Typography, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt index 19eb1df18991..a8363120c0fb 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/LogEvent.kt @@ -1,16 +1,12 @@ package me.weishu.kernelsu.ui.util -import android.content.ContentResolver import android.content.Context -import android.net.Uri import android.os.Build -import android.os.ParcelFileDescriptor import android.system.Os import com.topjohnwu.superuser.ShellUtils import me.weishu.kernelsu.Natives import me.weishu.kernelsu.ui.screen.getManagerVersion import java.io.File -import java.io.FileOutputStream import java.io.FileWriter import java.io.PrintWriter import java.time.LocalDateTime diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/SELinuxChecker.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/SELinuxChecker.kt index 78346dd9412c..6b0d704ece67 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/SELinuxChecker.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/SELinuxChecker.kt @@ -1,7 +1,7 @@ package me.weishu.kernelsu.ui.util -import androidx.compose.ui.res.stringResource import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource import com.topjohnwu.superuser.Shell import me.weishu.kernelsu.R diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt index 1877491064de..d926d7eada35 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt @@ -2,13 +2,18 @@ package me.weishu.kernelsu.ui.webui import android.annotation.SuppressLint import android.app.ActivityManager -import android.content.Context +import android.os.Build import android.os.Bundle +import android.view.ViewGroup.MarginLayoutParams import android.webkit.WebResourceRequest import android.webkit.WebResourceResponse import android.webkit.WebView import android.webkit.WebViewClient import androidx.activity.ComponentActivity +import androidx.activity.enableEdgeToEdge +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updateLayoutParams import androidx.webkit.WebViewAssetLoader import com.topjohnwu.superuser.Shell import me.weishu.kernelsu.ui.util.createRootShell @@ -21,12 +26,26 @@ class WebUIActivity : ComponentActivity() { private var rootShell: Shell? = null override fun onCreate(savedInstanceState: Bundle?) { + + // Enable edge to edge + enableEdgeToEdge() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + window.isNavigationBarContrastEnforced = false + } + super.onCreate(savedInstanceState) + val moduleId = intent.getStringExtra("id")!! val name = intent.getStringExtra("name")!! - setTaskDescription(ActivityManager.TaskDescription("KernelSU - $name")) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + @Suppress("DEPRECATION") + setTaskDescription(ActivityManager.TaskDescription("KernelSU - $name")) + } else { + val taskDescription = ActivityManager.TaskDescription.Builder().setLabel("KernelSU - $name").build() + setTaskDescription(taskDescription) + } - val prefs = getSharedPreferences("settings", Context.MODE_PRIVATE) + val prefs = getSharedPreferences("settings", MODE_PRIVATE) WebView.setWebContentsDebuggingEnabled(prefs.getBoolean("enable_web_debugging", false)) val moduleDir = "/data/adb/modules/${moduleId}" @@ -50,6 +69,16 @@ class WebUIActivity : ComponentActivity() { } val webView = WebView(this).apply { + ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets -> + val inset = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.updateLayoutParams { + leftMargin = inset.left + rightMargin = inset.right + topMargin = inset.top + bottomMargin = inset.bottom + } + return@setOnApplyWindowInsetsListener insets + } settings.javaScriptEnabled = true settings.domStorageEnabled = true settings.allowFileAccess = false diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt index 394c237f0f81..00fcde653b60 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt @@ -9,21 +9,24 @@ import android.view.Window import android.webkit.JavascriptInterface import android.webkit.WebView import android.widget.Toast -import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.ShellUtils import com.topjohnwu.superuser.internal.UiThreadHandler -import me.weishu.kernelsu.ui.util.listModules import me.weishu.kernelsu.ui.util.createRootShell +import me.weishu.kernelsu.ui.util.listModules import me.weishu.kernelsu.ui.util.withNewRootShell import org.json.JSONArray import org.json.JSONObject -import java.util.concurrent.CompletableFuture import java.io.File +import java.util.concurrent.CompletableFuture -class WebViewInterface(val context: Context, private val webView: WebView, private val modDir: String) { +class WebViewInterface( + val context: Context, + private val webView: WebView, + private val modDir: String +) { @JavascriptInterface fun exec(cmd: String): String { @@ -187,28 +190,20 @@ class WebViewInterface(val context: Context, private val webView: WebView, priva } var keys = currentInfo.keys() - for(key in keys) { - currentModuleInfo.put(key, currentInfo.get(key)); + for (key in keys) { + currentModuleInfo.put(key, currentInfo.get(key)) } - break; + break } - return currentModuleInfo.toString(); + return currentModuleInfo.toString() } } -fun hideSystemUI(window: Window) { - WindowCompat.setDecorFitsSystemWindows(window, false) +fun hideSystemUI(window: Window) = WindowInsetsControllerCompat(window, window.decorView).let { controller -> controller.hide(WindowInsetsCompat.Type.systemBars()) - controller.systemBarsBehavior = - WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE + controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE } -} -fun showSystemUI(window: Window) { - WindowCompat.setDecorFitsSystemWindows(window, true) - WindowInsetsControllerCompat( - window, - window.decorView - ).show(WindowInsetsCompat.Type.systemBars()) -} \ No newline at end of file +fun showSystemUI(window: Window) = + WindowInsetsControllerCompat(window, window.decorView).show(WindowInsetsCompat.Type.systemBars()) diff --git a/manager/app/src/main/res/values-night-v27/themes.xml b/manager/app/src/main/res/values-night-v27/themes.xml deleted file mode 100644 index 10a773b16f28..000000000000 --- a/manager/app/src/main/res/values-night-v27/themes.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/manager/app/src/main/res/values-night/themes.xml b/manager/app/src/main/res/values-night/themes.xml index 91abf657bfdc..d76ba8e6852b 100644 --- a/manager/app/src/main/res/values-night/themes.xml +++ b/manager/app/src/main/res/values-night/themes.xml @@ -1,10 +1,10 @@ - + - + + - \ No newline at end of file diff --git a/manager/app/src/main/res/values/themes.xml b/manager/app/src/main/res/values/themes.xml index 7d41d8ec77fc..31721d39e182 100644 --- a/manager/app/src/main/res/values/themes.xml +++ b/manager/app/src/main/res/values/themes.xml @@ -1,10 +1,13 @@ - + - + \ No newline at end of file diff --git a/manager/gradle/libs.versions.toml b/manager/gradle/libs.versions.toml index 4201fdd8e65a..30c2bf8539a2 100644 --- a/manager/gradle/libs.versions.toml +++ b/manager/gradle/libs.versions.toml @@ -1,18 +1,18 @@ [versions] -agp = "8.5.2" +agp = "8.6.1" kotlin = "2.0.20" -ksp = "2.0.20-1.0.24" -compose-bom = "2024.08.00" -lifecycle = "2.8.4" -accompanist = "0.34.0" -navigation = "2.7.7" -activity-compose = "1.9.1" -kotlinx-coroutines = "1.8.1" +ksp = "2.0.20-1.0.25" +compose-bom = "2024.09.02" +lifecycle = "2.8.6" +accompanist = "0.36.0" +navigation = "2.8.1" +activity-compose = "1.9.2" +kotlinx-coroutines = "1.9.0" coil-compose = "2.7.0" -compose-destination = "1.10.2" +compose-destination = "2.1.0-beta12" sheets-compose-dialogs = "1.3.0" markdown = "4.6.2" -webkit = "1.11.0" +webkit = "1.12.0" appiconloader-coil = "1.5.0" parcelablelist = "2.0.1" libsu = "6.0.0" @@ -53,7 +53,6 @@ androidx-webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" } com-google-accompanist-drawablepainter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "accompanist" } com-google-accompanist-navigation-animation = { group = "com.google.accompanist", name = "accompanist-navigation-animation", version.ref = "accompanist" } -com-google-accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } com-google-accompanist-webview = { group = "com.google.accompanist", name = "accompanist-webview", version.ref = "accompanist" } com-github-topjohnwu-libsu-core = { group = "com.github.topjohnwu.libsu", name = "core", version.ref = "libsu" } @@ -68,7 +67,7 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c me-zhanghai-android-appiconloader-coil = { group = "me.zhanghai.android.appiconloader", name = "appiconloader-coil", version.ref = "appiconloader-coil" } -compose-destinations-animations-core = { group = "io.github.raamcosta.compose-destinations", name = "animations-core", version.ref = "compose-destination" } +compose-destinations-core = { group = "io.github.raamcosta.compose-destinations", name = "core", version.ref = "compose-destination" } compose-destinations-ksp = { group = "io.github.raamcosta.compose-destinations", name = "ksp", version.ref = "compose-destination" } sheet-compose-dialogs-core = { group = "com.maxkeppeler.sheets-compose-dialogs", name = "core", version.ref = "sheets-compose-dialogs" } From 78ff3ab13aa574df4ed4679f4f66a4b49fe398f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 29 Sep 2024 15:46:15 +0800 Subject: [PATCH 3/4] build(deps): bump the crates group across 1 directory with 32 updates (#2098) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the crates group with 25 updates in the /userspace/ksud directory: | Package | From | To | | --- | --- | --- | | [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.89` | | [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.18` | | [const_format](https://github.com/rodrimati1992/const_format_crates) | `0.2.32` | `0.2.33` | | [serde](https://github.com/serde-rs/serde) | `1.0.208` | `1.0.210` | | [serde_json](https://github.com/serde-rs/json) | `1.0.125` | `1.0.128` | | [libc](https://github.com/rust-lang/libc) | `0.2.158` | `0.2.159` | | [is_executable](https://github.com/fitzgen/is_executable) | `1.0.1` | `1.0.3` | | [derive-new](https://github.com/nrc/derive-new) | `0.6.0` | `0.7.0` | | [async-trait](https://github.com/dtolnay/async-trait) | `0.1.81` | `0.1.83` | | [autocfg](https://github.com/cuviper/autocfg) | `1.3.0` | `1.4.0` | | [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.73` | `0.3.74` | | [bytes](https://github.com/tokio-rs/bytes) | `1.7.1` | `1.7.2` | | [cc](https://github.com/rust-lang/cc-rs) | `1.1.14` | `1.1.22` | | [cpufeatures](https://github.com/RustCrypto/utils) | `0.2.13` | `0.2.14` | | [fastrand](https://github.com/smol-rs/fastrand) | `2.1.0` | `2.1.1` | | [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.32` | `1.0.34` | | [iana-time-zone](https://github.com/strawlab/iana-time-zone) | `0.1.60` | `0.1.61` | | [indexmap](https://github.com/indexmap-rs/indexmap) | `2.4.0` | `2.5.0` | | [object](https://github.com/gimli-rs/object) | `0.36.3` | `0.36.4` | | [syn](https://github.com/dtolnay/syn) | `2.0.75` | `2.0.77` | | [thiserror](https://github.com/dtolnay/thiserror) | `1.0.63` | `1.0.64` | | [tokio](https://github.com/tokio-rs/tokio) | `1.39.3` | `1.40.0` | | [unicode-ident](https://github.com/dtolnay/unicode-ident) | `1.0.12` | `1.0.13` | | [unicode-width](https://github.com/unicode-rs/unicode-width) | `0.1.13` | `0.1.14` | | [unicode-xid](https://github.com/unicode-rs/unicode-xid) | `0.2.5` | `0.2.6` | Updates `anyhow` from 1.0.86 to 1.0.89
Release notes

Sourced from anyhow's releases.

1.0.89

  • Make anyhow::Error's UnwindSafe and RefUnwindSafe impl consistently available between versions of Rust newer and older than 1.72 (#386)

1.0.88

  • Documentation improvements

1.0.87

  • Support more APIs, including Error::new and Error::chain, in no-std mode on Rust 1.81+ (#383)
Commits
  • 9d3fb6d Release 1.0.89
  • 830c399 Merge pull request #386 from dtolnay/unwindsafe
  • 8454be3 Ensure UnwindSafe even with "backtrace" feature enabled and old Rust
  • a85e414 Add more autotraits tests
  • 139f266 Release 1.0.88
  • aa3ab2b Merge pull request #385 from dtolnay/docnostd
  • 44c3767 Update documentation on no-std error type conversions
  • afe93e7 Release 1.0.87
  • d58fa4b Fix outdated html_root_url
  • c18d807 Disable unused doc_cfg feature
  • Additional commits viewable in compare view

Updates `clap` from 4.5.16 to 4.5.18
Release notes

Sourced from clap's releases.

v4.5.18

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

v4.5.17

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used
Changelog

Sourced from clap's changelog.

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used
Commits
  • d811585 chore: Release
  • ab948b3 docs: Update changelog
  • 82e599e Merge pull request #5602 from shannmu/delimiter_values
  • 59bf26d feat(clap_complete): Support delimiter values in native completions
  • ccecab3 test(clap_complete): Add test cases for delimiter_values support
  • a3a4764 docs(derive): Specify Parser::update_from semantics
  • df165a2 docs(derive): Flatten isn't just for update
  • 5488bcf docs(derive): Connect more dots for Args/Subcommand
  • 6013ad4 chore: Release
  • f98e3ee docs: Update changelog
  • Additional commits viewable in compare view

Updates `const_format` from 0.2.32 to 0.2.33
Changelog

Sourced from const_format's changelog.

0.2.33

Fixed Rust Analyzer style warning for assertion macros.

Commits

Updates `serde` from 1.0.208 to 1.0.210
Release notes

Sourced from serde's releases.

v1.0.210

  • Support serializing and deserializing IpAddr and SocketAddr in no-std mode on Rust 1.77+ (#2816, thanks @​MathiasKoch)
  • Make serde::ser::StdError and serde::de::StdError equivalent to core::error::Error on Rust 1.81+ (#2818)

v1.0.209

  • Fix deserialization of empty structs and empty tuples inside of untagged enums (#2805, thanks @​Mingun)
Commits
  • 89c4b02 Release 1.0.210
  • eeb8e44 Merge pull request #2818 from dtolnay/coreerror
  • 785c2d9 Stabilize no-std StdError trait
  • d549f04 Reformat parse_ip_impl definition and calls
  • 4c0dd63 Delete attr support from core::net deserialization macros
  • 26fb134 Relocate cfg attrs out of parse_ip_impl and parse_socket_impl
  • 07e614b Merge pull request #2817 from dtolnay/corenet
  • b1f899f Delete doc(cfg) attribute from impls that are supported in no-std
  • b4f860e Merge pull request #2816 from MathiasKoch/chore/core-net
  • d940fe1 Reuse existing Buf wrapper as replacement for std::io::Write
  • Additional commits viewable in compare view

Updates `serde_json` from 1.0.125 to 1.0.128
Release notes

Sourced from serde_json's releases.

1.0.128

  • Support serializing maps containing 128-bit integer keys to serde_json::Value (#1188, thanks @​Mrreadiness)

1.0.127

1.0.126

  • Improve string parsing on targets that use 32-bit pointers but also have fast 64-bit integer arithmetic, such as aarch64-unknown-linux-gnu_ilp32 and x86_64-unknown-linux-gnux32 (#1182, thanks @​CryZe)
Commits
  • d96b1d9 Release 1.0.128
  • 599228d Merge pull request #1188 from Mrreadiness/feat/add-hashmap-key-128-serializer
  • 5416cee feat: add support for 128 bit HashMap key serialization
  • 27a4ca9 Upload CI Cargo.lock for reproducing failures
  • 5ebf65c Release 1.0.127
  • f287a3b Merge pull request 1179 from GREsau/patch-1
  • ec980b0 Release 1.0.126
  • e6282b0 Merge pull request #1184 from serde-rs/fastarithmetic
  • ffc4a43 Improve cfg names for fast arithmetic
  • 4b1048d Merge pull request #1183 from serde-rs/arithmetic
  • Additional commits viewable in compare view

Updates `libc` from 0.2.158 to 0.2.159
Release notes

Sourced from libc's releases.

0.2.159

Added

Fixed

Changed

Changelog

Sourced from libc's changelog.

0.2.159 - 2024-09-24

Added

Fixed

Changed

Commits
  • 7373a1a chore: release (#3862)
  • 48668be Merge pull request #3931 from tgross35/backport-remove-tmp-file
  • 28bb64b Remove temporary file that was added by accident
  • a515d07 Merge pull request #3904 from tgross35/backport-buildrs-fix
  • abcb8f8 Simplify the RUSTC_WRAPPER check
  • 5078335 Fix rustc version when clippy-driver is used
  • 57a7d46 Merge pull request #3902 from tgross35/backport-horizon-network
  • a3e8869 Revise network definitions for HorizonOS
  • fdd3a26 Merge pull request #3900 from tgross35/espid-cherry-pick
  • 35060e8 Merge pull request #3901 from tgross35/backport-epoll_pwait2
  • Additional commits viewable in compare view

Updates `is_executable` from 1.0.1 to 1.0.3
Commits
  • cfe9912 Bump to version 1.0.3
  • d6fcf2f Remove old test about README.md being in sync with module docs
  • 95f27a6 Remove old CI
  • e70c103 Update badges in README
  • 61d2e9b Add github actions
  • 001b334 Bump to version 1.0.2
  • fab168c Merge pull request #14 from lucieleblanc/master
  • 82f9c68 replace is_file() --> exists() because symlinks are ok
  • 441c1c7 add file existence check before reading extension
  • ea10f6b Merge pull request #11 from davide125/exclude
  • Additional commits viewable in compare view

Updates `derive-new` from 0.6.0 to 0.7.0
Commits
  • 6626d8f Update compiletest
  • 1e024dd cargo update, etc.
  • 3389ef2 Fix doc tests
  • bd4486d implement into and into_iter
  • a9230ac fix tests
  • 77cb828 Merge pull request #67 from Paragit-Solutions/implement-new-method-visibility
  • cacbada Merge pull request #66 from shellixyz/patch-1
  • d11f631 Add documentation
  • 3311408 Add visibility to test struct to test compilation and correct macro expansion
  • 61853b7 Make the default visibility public
  • Additional commits viewable in compare view

Updates `async-trait` from 0.1.81 to 0.1.83
Release notes

Sourced from async-trait's releases.

0.1.83

  • Prevent needless_arbitrary_self_type lint being produced in generated code (#278)

0.1.82

  • Prevent elided_named_lifetimes lint being produced in generated code (#276)
Commits
  • e6b4d47 Release 0.1.83
  • bfe8d61 Merge pull request #278 from dtolnay/arbself
  • 7bd974b Ignore needless_arbitrary_self_type clippy lint in generated code
  • b53b4e7 Add regression test for issue 277
  • f8e5bb4 Release 0.1.82
  • 8fbf118 Merge pull request #276 from dtolnay/elidednamed
  • 6fa246a Ignore nightly's new elided_named_lifetimes lint in generated code
  • d542a0d Upload CI Cargo.lock for reproducing failures
  • 8828c35 Sort dependency features in Cargo.toml
  • ba9793a Update ui test suite to nightly-2024-08-11
  • Additional commits viewable in compare view

Updates `autocfg` from 1.3.0 to 1.4.0
Commits
  • d07df66 Merge pull request #73 from cuviper/release-1.4.0
  • f6066f0 Release 1.4.0
  • 8af60ec Merge pull request #70 from Techcable/feature/rustc-check-cfg
  • 52a995b Apply suggestions from code review
  • a8703c1 Attempt rust 1.0 compat for ci/verify-check-cfg
  • ac78be8 Add ci test crate for check-cfg
  • 0b4a761 Have emit_has methods delegate wherever possible
  • 546f7c6 Fix minor doc issues
  • e0e0f18 Automatically emit rustc-check-cfg directives for AutoCfg
  • 1953a17 Merge pull request #72 from cuviper/pretty-way
  • Additional commits viewable in compare view

Updates `backtrace` from 0.3.73 to 0.3.74
Release notes

Sourced from backtrace's releases.

0.3.74

What's Changed

New Contributors

Full Changelog: https://github.com/rust-lang/backtrace-rs/compare/0.3.73...0.3.74

Commits
  • 38d49aa Merge pull request #658 from workingjubilee/cut-0.3.74
  • c1749ce Cut backtrace 0.3.74
  • 230570f Merge pull request #660 from workingjubilee/dont-unsoundly-iterate-phdr
  • 153f510 Do not destructure maybe-uninit fields
  • 3858946 Revise dl_iterate_phdr callback to be sound-ish
  • 7d062c6rust-lang/backtrace-rs#653
  • fc37b22rust-lang/backtrace-rs#657
  • 600beaarust-lang/backtrace-rs#648
  • 84b6c1drust-lang/backtrace-rs#652
  • 95c3bac Make enum print::PrintFmtrust-lang/backtrace-rs#651
  • Additional commits viewable in compare view

Updates `bytes` from 1.7.1 to 1.7.2
Release notes

Sourced from bytes's releases.

Bytes 1.7.2

1.7.2 (September 17, 2024)

Fixed

  • Fix default impl of Buf::{get_int, get_int_le} (#732)

Documented

  • Fix double spaces in comments and doc comments (#731)

Internal changes

  • Ensure BytesMut::advance reduces capacity (#728)
Changelog

Sourced from bytes's changelog.

1.7.2 (September 17, 2024)

Fixed

  • Fix default impl of Buf::{get_int, get_int_le} (#732)

Documented

  • Fix double spaces in comments and doc comments (#731)

Internal changes

  • Ensure BytesMut::advance reduces capacity (#728)
Commits

Updates `cc` from 1.1.14 to 1.1.22
Release notes

Sourced from cc's releases.

cc-v1.1.22

Other

  • Don't rerun if PATH changes (#1215)

cc-v1.1.21

Other

  • disable pic for targets that end in -none (#1212)

cc-v1.1.20

Other

  • Add buildcache as known Rust and C/C++ compiler wrapper (#1209)

cc-v1.1.19

Other

  • Add support arm64e-apple-darwin (#1207)

cc-v1.1.18

Other

  • Fixed unsoundness in StderrForwarder::forward_available (#1203)

cc-v1.1.17

Fixed

  • fix finding toolchains when invoked by msbuild (#1201)

cc-v1.1.16

Other

  • Treat VxWorks wr-cc as a Gnu compiler (#1198)

cc-v1.1.15

Other

  • Add -mfloat-abi=hard as a default argument when using any arm/thumb-none-eabihf target (#1194)
Changelog

Sourced from cc's changelog.

1.1.22 - 2024-09-27

Other

  • Don't rerun if PATH changes (#1215)

1.1.21 - 2024-09-18

Other

  • disable pic for targets that end in -none (#1212)

1.1.20 - 2024-09-17

Other

  • Add buildcache as known Rust and C/C++ compiler wrapper (#1209)

1.1.19 - 2024-09-15

Other

  • Add support arm64e-apple-darwin (#1207)

1.1.18 - 2024-09-07

Other

  • Fixed unsoundness in StderrForwarder::forward_available (#1203)

1.1.17 - 2024-09-06

Fixed

  • fix finding toolchains when invoked by msbuild (#1201)

1.1.16 - 2024-09-04

Other

  • Treat VxWorks wr-cc as a Gnu compiler (#1198)

1.1.15 - 2024-08-26

Other

  • Add -mfloat-abi=hard as a default argument when using any arm/thumb-none-eabihf target (#1194)
Commits

Updates `clap_builder` from 4.5.15 to 4.5.18
Release notes

Sourced from clap_builder's releases.

v4.5.18

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

v4.5.17

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used

v4.5.16

[4.5.16] - 2024-08-15

Fixes

  • (derive) Improve error messages when derive feature is missing
Changelog

Sourced from clap_builder's changelog.

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used

[4.5.16] - 2024-08-15

Fixes

  • (derive) Improve error messages when derive feature is missing
Commits
  • 0d142f6 chore: Release
  • 0facf1f docs: Update changelog
  • ee6af99 Merge pull request #5743 from epage/sort
  • 232ee10 fix(complete): Use existing display order for Arg/Command
  • c6b5d62 feat(builder): Expose get_display_order
  • 67d9fef feat(complete): Give control over display order
  • 59a61e1 refactor(complete): Pull out common candidate code
  • 1448791 fix(complete): Specify tags for built-in candiates
  • a4aa5df feat(complete): Group by tag
  • a126149 refactor(complete): Remove redundant dedup
  • Additional commits viewable in compare view

Updates `clap_derive` from 4.5.13 to 4.5.18
Release notes

Sourced from clap_derive's releases.

v4.5.18

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

v4.5.17

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used

v4.5.16

[4.5.16] - 2024-08-15

Fixes

  • (derive) Improve error messages when derive feature is missing

v4.5.15

[4.5.15] - 2024-08-10

Compatiblity

  • (unstable-ext) Arg::remove changed return types

Fixes

  • (unstable-ext) Make Arg::remove return the removed item

v4.5.14

[4.5.14] - 2024-08-08

Features

  • (unstable-ext) Added Arg::add for attaching arbitrary state, like completion hints, to Arg without Arg knowing about it
Changelog

Sourced from clap_derive's changelog.

[4.5.18] - 2024-09-20

Features

  • (builder) Expose Arg::get_display_order and Command::get_display_order

[4.5.17] - 2024-09-04

Fixes

  • (help) Style required argument groups
  • (derive) Improve error messages when unsupported fields are used

[4.5.16] - 2024-08-15

Fixes

  • (derive) Improve error messages when derive feature is missing

[4.5.15] - 2024-08-10

Compatiblity

  • (unstable-ext) Arg::remove changed return types

Fixes

  • (unstable-ext) Make Arg::remove return the removed item

[4.5.14] - 2024-08-08

Features

  • (unstable-ext) Added Arg::add for attaching arbitrary state, like completion hints, to Arg without Arg knowing about it
Commits
  • 0d142f6 chore: Release
  • 0facf1f docs: Update changelog
  • ee6af99 Merge pull request #5743 from epage/sort
  • 232ee10 fix(complete): Use existing display order for Arg/Command
  • c6b5d62 feat(builder): Expose get_display_order
  • 67d9fef feat(complete): Give control over display order
  • 59a61e1 refactor(complete): Pull out common candidate code
  • 1448791 fix(complete): Specify tags for built-in candiates
  • a4aa5df feat(complete): Group by tag
  • a126149 refactor(complete): Remove redundant dedup
  • Additional commits viewable in compare view

Updates `const_format_proc_macros` from 0.2.32 to 0.2.33
Changelog

Sourced from const_format_proc_macros's changelog.

0.2.33

Fixed Rust Analyzer style warning for assertion macros.

Commits

Updates `cpufeatures` from 0.2.13 to 0.2.14
Commits

Updates `fastrand` from 2.1.0 to 2.1.1
Release notes

Sourced from fastrand's releases.

v2.1.1

  • Remove support for 128-bit targets, as they are not supported by rustc yet. (#87)
Changelog

Sourced from fastrand's changelog.

Version 2.1.1

  • Remove support for 128-bit targets, as they are not supported by rustc yet. (#87)
Commits

Updates `flate2` from 1.0.32 to 1.0.34
Release notes

Sourced from flate2's releases.

1.0.34

What's Changed

New Contributors

Full Changelog: https://github.com/rust-lang/flate2-rs/compare/1.0.33...1.0.34

1.0.33 - fix minimal manifest versions

What's Changed

New Contributors

Full Changelog: https://github.com/rust-lang/flate2-rs/compare/1.0.32...1.0.33

Commits
  • 1a28821 Merge pull request #431 from Shnatsel/better-wording
  • 2c29780 Merge pull request #428 from Shnatsel/upgrade-zlib-rs
  • 423981a Better wording in compression level docs
  • da5c8cf Bump version
  • eeee4c6 Merge pull request #430 from Shnatsel/detailed-level-docs
  • 731df32 Update Cargo.toml
  • 8210288 Document backend differences
  • 1f78c5c Upgrade zlib-rs to 0.3.0 to get multiple bugfixes:
  • 6fbd6d2 Merge pull request #427 from ByteBaker/main
  • 936aa35 docs: correctly mention compression level
  • Additional commits viewable in compare view

Updates `gimli` from 0.29.0 to 0.31.0
Changelog

Sourced from gimli's changelog.

0.31.0

Released 2024/07/16.

Breaking changes