[skip ci]:

Fixing tools used by kernels under 5.10
-Add Slot selection is not displayed for non-ab partitions
This commit is contained in:
ShirkNeko
2025-05-05 22:09:01 +08:00
parent 349ca36d4e
commit caee2417d6
3 changed files with 46 additions and 59 deletions

View File

@@ -115,6 +115,7 @@ fun InstallScreen(navigator: DestinationsNavigator) {
val summary = stringResource(R.string.horizon_kernel_summary)
val kernelVersion = getKernelVersion()
val isGKI = kernelVersion.isGKI()
val isAbDevice = isAbDevice()
val onFlashComplete = {
showRebootDialog = true
@@ -169,7 +170,7 @@ fun InstallScreen(navigator: DestinationsNavigator) {
// 槽位选择
SlotSelectionDialog(
show = showSlotSelectionDialog,
show = showSlotSelectionDialog && isAbDevice,
onDismiss = { showSlotSelectionDialog = false },
onSlotSelected = { slot ->
showSlotSelectionDialog = false
@@ -240,10 +241,15 @@ fun InstallScreen(navigator: DestinationsNavigator) {
) {
SelectInstallMethod(
isGKI = isGKI,
isAbDevice = isAbDevice,
onSelected = { method ->
if (method is InstallMethod.HorizonKernel && method.uri != null && method.slot == null) {
tempKernelUri = method.uri
showSlotSelectionDialog = true
if (method is InstallMethod.HorizonKernel && method.uri != null) {
if (isAbDevice) {
tempKernelUri = method.uri
showSlotSelectionDialog = true
} else {
installMethod = method
}
} else {
installMethod = method
}
@@ -395,6 +401,7 @@ sealed class InstallMethod {
@Composable
private fun SelectInstallMethod(
isGKI: Boolean = false,
isAbDevice: Boolean = false,
onSelected: (InstallMethod) -> Unit = {}
) {
val rootAvailable = rootAvailable()
@@ -488,7 +495,7 @@ private fun SelectInstallMethod(
modifier = Modifier.padding(horizontal = 16.dp)
) {
// LKM 安装/修补
if (isGKI && rootAvailable) {
if (isGKI) {
ElevatedCard(
colors = getCardColors(MaterialTheme.colorScheme.surfaceVariant),
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
@@ -698,43 +705,6 @@ private fun SelectInstallMethod(
}
}
}
// 没有root
if (!rootAvailable) {
ElevatedCard(
colors = getCardColors(MaterialTheme.colorScheme.errorContainer),
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 12.dp)
.clip(MaterialTheme.shapes.large)
.shadow(
elevation = cardElevation,
shape = MaterialTheme.shapes.large,
spotColor = MaterialTheme.colorScheme.error.copy(alpha = 0.1f)
)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(24.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Filled.AutoFixHigh,
contentDescription = null,
tint = MaterialTheme.colorScheme.onErrorContainer,
modifier = Modifier
.padding(end = 16.dp)
)
Text(
text = stringResource(R.string.root_require_for_install),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onErrorContainer
)
}
}
}
}
}