fix(native): proot fast path turns off and greys out while running without proot

This commit is contained in:
Kurt Himebauch committed 2026-11-09 06:53:23 -05:00
1 parent c0bcebc919
commit 1008da4e8d
6 files changed
+19 -9

No files matched your search

@@ -12,15 +12,16 @@ object ProotFastPath {
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
const val MAX_BINDS = 256
fun allows(preference: Boolean, noSeccomp: Boolean, source: String): Boolean =
preference && !noSeccomp && source == LinuxRuntime.PROOT_PACK
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
preference && !noSeccomp && !nativeUserland && source == LinuxRuntime.PROOT_PACK
fun enabled(context: Context): Boolean {
val preference = SessionPrefs.prootFastPath(context)
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
val nativeUserland = SessionPrefs.nativeUserland(context)
val source = LinuxRuntime.prootSource(context)
val on = allows(preference, noSeccomp, source)
if (preference && !noSeccomp && !on)
val on = allows(preference, noSeccomp, source, nativeUserland)
if (preference && !noSeccomp && !nativeUserland && !on)
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
return on
}
@@ -264,7 +264,7 @@ object SessionFiles {
if (patched > 0) Log.i(TAG, "native userland: $patched system call sites in ld.so and libc answer Android's blocked calls")
com.droiddeck.launcher.runtime.NativeGuest.syncLibraryDirs(root)
}
if (ProotFastPath.enabled(context) && !nativeUserland) {
if (ProotFastPath.enabled(context)) {
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
preload.append(library + "\n")
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
@@ -666,7 +666,7 @@ class SessionService : Service() {
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir)
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
val fastPathKey = if (ProotFastPath.enabled(this) && !nativeUserland) {
val fastPathKey = if (ProotFastPath.enabled(this)) {
val prootBinds = LinuxRuntime.binds(
this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds,
)
@@ -189,9 +189,13 @@ fun PerformancePage(
)
ToggleRow(
host, "fastpath", stringResource(R.string.perf_fastpath),
if (prootNoSeccomp) stringResource(R.string.perf_fastpath_needs_seccomp)
else stringResource(R.string.perf_fastpath_hint),
prootFastPath && !prootNoSeccomp, enabled = !prootNoSeccomp, onChange = onProotFastPath,
when {
nativeUserland -> stringResource(R.string.perf_fastpath_needs_proot)
prootNoSeccomp -> stringResource(R.string.perf_fastpath_needs_seccomp)
else -> stringResource(R.string.perf_fastpath_hint)
},
prootFastPath && !prootNoSeccomp && !nativeUserland, enabled = !prootNoSeccomp && !nativeUserland,
onChange = onProotFastPath,
)
ToggleRow(
host, "nativeuserland", stringResource(R.string.perf_native_userland),
+1
View File
@@ -651,6 +651,7 @@
<string name="perf_native_userland">Run without proot (experimental)</string>
<string name="perf_native_userland_hint">Starts the Linux side directly on Android. Applies to the next session. Turn off if something fails to start.</string>
<string name="perf_fastpath">proot fast path</string>
<string name="perf_fastpath_needs_proot">Not used without proot.</string>
<string name="perf_fastpath_needs_seccomp">Needs proot\'s seccomp filter.</string>
<string name="perf_fastpath_hint">Faster file lookups and less stutter. Turn off if a program can\'t find its files.</string>
<string name="perf_cursor_composite">Draw the cursor inside gamescope</string>
@@ -33,4 +33,8 @@ class ProotFastPathTest {
assertFalse(ProotFastPath.allows(preference = false, noSeccomp = false, source = LinuxRuntime.PROOT_PACK))
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = true, source = LinuxRuntime.PROOT_PACK))
}
@Test fun fastPathStaysOffWithoutProot() {
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_PACK, nativeUserland = true))
}
}