Compare commits

...
Author SHA1 Message Date
maxjivi05 c40c6845eb fix(gpu): merge main into Xclipse auto driver check 2026-11-30 01:35:21 -05:00
MaxsTechReview e101a78791 fix(stores): the front end no longer crashes on start when the Steam engine starts on the refresh thread (#3457)
Keep the Steam install picker state out of the Steam engine object

The picker state lived on SteamStore, which is first touched from the
background stores refresh thread. On the Compose runtime in use, a state
object created outside a snapshot while the composition holds an open
snapshot is unreadable inside it, so the front end crashed on startup
with "Reading a state that was created after the snapshot was taken".
The state now lives on StoresState next to the other UI-facing store
state, and SteamStore holds no Compose state.
2026-11-30 00:02:07 -05:00
The412Banner aaa9fb129c fix(nativeguest): programs on a mount kept at its host path start as guest programs (#3211) 2026-11-29 23:58:32 -05:00
maxjivi05 8e31e07380 fix(gpu): cover successful forced driver refresh 2026-11-23 11:16:30 -05:00
maxjivi05 5ccceed827 Merge remote-tracking branch 'origin/main' into fix/xclipse-auto-no-driver 2026-11-17 12:08:00 -05:00
MaxsTechReview 6e581c9a56 Merge branch 'main' into fix/xclipse-auto-no-driver 2026-11-15 10:52:26 -05:00
maxjivi05 756cd4eae9 Merge remote-tracking branch 'droiddeck/main' into HEAD
# Conflicts:
#	app/src/main/java/com/droiddeck/launcher/DriverMenus.kt
2026-11-15 10:37:49 -05:00
MaxsTechReview d31ad1c279 Merge branch 'main' into fix/xclipse-auto-no-driver 2026-11-13 17:13:56 -05:00
maxjivi05 e090db2d58 fix(gpu): report Xclipse auto check failures for active pairs 2026-11-13 16:09:15 -05:00
maxjivi05 a97ade6a67 fix(gpu): keep Xclipse auto check-failure path for null refresh errors 2026-11-13 15:51:16 -05:00
maxjivi05 89f90812f8 fix(gpu): retry Xclipse auto when the recommended pair cannot be checked 2026-11-13 15:37:17 -05:00
11 changed files with 240 additions and 16 deletions

No files matched your search

@@ -349,7 +349,9 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
releaseChecking = true
autoStatus = activity.getString(R.string.drivers_checking_latest)
Thread({
val problem = if (force || releasesStale()) runCatching { TurnipReleases.refresh(activity) }.exceptionOrNull()?.message else null
val failure = if (force || releasesStale()) runCatching { TurnipReleases.refresh(activity) }.exceptionOrNull() else null
val problem = failure?.message
val checkFailed = failure != null
val holdBack = !force && com.droiddeck.launcher.frontend.AutoComponents.constrained(activity)
runCatching { com.droiddeck.launcher.gpu.VulkanInfo.query() }
ui.post {
@@ -367,8 +369,19 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
SessionPrefs.maliFallbackByAuto(activity), gpu.family.mali,
pair?.key?.let { DriverPairs.isNonAdreno(it) } == true,
)) endMaliFallback()
autoStatus = problem?.let { activity.getString(R.string.drivers_up_to_date_check_failed, it) }
?: activity.getString(R.string.upd_current_status)
autoStatus = if (checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true)
activity.getString(R.string.drivers_up_to_date_check_failed, problem ?: TurnipReleases.NON_ADRENO_LABEL)
else activity.getString(R.string.upd_current_status)
}
gpu.family == GpuInfo.Family.POWERVR && (pair == null || !pair.complete) &&
(checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
if (gpu.name.contains("Xclipse", ignoreCase = true) && DriverPairs.xclipseNeedsUpstream(gpu.name)) {
if (!SessionState.running) SessionPrefs.ensurePowerVrAutoDrivers(activity, powerVr = true, autoOwnedOnly = true)
} else {
SessionPrefs.ensurePowerVrAutoDrivers(activity)
}
autoStatus = activity.getString(R.string.upd_couldnt_check, problem ?: TurnipReleases.NON_ADRENO_LABEL)
refreshDrivers()
}
gpu.family == GpuInfo.Family.POWERVR && (pair == null || !pair.complete) -> {
// RADV is not published right now: the Xclipse falls back to the system route.
@@ -381,7 +394,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
refreshDrivers()
}
gpu.family.mali && (pair == null || !pair.complete) &&
(problem != null || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
(checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
// The list could not be read: nothing is known to be missing, so a working route stays.
// With no open driver, Venus or bridge the session would run the runtime's Turnip,
// which finds no GPU on a Mali, so the stand-in goes on anyway.
@@ -121,6 +121,8 @@ object StoresState {
var unfinished by mutableStateOf<List<StoreInstallRoot.Unfinished>>(emptyList())
internal set
var steamPicking by mutableStateOf<CatalogItem?>(null)
fun isUnfinished(item: CatalogItem): Boolean = unfinished.any {
it.store == item.store && (it.id == item.id || (it.id == null && it.folder.name == StoreInstallRoot.folderName(item.title, item.id)))
}
@@ -6,9 +6,6 @@ import android.net.Uri
import android.util.Log
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.session.SessionService
@@ -46,8 +43,6 @@ internal object SteamStore {
/** InvalidPassword, AccessDenied, AccountNotFound, Revoked, Expired, AccountLogonDenied. */
private val REFUSALS = setOf(5, 15, 18, 26, 27, 63)
var picking by mutableStateOf<CatalogItem?>(null)
class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String, val linuxBuild: Boolean) {
companion object {
fun of(json: JSONObject): Plan? {
@@ -222,7 +217,7 @@ internal object SteamStore {
toast(context, R.string.steam_store_close_steam)
return
}
picking = item
StoresState.steamPicking = item
}
fun install(context: Context, item: CatalogItem, target: SteamClient.Target) {
@@ -847,7 +847,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
com.droiddeck.launcher.stores.StoresState.pendingInstall?.let { item -> StoreTheme(item.store) { InstallWhere(item) } }
com.droiddeck.launcher.stores.StoresState.itchPicking?.let { item -> StoreTheme(item.store) { ItchBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.itchPicking = null } } }
com.droiddeck.launcher.stores.StoresState.gameJoltPicking?.let { item -> StoreTheme(item.store) { GameJoltBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.gameJoltPicking = null } } }
com.droiddeck.launcher.stores.steam.SteamStore.picking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.steam.SteamStore.picking = null } } }
com.droiddeck.launcher.stores.StoresState.steamPicking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.StoresState.steamPicking = null } } }
StepsLayer(screenAt)
UiZooSheet()
SessionDrawerPreview(s.secondScreenDisplays)
@@ -2,16 +2,24 @@ package com.droiddeck.launcher
import android.app.Activity
import android.content.Context
import android.net.Uri
import android.os.Handler
import android.os.Looper
import com.droiddeck.launcher.session.QuestExperimental
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.gpu.DriverBundle
import com.droiddeck.launcher.gpu.DriverPairs
import com.droiddeck.launcher.gpu.GpuInfo
import com.droiddeck.launcher.gpu.GpuInfo.Family
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
import com.droiddeck.launcher.gpu.TpUbwcHint
import com.droiddeck.launcher.gpu.TurnipDriver
import com.droiddeck.launcher.gpu.TurnipReleases
import com.droiddeck.launcher.gpu.VulkanInfo
import com.droiddeck.launcher.gpu.SystemVulkanDriver
import com.droiddeck.launcher.session.QuestExperimental
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.wayland.CompositorHost
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
@@ -22,12 +30,16 @@ import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import org.robolectric.shadows.ShadowBuild
import org.robolectric.shadows.ShadowLooper
import org.robolectric.annotation.Implementation
import org.robolectric.annotation.Implements
import org.robolectric.util.ReflectionHelpers
import java.io.File
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE, shadows = [DriverMenusAutoTest.XclipseDriver::class])
@@ -171,4 +183,118 @@ class DriverMenusAutoTest {
menus.refreshDrivers()
assertTrue(menus.tpUbwcRestartRequired())
}
private fun library(libc: String) = ByteArray(64).also {
byteArrayOf(0x7f, 'E'.code.toByte(), 'L'.code.toByte(), 'F'.code.toByte(), 2, 1).copyInto(it)
it[18] = 0xB7.toByte()
} + libc.toByteArray() + ByteArray(1)
private fun bundleZip(context: Context): Uri {
val manifest = JSONObject()
.put("package", "PanVK Mali JM").put("version", "1.0").put("tag", "panvk-mali-jm")
.put("drivers", JSONObject()
.put("android", JSONObject().put("path", "android"))
.put("linux", JSONObject().put("path", "linux")))
val file = File.createTempFile("bundle", ".zip", context.cacheDir)
ZipOutputStream(file.outputStream()).use { z ->
fun put(name: String, data: ByteArray) { z.putNextEntry(ZipEntry(name)); z.write(data); z.closeEntry() }
put("manifest.json", manifest.toString().toByteArray())
put("android/meta.json", JSONObject().put("name", "PanVK Mali JM").put("libraryName", "libvulkan_freedreno.so").toString().toByteArray())
put("android/libvulkan_freedreno.so", library("libc.so"))
put("linux/meta.json", JSONObject().put("name", "PanVK Mali JM").toString().toByteArray())
put("linux/libvulkan_freedreno.so", library("libc.so.6"))
}
return Uri.fromFile(file)
}
private fun setCachedMaliJmPair(context: Context, assetName: String = "PanVK-JM-Pair.zip") {
val asset = JSONObject()
.put("source", TurnipReleases.NON_ADRENO_LABEL).put("tag", "panvk-mali-jm")
.put("name", assetName).put("url", "https://example/$assetName")
.put("size", 1L).put("linux", false).put("label", "Android + Linux · PanVK Mali JM")
.put("sha256", "0".repeat(64)).put("pair", DriverPairs.NAD_MALI_JM)
.put("bundle", true).put("id", 1L).put("updated_at", "2026-01-01T00:00:00Z")
val stored = JSONObject().put("assets", JSONArray().put(asset))
.put("latest", JSONArray()).put("failed", JSONArray())
.put("checkedAt", System.currentTimeMillis())
context.getSharedPreferences("turnip_releases", Context.MODE_PRIVATE)
.edit().putString("latest", stored.toString()).commit()
}
private fun prepareActiveMaliJmPair(assetName: String = "PanVK-JM-Pair.zip"): Pair<Activity, DriverMenus> {
ShadowBuild.setModel("Generic phone")
ShadowBuild.setDevice("generic")
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
val bundle = DriverBundle.install(activity, bundleZip(activity))
setCachedMaliJmPair(activity, assetName)
TurnipReleases.recordDownload(activity, TurnipReleases.cached(activity)!!.assets.first(), bundle.id)
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_AUTO)
SessionPrefs.setAndroidDriver(activity, TurnipDriver.AUTO)
SessionPrefs.setLinuxDriver(activity, bundle.linuxId)
val menus = DriverMenus(activity, Handler(Looper.getMainLooper()))
ReflectionHelpers.setField(menus, "gpu", GpuInfo("Mali-G78", 78, Family.MALI_JM, "", false))
menus.refreshDrivers()
return activity to menus
}
@Test fun activeRecommendedPairWithNullRefreshFailureShowsCheckFailureStatus() {
val (activity, menus) = prepareActiveMaliJmPair()
val original = TurnipReleases.fetch
TurnipReleases.fetch = { _, _, _ -> throw java.io.IOException(null as String?) }
try {
menus.ensureAuto(force = true)
for (i in 0..40) {
shadowOf(Looper.getMainLooper()).idle()
Thread.sleep(50)
shadowOf(Looper.getMainLooper()).idle()
if (!menus.releaseChecking) break
}
assertEquals(activity.getString(R.string.drivers_up_to_date_check_failed, TurnipReleases.NON_ADRENO_LABEL), menus.autoStatus)
} finally { TurnipReleases.fetch = original }
}
@Test fun activeRecommendedPairWithSuccessfulRefreshShowsCurrentStatus() {
val (activity, menus) = prepareActiveMaliJmPair()
menus.ensureAuto(force = false)
for (i in 0..40) {
shadowOf(Looper.getMainLooper()).idle()
Thread.sleep(50)
shadowOf(Looper.getMainLooper()).idle()
if (!menus.releaseChecking) break
}
assertEquals(activity.getString(R.string.upd_current_status), menus.autoStatus)
}
@Test fun activeRecommendedPairWithSuccessfulForcedRefreshShowsCurrentStatus() {
val (activity, menus) = prepareActiveMaliJmPair("PanVK-Mali-JM-Pair.zip")
val asset = TurnipReleases.cached(activity)!!.assets.single()
val releases = JSONArray().put(JSONObject()
.put("tag_name", asset.tag)
.put("assets", JSONArray().put(JSONObject()
.put("name", asset.name).put("browser_download_url", asset.url)
.put("digest", "sha256:" + asset.sha256).put("size", 1L)
.put("id", 1L).put("updated_at", "2026-01-01T00:00:00Z"))))
val original = TurnipReleases.fetch
val requests = java.util.concurrent.atomic.AtomicInteger()
TurnipReleases.fetch = { _, _, url ->
if (url.contains("droiddeck-nonadreno-drivers/releases")) {
requests.incrementAndGet()
releases.toString()
} else "[]"
}
try {
menus.ensureAuto(force = true)
for (i in 0..40) {
shadowOf(Looper.getMainLooper()).idle()
Thread.sleep(50)
shadowOf(Looper.getMainLooper()).idle()
if (!menus.releaseChecking) break
}
assertFalse(menus.releaseChecking)
assertTrue(requests.get() > 0)
assertTrue(TurnipReleases.cached(activity)!!.failed.isEmpty())
assertEquals(activity.getString(R.string.upd_current_status), menus.autoStatus)
} finally { TurnipReleases.fetch = original }
}
}
@@ -0,0 +1,37 @@
package com.droiddeck.launcher.stores.steam
import androidx.compose.runtime.State
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.StateObject
import com.droiddeck.launcher.stores.StoresState
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import kotlin.concurrent.thread
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33], manifest = Config.NONE)
class SteamPickingSnapshotTest {
@Test
fun theInstallPickerIsReadableInASnapshotOpenedBeforeTheSteamEngineStarts() {
StoresState.steamPicking = null
val snapshot = Snapshot.takeMutableSnapshot()
try {
thread { SteamStore.hashCode() }.join()
assertNull(snapshot.enter { StoresState.steamPicking })
} finally {
snapshot.dispose()
}
}
@Test
fun theSteamEngineHoldsNoComposeState() {
val stateFields = SteamStore::class.java.declaredFields.filter {
StateObject::class.java.isAssignableFrom(it.type) || State::class.java.isAssignableFrom(it.type)
}
assertTrue(stateFields.joinToString { it.name }, stateFields.isEmpty())
}
}
+4 -2
View File
@@ -452,7 +452,8 @@ static int ddnatv_execve(const char *filename, char *const argv[], char *const e
char resolved_target[PATH_MAX];
// Only intercept binaries/scripts within DDNATV_ROOT
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename)) {
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename) ||
is_bound_guest_program(target)) {
struct exec_probe probe;
const char *elf_target = select_exec_target(target, resolved_target, sizeof(resolved_target), &probe);
if (probe.is_elf && !probe.is_dynamic) static_elf = elf_target;
@@ -969,7 +970,8 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
}
char *const *orig_ep = envp ? envp : environ;
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path);
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path) ||
is_bound_guest_program(target);
struct exec_probe probe;
char resolved_target[PATH_MAX];
+8
View File
@@ -983,6 +983,14 @@ static int is_host_interpreter(const char *interp, const char *rewritten) {
return probe.android_interp;
}
static int is_bound_guest_program(const char *path) {
if (g_ddnatv_root[0] == '\0' || !is_identity_bound_path(path)) return 0;
struct exec_probe probe;
probe_exec_file(path, &probe);
if (probe.is_elf) return probe.is_dynamic && !probe.android_interp;
return probe.n >= 2 && probe.hdr[0] == '#' && probe.hdr[1] == '!';
}
// argv for running `script` with its interpreter: interp [arg] script args... (the script's own
// argv[0] is dropped, as the kernel does). free() the result.
static char **build_script_argv(const char *interp, const char *interp_arg, const char *script, char *const argv[]) {
+7
View File
@@ -234,6 +234,13 @@ static int is_mapped_guest_path(const char *path) {
return 0;
}
static int is_identity_bound_path(const char *path) {
if (!path || path[0] != '/') return 0;
for (int i = 0; i < g_nbinds; i++)
if (g_binds[i].identity && is_path_prefix(path, g_binds[i].dst, g_binds[i].dst_len)) return 1;
return 0;
}
// Android's own mounts and files, which must never be redirected into the rootfs.
// `path` starts with '/'; a prefix can only match when its second character does.
static int is_android_host_path(const char *path) {
@@ -120,6 +120,14 @@ class NativeHookLdsoSpawnTest(unittest.TestCase):
script.parent.mkdir(exist_ok=True)
script.write_text(f"#!{interpreter}\n")
script.chmod(0o755)
cls.app_files = tmp / "app-files"
cls.app_files.mkdir()
shutil.copy(cls.probe, cls.app_files / "tool")
shutil.copy(cls.android / "sh", cls.app_files / "android-tool")
for name, interpreter in (("guest.py", GUEST_TOOL), ("android.sh", f"{ANDROID_DIR}/sh")):
(cls.app_files / name).write_text(f"#!{interpreter}\n")
for entry in cls.app_files.iterdir():
entry.chmod(0o755)
@classmethod
def tearDownClass(cls):
@@ -220,6 +228,32 @@ class NativeHookLdsoSpawnTest(unittest.TestCase):
call = self.call(how, "/opt/host.sh", "x", binds=f"{self.runtime}:{BOUND_DIR}")
self.assertEqual([HOST_SHELL, HOST_SHELL, str(self.root / "opt/host.sh"), "x"], call)
def test_a_script_on_a_mount_at_its_host_path_runs_with_the_guest_interpreter(self):
script = str(self.app_files / "guest.py")
for how in ("exec", "spawn"):
with self.subTest(how=how):
call = self.call(how, script, "x", binds=f"{self.app_files}:{self.app_files}")
self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0])
self.assertEqual([str(self.root / GUEST_TOOL.lstrip("/")), script, "x"], call[-3:])
def test_a_glibc_program_on_a_mount_at_its_host_path_starts_through_the_guest_ldso(self):
tool = str(self.app_files / "tool")
for how in ("exec", "spawn"):
with self.subTest(how=how):
call = self.call(how, tool, "x", binds=f"{self.app_files}:{self.app_files}")
self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0])
self.assertEqual([tool, "x"], call[-2:])
def test_android_programs_on_a_mount_at_its_host_path_stay_on_the_host(self):
tool = str(self.app_files / "android-tool")
script = str(self.app_files / "android.sh")
sh = str(self.android / "sh")
binds = f"{self.app_files}:{self.app_files}|{self.android}:{ANDROID_DIR}"
for how in ("exec", "spawn"):
with self.subTest(how=how):
self.assertEqual([tool, tool, "x"], self.call(how, tool, "x", binds=binds))
self.assertEqual([sh, sh, script, "x"], self.call(how, script, "x", binds=binds))
def test_an_android_interpreter_reached_through_a_bind_stays_on_the_host(self):
sh = str(self.android / "sh")
for how in ("exec", "spawn"):