mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix: stop starting a session on the slow proot (#1395)
This commit is contained in:
1 parent
5d945d7784
commit
d65912f0c5
14 files changed
+169
-16
No files matched your search
@@ -9,6 +9,7 @@ import com.droiddeck.launcher.core.TextureFiltering
|
||||
import com.droiddeck.launcher.gpu.Cardboard
|
||||
import com.droiddeck.launcher.gpu.ScreenEffects
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
object SessionPrefs {
|
||||
data class GameTextureFiltering(val anisotropy: Int? = null, val lodBias: String? = null)
|
||||
@@ -527,6 +528,15 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("cursorComposite", on).apply()
|
||||
}
|
||||
|
||||
/**
|
||||
* The rootfs ships Termux's unpatched proot. A session uses it only when this file exists,
|
||||
* so a missing add-on pack cannot silently fall back to it.
|
||||
* Path: Android/data/<package>/files/droiddeck-stock-proot
|
||||
*/
|
||||
@JvmStatic
|
||||
fun allowStockProot(context: Context): Boolean =
|
||||
context.getExternalFilesDir(null)?.let { File(it, "droiddeck-stock-proot").isFile } == true
|
||||
|
||||
const val DEFAULT_GUEST_HOSTNAME = "DroidDeck"
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.PowerManager
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.view.Display
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.SessionActivity
|
||||
import com.droiddeck.launcher.audio.DirectAudioRelayComponent
|
||||
@@ -430,8 +431,30 @@ class SessionService : Service() {
|
||||
val sessionRoot = LinuxRuntime.sessionRoot(this).apply { mkdirs() }
|
||||
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
||||
killStragglers()
|
||||
for (pack in listOf(AddonPack.PROOT, AddonPack.DIRECTAUDIO))
|
||||
if (!pack.await(this, { gen == sessionGen && SessionState.running })) Log.w(TAG, "${pack.name} pack unavailable")
|
||||
val stillStarting = { gen == sessionGen && SessionState.running }
|
||||
val prootPack = LinuxRuntime.patchedProot(this) || AddonPack.PROOT.await(this, stillStarting)
|
||||
val directAudioPack = AddonPack.DIRECTAUDIO.await(this, stillStarting)
|
||||
if (!stillStarting()) {
|
||||
Log.i(TAG, "session stopped while add-on packs were downloading")
|
||||
return
|
||||
}
|
||||
if (!directAudioPack) {
|
||||
Log.w(TAG, "directaudio pack unavailable; game audio drivers will not be staged")
|
||||
mainHandler.post {
|
||||
Toast.makeText(this, R.string.session_directaudio_missing, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
if (!LinuxRuntime.patchedProot(this)) {
|
||||
if (SessionPrefs.allowStockProot(this)) {
|
||||
Log.w(TAG, "proot: patched proot missing; droiddeck-stock-proot allows the rootfs copy")
|
||||
} else {
|
||||
val message = getString(R.string.session_proot_missing)
|
||||
Log.e(TAG, "$message (pack ready=$prootPack)")
|
||||
SessionEvents.fail("PROOT_MISSING", message, -1)
|
||||
stopSession(-1)
|
||||
return
|
||||
}
|
||||
}
|
||||
val agentEnvironment = runCatching { com.droiddeck.launcher.agent.AgentEnv.beginSession(this) }
|
||||
.onFailure { Log.w(TAG, "agent environment skipped", it) }
|
||||
.getOrDefault(emptyList())
|
||||
@@ -446,6 +469,10 @@ class SessionService : Service() {
|
||||
|
||||
val sessionDir = openSessionFolder()
|
||||
val sessionLog = File(sessionDir, "session.log")
|
||||
val prootLine = "== proot: ${LinuxRuntime.prootBinary(this).path} (${LinuxRuntime.prootSource(this)})"
|
||||
Log.i(TAG, prootLine)
|
||||
runCatching { sessionLog.appendText(prootLine + "\n") }
|
||||
.onFailure { Log.w(TAG, "could not write the proot line to ${sessionLog.path}", it) }
|
||||
|
||||
Log.i(TAG, GpuClockPin.start(this))
|
||||
Log.i(TAG, GameThreadHints.start(this))
|
||||
@@ -462,7 +489,7 @@ class SessionService : Service() {
|
||||
if (steamHere) guest.add("BL_EPIC_APP_ID=" + com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId)
|
||||
val fastPathAt = guest.size
|
||||
|
||||
val pulse = startAudio(guest, sessionDir)
|
||||
val pulse = startAudio(guest, sessionDir, directAudioPack)
|
||||
if (steamHere) {
|
||||
val encoder = VideoEncodeBridge(File(filesDir, "venc/venc.sock"))
|
||||
encoder.attach(this)
|
||||
@@ -781,8 +808,9 @@ class SessionService : Service() {
|
||||
private fun noSteamGame(): Boolean =
|
||||
SessionState.mode == MODE_RUN && SessionState.program in setOf(NoSteamLaunch.PROTON_RUN, NoSteamLaunch.EPIC, NoSteamLaunch.BATTLENET)
|
||||
|
||||
private fun startAudio(guest: MutableList<String>, sessionDir: File): PulseAudioComponent {
|
||||
val wantsDirectAudio = (SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || noSteamGame()) &&
|
||||
private fun startAudio(guest: MutableList<String>, sessionDir: File, directAudioPack: Boolean): PulseAudioComponent {
|
||||
val wantsDirectAudio = directAudioPack &&
|
||||
(SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || noSteamGame()) &&
|
||||
SessionPrefs.directAudio(this)
|
||||
val wantsMic = SessionPrefs.micEnabled(this) &&
|
||||
checkSelfPermission(android.Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
|
||||
|
||||
Reference in new issue
Block a user