feat: move UBWC compatibility from Components to Settings (#2008)

* feat: move UBWC compatibility from Components to Settings

* fix: update driver menu tests for the moved UBWC restart check

* fix: load saved UBWC mode at startup and block Settings restart during runtime operations
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-07 15:39:55 -05:00
1 parent 041c3b1b55
commit d9bf6d8a17
39 files changed
+38 -65

No files matched your search

@@ -115,6 +115,9 @@ class FrontEndState(
val adbPaired: Boolean = false,
val backgroundAppLimit: Int = -1,
val memoryHud: String = "off",
val tpUbwcMode: String? = null,
val tpUbwcRestartRequired: Boolean = false,
val canRestartApp: Boolean = false,
val steamGames: List<Library.SteamGame>,
val steamGamesX64: Boolean = false,
val emulators: List<Library.Emulator>,
@@ -245,6 +248,8 @@ class FrontEndActions(
val onSteamGpuDrawing: () -> Unit = {},
val onClearCachedApps: (Boolean) -> Unit = {},
val onMemoryHud: (String) -> Unit = {},
val onTpUbwcMode: (String) -> Unit = {},
val onRestartApp: () -> Unit = {},
val onBackgroundAppLimit: (Int) -> Unit = {},
val onShareLogs: () -> Unit = {},
val onShareSessionLog: (File) -> Unit = {},
@@ -472,6 +472,20 @@ internal fun SetupPanel(
com.droiddeck.launcher.core.AppUiPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
s.launcherOrientation, onPick = a.onLauncherOrientation,
)
s.tpUbwcMode?.let { ubwc ->
ChoiceRow(
host, "tp-ubwc", stringResource(R.string.gpu_ubwc_title), stringResource(R.string.gpu_ubwc_hint),
listOf(
SessionPrefs.TP_UBWC_AUTO to stringResource(R.string.common_auto),
SessionPrefs.TP_UBWC_ON to stringResource(R.string.widgets_on),
SessionPrefs.TP_UBWC_OFF to stringResource(R.string.widgets_off),
), ubwc, onPick = a.onTpUbwcMode,
)
if (s.tpUbwcRestartRequired) {
if (s.canRestartApp) ActionRow(stringResource(R.string.gpu_ubwc_restart), null, stringResource(R.string.gpu_restart_now), a.onRestartApp)
else Note(stringResource(R.string.gpu_ubwc_restart))
}
}
ChoiceRow(
host, "orientation", stringResource(R.string.setup_session_orientation), stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
@@ -1,7 +1,6 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.focusGroup
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.layout.LayoutCoordinates
@@ -134,8 +133,6 @@ class GpuDriversState(
val runtime: DriverSlot = DriverSlot(),
val canRestart: Boolean = true,
val checkedAt: Long = 0L,
val tpUbwcMode: String? = null,
val tpUbwcRestartRequired: Boolean = false,
) {
val activePair: PairRow? get() = pairs.firstOrNull { it.active }
}
@@ -156,7 +153,6 @@ class GpuDriversActions(
val onRestoreBundled: () -> Unit = {},
val onMode: (String) -> Unit = {},
val onRestart: () -> Unit = {},
val onTpUbwcMode: (String) -> Unit = {},
)
@Composable
@@ -258,27 +254,6 @@ internal fun GpuDriversBody(
GPU_MODE_PAIR -> PairBody(gpu, actions)
else -> MixBody(single, actions, slotFocus, onOpenSlot)
}
gpu.tpUbwcMode?.let { selected ->
var advanced by rememberSaveable { mutableStateOf(false) }
SecondaryButton(stringResource(R.string.gpu_advanced) + if (advanced) " ▴" else " ▾", modifier = Modifier.fillMaxWidth()) { advanced = !advanced }
AnimatedVisibility(advanced) {
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
ChoiceRow(
rememberMenuHost(), "tp-ubwc", stringResource(R.string.gpu_ubwc_title),
stringResource(R.string.gpu_ubwc_hint),
listOf(
SessionPrefs.TP_UBWC_AUTO to stringResource(R.string.common_auto),
SessionPrefs.TP_UBWC_ON to stringResource(R.string.widgets_on),
SessionPrefs.TP_UBWC_OFF to stringResource(R.string.widgets_off),
), selected, onPick = actions.onTpUbwcMode,
)
if (gpu.tpUbwcRestartRequired) {
Text(stringResource(R.string.gpu_ubwc_restart), fontSize = 13.sp, color = AttentionAmber)
if (gpu.canRestart) SecondaryButton(stringResource(R.string.gpu_restart_now), onClick = actions.onRestart)
}
}
}
}
}
}