chore: consistent code branding (#2800)

* chore: consistent code branding

* fix: carry legacy overrides, queues and live sync rows across the rename

* fix: keep queued legacy overrides on a failed rename and separate merged queue entries
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-17 23:31:26 -05:00
1 parent ad9348879d
commit eabcfc7b74
229 files changed
+2584 -2468

No files matched your search

@@ -209,7 +209,7 @@ class AgentSecurityTest {
@Test fun fastPathLibraryIsValidatedAndSelectedForOneSession() {
AgentAccess.setCommandsEnabled(context, true)
val source = File(AgentEnv.inbox(context).apply { mkdirs() }, "libblfastpath.so")
val source = File(AgentEnv.inbox(context).apply { mkdirs() }, "libddfastpath.so")
source.writeText("wrong architecture")
refused("INVALID_LIBRARY") { AgentEnv.override(context, source.name) }
val header = ByteArray(64)
@@ -227,11 +227,43 @@ class AgentSecurityTest {
assertEquals(64, response.getString("sha256").length)
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
AgentEnv.beginSession(context)
assertEquals("/opt/droiddeck-agent/bin/libblfastpath.so", AgentEnv.fastPathLibrary(context))
assertEquals("/opt/droiddeck-agent/bin/libddfastpath.so", AgentEnv.fastPathLibrary(context))
AgentEnv.endSession(context)
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
}
@Test fun aFastPathOverrideQueuedUnderTheOldNameStillApplies() {
AgentAccess.setCommandsEnabled(context, true)
File(AgentEnv.inbox(context).apply { mkdirs() }, "libblfastpath.so").writeText("old")
refused("INVALID_NAME") { AgentEnv.override(context, "libblfastpath.so") }
val bin = File(LinuxRuntime.rootDir(context), "opt/droiddeck-agent/bin").apply { mkdirs() }
File(bin, "libblfastpath.so").writeText("queued")
File(context.filesDir, "agent-env.json").writeText("""{"pendingOverrides":["libblfastpath.so"]}""")
AgentEnv.beginSession(context)
assertEquals("/opt/droiddeck-agent/bin/libddfastpath.so", AgentEnv.fastPathLibrary(context))
assertEquals("queued", File(bin, "libddfastpath.so").readText())
assertFalse(File(bin, "libblfastpath.so").exists())
AgentEnv.endSession(context)
}
@Test fun aQueuedOldNameOverrideThatCannotBeRenamedWaits() {
AgentAccess.setCommandsEnabled(context, true)
val bin = File(LinuxRuntime.rootDir(context), "opt/droiddeck-agent/bin").apply { mkdirs() }
File(bin, "libblfastpath.so").writeText("queued")
File(context.filesDir, "agent-env.json").writeText("""{"pendingOverrides":["libblfastpath.so"]}""")
bin.setWritable(false)
try {
org.junit.Assume.assumeFalse(bin.canWrite())
AgentEnv.beginSession(context)
assertEquals(ProotFastPath.LIBRARY, AgentEnv.fastPathLibrary(context))
assertTrue(File(bin, "libblfastpath.so").isFile)
val state = JSONObject(File(context.filesDir, "agent-env.json").readText())
assertEquals("libddfastpath.so", state.getJSONArray("pendingOverrides").getString(0))
} finally {
bin.setWritable(true)
}
}
@Test fun environmentValuesAreNotLogged() {
AgentAccess.setCommandsEnabled(context, true)
AgentEnv.set(context, listOf("CUSTOM=synthetic-private-value"), false)
@@ -134,12 +134,12 @@ class GameEnvironmentTest {
assertEquals("1", chosen.games["42"]!!["FEX_TSOENABLED"])
}
val ntsync = GameEnvironment.withGameSync(base, "42", "ntsync").games["42"]!!
assertEquals(listOf("1", "0", "1"), listOf(ntsync["BL_SYNC"], ntsync["BL_FSYNC_FIRST"], ntsync["BL_SYNC_FALLBACK"]))
assertEquals(listOf("1", "0", "1"), listOf(ntsync["DD_SYNC"], ntsync["DD_FSYNC_FIRST"], ntsync["DD_SYNC_FALLBACK"]))
assertFalse(ntsync.containsKey("PROTON_NO_ESYNC"))
val fsync = GameEnvironment.withGameSync(base, "42", "fsync").games["42"]!!
assertEquals(listOf("0", "1", "1", "1"), listOf(fsync["BL_SYNC"], fsync["BL_FSYNC_FIRST"], fsync["BL_SYNC_FALLBACK"], fsync["PROTON_NO_ESYNC"]))
assertEquals(listOf("0", "1", "1", "1"), listOf(fsync["DD_SYNC"], fsync["DD_FSYNC_FIRST"], fsync["DD_SYNC_FALLBACK"], fsync["PROTON_NO_ESYNC"]))
val wineserver = GameEnvironment.withGameSync(base, "42", "wineserver").games["42"]!!
assertEquals(listOf("0", "0", "0"), listOf(wineserver["BL_SYNC"], wineserver["BL_FSYNC_FIRST"], wineserver["BL_SYNC_FALLBACK"]))
assertEquals(listOf("0", "0", "0"), listOf(wineserver["DD_SYNC"], wineserver["DD_FSYNC_FIRST"], wineserver["DD_SYNC_FALLBACK"]))
val inherited = GameEnvironment.withGameSync(base, "42", null)
assertNull(GameEnvironment.gameSync(inherited, "42"))
assertEquals(mapOf("FEX_TSOENABLED" to "1"), inherited.games["42"])
@@ -35,7 +35,7 @@ class ModeSettingsLoadingTest {
@Test fun desktopDoesNotConsumeSteamsAppliedShaderChoice() {
val activity = Robolectric.buildActivity(FrontEndActivity::class.java).get()
SessionPrefs.setShaderPrecache(activity, false)
val applied = File(LinuxRuntime.rootDir(activity), "root/.bl-shader-precache-applied")
val applied = File(LinuxRuntime.rootDir(activity), "root/.dd-shader-precache-applied")
applied.parentFile!!.mkdirs()
applied.writeText("0")
load(activity, SessionService.MODE_DESKTOP)
@@ -82,7 +82,7 @@ class FrameStatsTest {
}
@Test fun guestFrameTimesMoveByThePausedSessionsClockShift() {
val control = java.io.File.createTempFile("bl-clock", null)
val control = java.io.File.createTempFile("dd-clock", null)
try {
control.writeBytes(java.nio.ByteBuffer.allocate(8).order(java.nio.ByteOrder.LITTLE_ENDIAN).putLong(62_283_930_706L).array())
val feed = GameFrameFeed(java.io.File("/nonexistent/droiddeck-hud/frames"), clockControl = control)
@@ -60,10 +60,10 @@ class BwrapSpawnerTest {
val env = mutableMapOf(
"DDNATV_ROOT" to rootfs, "DDNATV_BINDS" to "/dev:/dev", "HOME" to "/root",
"SPA_PLUGIN_DIR" to "/usr/local/lib/droiddeck-pipewire/lib/spa-0.2",
"LD_PRELOAD" to "/run/droiddeck-preload/libblsession.so:$rootfs/usr/local/lib/libblsession.so:$rootfs/usr/lib/libddnatv-hook.so",
"LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so:$rootfs/usr/local/lib/libddsession.so:$rootfs/usr/lib/libddnatv-hook.so",
)
BwrapSpawner.withoutRootfsSettings(env, rootfs)
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libblsession.so"), env)
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so"), env)
val onlySession = mutableMapOf("LD_PRELOAD" to "$rootfs/usr/lib/libddnatv-hook.so")
BwrapSpawner.withoutRootfsSettings(onlySession, rootfs)
assertTrue(onlySession.isEmpty())
@@ -117,33 +117,33 @@ class BwrapSpawnerPlanTest {
lib.parentFile!!.mkdirs()
lib.writeText("")
val root = File(dir, "root").apply { mkdirs() }
for (session in listOf(emptyMap(), mapOf("BL_DESKTOP" to "1"),
mapOf("BL_DESKTOP" to "1", "GALLIUM_DRIVER" to "zink", "MESA_LOADER_DRIVER_OVERRIDE" to "zink"))) {
for (session in listOf(emptyMap(), mapOf("DD_DESKTOP" to "1"),
mapOf("DD_DESKTOP" to "1", "GALLIUM_DRIVER" to "zink", "MESA_LOADER_DRIVER_OVERRIDE" to "zink"))) {
val env = session.toMutableMap()
val binds = BwrapSpawner.gpu(runtime.path, root, env, true)!!
assertTrue(binds.any { it.host == lib.canonicalPath && it.guest == "/run/droiddeck-gpu/libvulkan_freedreno.so" })
assertEquals("/run/droiddeck-gpu/freedreno_icd.json", env["VK_DRIVER_FILES"])
assertEquals("zink", env["GALLIUM_DRIVER"])
assertEquals(session["BL_DESKTOP"], env["BL_DESKTOP"])
assertEquals(session["DD_DESKTOP"], env["DD_DESKTOP"])
}
for (choice in listOf(mapOf("VK_DRIVER_FILES" to "/custom/icd.json"),
mapOf("VK_ICD_FILENAMES" to ""), mapOf("LIBGL_ALWAYS_SOFTWARE" to "1"))) {
val env = (choice + ("BL_DESKTOP" to "1")).toMutableMap()
val env = (choice + ("DD_DESKTOP" to "1")).toMutableMap()
val original = env.toMap()
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, env, true))
assertEquals(original, env)
}
val env = mutableMapOf("BL_DESKTOP" to "1", "GALLIUM_DRIVER" to "llvmpipe")
val env = mutableMapOf("DD_DESKTOP" to "1", "GALLIUM_DRIVER" to "llvmpipe")
assertTrue(BwrapSpawner.gpu(runtime.path, root, env, true)!!.isNotEmpty())
assertEquals("llvmpipe", env["GALLIUM_DRIVER"])
val gamescope = mutableMapOf("BL_DESKTOP" to "1", "LIBGL_ALWAYS_SOFTWARE" to "1", "GAMESCOPE_WAYLAND_DISPLAY" to "gamescope-0")
val gamescope = mutableMapOf("DD_DESKTOP" to "1", "LIBGL_ALWAYS_SOFTWARE" to "1", "GAMESCOPE_WAYLAND_DISPLAY" to "gamescope-0")
assertTrue(BwrapSpawner.gpu(runtime.path, root, gamescope, true)!!.isNotEmpty())
val unavailable = mutableMapOf("BL_DESKTOP" to "1")
val unavailable = mutableMapOf("DD_DESKTOP" to "1")
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, unavailable, false))
assertEquals(mapOf("BL_DESKTOP" to "1"), unavailable)
assertEquals(mapOf("DD_DESKTOP" to "1"), unavailable)
assertTrue(lib.delete())
assertEquals(null, BwrapSpawner.gpu(runtime.path, root, unavailable, true))
assertEquals(mapOf("BL_DESKTOP" to "1"), unavailable)
assertEquals(mapOf("DD_DESKTOP" to "1"), unavailable)
}
@Test fun buildsTheTreeFlatpakAsksFor() {
@@ -181,8 +181,8 @@ class BwrapSpawnerPlanTest {
@Test fun fexSandboxesStartThroughTheEnvTheyBringAndSkipArmPreloads() {
val context = RuntimeEnvironment.getApplication()
val rootfs = LinuxRuntime.rootDir(context)
val lib = File(rootfs, "usr/local/lib/libblsession.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libblsession.so\n") }
val lib = File(rootfs, "usr/local/lib/libddsession.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libddsession.so\n") }
try {
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp"))
.put("envTool", "/run/droiddeck-fex/bin/env"), dir)
@@ -197,12 +197,12 @@ class BwrapSpawnerPlanTest {
@Test fun sandboxedAppsSeeTheSessionsNetworkLink() {
val context = RuntimeEnvironment.getApplication()
val rootfs = LinuxRuntime.rootDir(context)
val lib = File(rootfs, "usr/local/lib/libblsession.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libblsession.so\n") }
val lib = File(rootfs, "usr/local/lib/libddsession.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libddsession.so\n") }
val link = File(rootfs, "etc/droiddeck-net").apply { writeText("if wlan0 2 1500\n") }
try {
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp")), dir)
assertEquals("/run/droiddeck-preload/libblsession.so", plan.env["LD_PRELOAD"])
assertEquals("/run/droiddeck-preload/libddsession.so", plan.env["LD_PRELOAD"])
assertEquals(link.path, plan.binds.single { it.guest == "/etc/droiddeck-net" }.host)
} finally {
listOf(lib, preload, link).forEach { it.delete() }
@@ -93,4 +93,41 @@ class LegacyNamesTest {
assertEquals("Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/other.AppImage\n",
File(root, "usr/share/applications/other.desktop").readText())
}
@Test fun homeMarkersKeepTheirStateAndRetiredLibrariesGo() {
write("root/.bl-lossless-asked", "1")
write("root/.bl-compat-pending", "550\n")
write("root/.dd-seed-beat", "new")
write("root/.bl-seed-beat", "old")
write("usr/local/lib/libblsession.so", "old")
write("usr/local/lib/droiddeck-fex/x86_64/libblsession.so", "old")
write("usr/local/lib/libddsession.so", "new")
LegacyNames.migrateRootfs(root)
assertEquals("1", File(root, "root/.dd-lossless-asked").readText())
assertEquals("550\n", File(root, "root/.dd-compat-pending").readText())
assertEquals("new", File(root, "root/.dd-seed-beat").readText())
assertFalse(File(root, "root/.bl-lossless-asked").exists())
assertFalse(File(root, "root/.bl-seed-beat").exists())
assertFalse(File(root, "usr/local/lib/libblsession.so").exists())
assertFalse(File(root, "usr/local/lib/droiddeck-fex/x86_64/libblsession.so").exists())
assertEquals("new", File(root, "usr/local/lib/libddsession.so").readText())
}
@Test fun queuedRequestsUnderBothNamesAreAllKept() {
write("root/.bl-proton-extra", "ge")
write("root/.dd-proton-extra", "em\n")
LegacyNames.migrateRootfs(root)
assertEquals("em\nge\n", File(root, "root/.dd-proton-extra").readText())
assertFalse(File(root, "root/.bl-proton-extra").exists())
}
@Test fun queuedRequestsStaySeparateWhenTheNewQueueIsUnterminated() {
write("root/.bl-proton-extra", "ge\n")
write("root/.dd-proton-extra", "cachyos")
write("root/.bl-steam-urls", "steam://run/440")
write("root/.dd-steam-urls", "steam://run/570")
LegacyNames.migrateRootfs(root)
assertEquals("cachyos\nge\n", File(root, "root/.dd-proton-extra").readText())
assertEquals("steam://run/570\nsteam://run/440\n", File(root, "root/.dd-steam-urls").readText())
}
}
@@ -679,11 +679,11 @@ class EsyncPacksTest {
val root = temp.newFolder("rootfs")
EsyncPacks.store(root).mkdirs()
assertEquals(0, EsyncPacks.fetchWanted(context, root))
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("BL_SYNC_FALLBACK" to "1"))))
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("DD_SYNC_FALLBACK" to "1"))))
assertTrue(EsyncPacks.enabled(context))
GameEnvironmentStore.save(context, GameEnvironment.Config(shared = mapOf("BL_SYNC_FALLBACK" to "1")))
GameEnvironmentStore.save(context, GameEnvironment.Config(shared = mapOf("DD_SYNC_FALLBACK" to "1")))
assertTrue(EsyncPacks.enabled(context))
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("BL_SYNC_FALLBACK" to "0"))))
GameEnvironmentStore.save(context, GameEnvironment.Config(games = mapOf("42" to mapOf("DD_SYNC_FALLBACK" to "0"))))
assertFalse(EsyncPacks.enabled(context))
SessionPrefs.setSyncFallback(context, true)
assertTrue(EsyncPacks.enabled(context))
@@ -41,6 +41,6 @@ class FexCatalogTest {
@Test fun theSessionGetsTheBuildAndEverySource() {
val env = FexCatalog.environment(FexCatalog.Build("fex-2610-r5", url, sha), listOf(url, "https://ghfast.top/$url"))
assertEquals(listOf("BL_FEX_TAG=fex-2610-r5", "BL_FEX_SHA256=$sha", "BL_FEX_URLS=$url https://ghfast.top/$url"), env)
assertEquals(listOf("DD_FEX_TAG=fex-2610-r5", "DD_FEX_SHA256=$sha", "DD_FEX_URLS=$url https://ghfast.top/$url"), env)
}
}
@@ -315,4 +315,12 @@ class GameEnvironmentStoreTest {
GameEnvironmentStore.save(context, config)
assertEquals(config, GameEnvironmentStore.read(context))
}
@Test fun savedSettingsFromBeforeTheRenameKeepTheirValues() {
val json = JSONObject("""{"version":1,"shared":{"BL_SYNC":"1","DXVK_HUD":"fps"},
"games":{"440":{"BL_FSYNC_FIRST":"1","BL_SYNC_FALLBACK":"0","DD_SYNC_FALLBACK":"1"}}}""")
val config = GameEnvironmentStore.decode(json)
assertEquals(mapOf("DD_SYNC" to "1", "DXVK_HUD" to "fps"), config.shared)
assertEquals(mapOf("DD_FSYNC_FIRST" to "1", "DD_SYNC_FALLBACK" to "1"), config.games["440"])
}
}
@@ -39,7 +39,7 @@ class SessionSuspendControllerTest {
assertEquals(listOf(Triple(1, 1_000_000L, 3_000_000L)), fixture.pagedOut)
assertEquals(0, fixture.unacknowledged)
assertTrue(fixture.game.threads.all { it.state == 't' })
assertFalse(File(fixture.control.parentFile, ".bl-zram.ack.$GAME").exists())
assertFalse(File(fixture.control.parentFile, ".dd-zram.ack.$GAME").exists())
}
@Test fun unchangedSwapIsNotTakenForAFinishedPageOut() {
@@ -478,8 +478,8 @@ class SessionSuspendControllerTest {
var emptyGameTasks = false
var rootGone = false
var afterSleep: (() -> Unit)? = null
val control = File(tmp, ".bl-zram")
val clock = File(tmp, ".bl-clock")
val control = File(tmp, ".dd-zram")
val clock = File(tmp, ".dd-clock")
var clockAtContinue: Long? = null
var clockAtMapping: Long? = null
val pagedOut = mutableListOf<Triple<Int, Long, Long>>()
@@ -582,7 +582,7 @@ class SessionSuspendControllerTest {
"TracerPid: ${group.tracer}\n" +
if (group == game) "VmRSS:\t$gameResidentKb kB\nVmSwap:\t$gameSwapKb kB\n" else "",
)
if (group == game) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libblsession.so\n")
if (group == game) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libddsession.so\n")
val taskDir = File(dir, "task")
if (group == game && missingGameTasks) { taskDir.deleteRecursively(); continue }
taskDir.mkdirs()
@@ -250,7 +250,7 @@ class SteamDownloadMonitorTest {
File(steam, "package").mkdirs()
File(steam, "package/bannerlator-installed").writeText("1\n")
assertFalse(SteamDownloadMonitor.clientInstallPending(root))
File(root, "root/.bl-steam-repair").writeText("1\n")
File(root, "root/.dd-steam-repair").writeText("1\n")
assertTrue(SteamDownloadMonitor.clientInstallPending(root))
} finally {
root.deleteRecursively()