Merge remote-tracking branch 'origin/main' into controller-back-button-gestures

# Conflicts:
#	app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt
This commit is contained in:
xXJsonDeruloXx committed 2026-09-23 23:07:55 -04:00
commit f334738441
119 files changed
+725 -502

No files matched your search

@@ -1,7 +1,7 @@
package com.steamdeck.launcher
package com.droiddeck.launcher
import android.app.Application
import com.steamdeck.launcher.session.CrashHandler
import com.droiddeck.launcher.session.CrashHandler
/** Process-wide setup: the crash handler, so a session's folder is finished even when we die. */
class App : Application() {
@@ -1,9 +1,9 @@
package com.steamdeck.launcher
package com.droiddeck.launcher
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.steamdeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionService
/** Receives the system Home launch and routes it without consuming KEYCODE_HOME. */
class HomeActivity : Activity() {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher
package com.droiddeck.launcher
import android.app.role.RoleManager
import android.graphics.Bitmap
@@ -9,8 +9,8 @@ import android.content.pm.PackageManager
import android.os.Build
import android.provider.Settings
import androidx.core.graphics.drawable.toBitmap
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.session.SessionState
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
/** Android Home role and the launchable Android apps shown by the in-session app drawer. */
object HomeApp {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher
package com.droiddeck.launcher
import android.Manifest
import android.content.Intent
@@ -18,42 +18,42 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.gpu.LinuxVulkanDriver
import com.steamdeck.launcher.gpu.LinuxVulkanDriverManager
import com.steamdeck.launcher.gpu.TurnipDriver
import com.steamdeck.launcher.gpu.TurnipReleases
import com.steamdeck.launcher.gpu.LsfgNative
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.runtime.DesktopCatalog
import com.steamdeck.launcher.runtime.LinuxRuntimeInstaller
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.ui.PackageRow
import com.steamdeck.launcher.session.OfflineMode
import com.steamdeck.launcher.session.ProtonExtras
import com.steamdeck.launcher.session.SessionLogShare
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.ui.ProtonPage
import com.steamdeck.launcher.ui.ProtonRow
import com.steamdeck.launcher.core.CpuCores
import com.steamdeck.launcher.ui.CoreRow
import com.steamdeck.launcher.ui.PerformancePage
import com.steamdeck.launcher.ui.ModeSettingsPage
import com.steamdeck.launcher.ui.ModeSettings
import com.steamdeck.launcher.ui.ModeSettingsActions
import com.steamdeck.launcher.ui.DriverRow
import com.steamdeck.launcher.ui.ConfirmDialog
import com.steamdeck.launcher.ui.CreditsDialog
import com.steamdeck.launcher.ui.FrontEndScreen
import com.steamdeck.launcher.ui.FrontEndState
import com.steamdeck.launcher.ui.FrontEndActions
import com.steamdeck.launcher.frontend.Library
import com.steamdeck.launcher.ui.SteamDeckTheme
import com.steamdeck.launcher.ui.RomsDialog
import com.steamdeck.launcher.files.InAppFilePicker
import com.steamdeck.launcher.session.SessionArtifacts
import com.steamdeck.launcher.session.SessionState
import com.steamdeck.launcher.session.GameStorage
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.gpu.LinuxVulkanDriver
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
import com.droiddeck.launcher.gpu.TurnipDriver
import com.droiddeck.launcher.gpu.TurnipReleases
import com.droiddeck.launcher.gpu.LsfgNative
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.DesktopCatalog
import com.droiddeck.launcher.runtime.LinuxRuntimeInstaller
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.ui.PackageRow
import com.droiddeck.launcher.session.OfflineMode
import com.droiddeck.launcher.session.ProtonExtras
import com.droiddeck.launcher.session.SessionLogShare
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.ui.ProtonPage
import com.droiddeck.launcher.ui.ProtonRow
import com.droiddeck.launcher.core.CpuCores
import com.droiddeck.launcher.ui.CoreRow
import com.droiddeck.launcher.ui.PerformancePage
import com.droiddeck.launcher.ui.ModeSettingsPage
import com.droiddeck.launcher.ui.ModeSettings
import com.droiddeck.launcher.ui.ModeSettingsActions
import com.droiddeck.launcher.ui.DriverRow
import com.droiddeck.launcher.ui.ConfirmDialog
import com.droiddeck.launcher.ui.CreditsDialog
import com.droiddeck.launcher.ui.FrontEndScreen
import com.droiddeck.launcher.ui.FrontEndState
import com.droiddeck.launcher.ui.FrontEndActions
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.ui.DroidDeckTheme
import com.droiddeck.launcher.ui.RomsDialog
import com.droiddeck.launcher.files.InAppFilePicker
import com.droiddeck.launcher.session.SessionArtifacts
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.session.GameStorage
/**
* The whole app outside a session: is the runtime installed, is there a newer one, frame
@@ -107,8 +107,8 @@ class MainActivity : ComponentActivity() {
private var mic by mutableStateOf(false)
private var linuxRows by mutableStateOf<List<DriverRow>>(emptyList())
/** The latest Banners-Turnip release as each driver menu offers it (see [refreshReleaseRows]). */
private var linuxDownloads by mutableStateOf<List<com.steamdeck.launcher.ui.DownloadRow>>(emptyList())
private var androidDownloads by mutableStateOf<List<com.steamdeck.launcher.ui.DownloadRow>>(emptyList())
private var linuxDownloads by mutableStateOf<List<com.droiddeck.launcher.ui.DownloadRow>>(emptyList())
private var androidDownloads by mutableStateOf<List<com.droiddeck.launcher.ui.DownloadRow>>(emptyList())
private var releaseStatus by mutableStateOf("Not checked yet - tap refresh to look for new drivers")
private var releaseChecking by mutableStateOf(false)
private var canRestoreBundled by mutableStateOf(false)
@@ -149,7 +149,7 @@ class MainActivity : ComponentActivity() {
private var addedGamesDirs by mutableStateOf<List<String>>(emptyList())
private var addedGamesArt by mutableStateOf(true)
@Volatile private var artFetchRunning = false
private var addedGames by mutableStateOf<List<com.steamdeck.launcher.ui.AddedGameRow>>(emptyList())
private var addedGames by mutableStateOf<List<com.droiddeck.launcher.ui.AddedGameRow>>(emptyList())
private val pickRomsDir = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedPath(r.data)?.let { path ->
SessionPrefs.setRomsDir(this, path)
@@ -213,7 +213,7 @@ class MainActivity : ComponentActivity() {
theme = SessionPrefs.theme(this)
backActionsInverted = SessionPrefs.backActionsInverted(this)
setContent {
SteamDeckTheme(theme) {
DroidDeckTheme(theme) {
val sm = settingsMode
val page: (@Composable () -> Unit)? = when {
sm != null -> { { ModeSettingsHost(sm) } }
@@ -280,7 +280,7 @@ class MainActivity : ComponentActivity() {
onProtons = { openProtons() },
onPerformance = { refreshCores(); showProtons = false; showPerformance = true },
onRoms = { showRoms = true },
onFiles = { startActivity(Intent(this, com.steamdeck.launcher.files.FileManagerActivity::class.java)) },
onFiles = { startActivity(Intent(this, com.droiddeck.launcher.files.FileManagerActivity::class.java)) },
onLogs = {
SessionPrefs.setLogsEnabled(this, !SessionPrefs.logsEnabled(this))
logsEnabled = SessionPrefs.logsEnabled(this)
@@ -322,7 +322,7 @@ class MainActivity : ComponentActivity() {
showNonAdreno?.let { release ->
ConfirmDialog(
title = "Not an Adreno GPU",
text = "Turnip supports Adreno GPUs. On ${com.steamdeck.launcher.core.DeviceSupport.gpuName()}, Steam may show a black screen. Download: ${"%.0f".format(release.size / 1e6)} MB.",
text = "Turnip supports Adreno GPUs. On ${com.droiddeck.launcher.core.DeviceSupport.gpuName()}, Steam may show a black screen. Download: ${"%.0f".format(release.size / 1e6)} MB.",
confirm = "Install anyway",
onConfirm = { showNonAdreno = null; install(release) },
onDismiss = { showNonAdreno = null },
@@ -619,8 +619,8 @@ class MainActivity : ComponentActivity() {
/** The added games as the settings page lists them; a scan of the folder, on this thread (one level, small). */
private fun refreshAddedGames() {
addedGames = com.steamdeck.launcher.frontend.AddedGames.scan(this).map { g ->
com.steamdeck.launcher.ui.AddedGameRow(g.folder.path, g.folderName(), g.exe.path, g.exe.name, g.candidates.map { c -> c.path to c.name }.distinctBy { it.first })
addedGames = com.droiddeck.launcher.frontend.AddedGames.scan(this).map { g ->
com.droiddeck.launcher.ui.AddedGameRow(g.folder.path, g.folderName(), g.exe.path, g.exe.name, g.candidates.map { c -> c.path to c.name }.distinctBy { it.first })
}
// Art the games do not have yet, from Steam's store, off the main thread; the rail
// redraws when something arrives.
@@ -628,8 +628,8 @@ class MainActivity : ComponentActivity() {
artFetchRunning = true
Thread({
try {
val games = com.steamdeck.launcher.frontend.AddedGames.scan(this)
if (com.steamdeck.launcher.frontend.AddedGameArt.fetchMissing(this, games)) ui.post { refresh() }
val games = com.droiddeck.launcher.frontend.AddedGames.scan(this)
if (com.droiddeck.launcher.frontend.AddedGameArt.fetchMissing(this, games)) ui.post { refresh() }
} finally {
artFetchRunning = false
}
@@ -649,7 +649,7 @@ class MainActivity : ComponentActivity() {
refreshAddedGames()
shapeMode = SessionPrefs.shapeMode(this)
hdrOn = SessionPrefs.hdr(this, mode)
hdrReason = com.steamdeck.launcher.wayland.HdrSupport.probe(this).reason
hdrReason = com.droiddeck.launcher.wayland.HdrSupport.probe(this).reason
touchMode = SessionPrefs.touchMode(this)
suspendPolicy = SessionPrefs.suspendPolicy(this, mode)
oscMode = SessionPrefs.oscMode(this)
@@ -766,7 +766,7 @@ class MainActivity : ComponentActivity() {
.filter { a -> TurnipReleases.installedId(this, a) { id -> if (linux) lm.isInstalled(id) else td.isInstalled(id) } == null }
.map { a ->
val mb = "%.1f MB".format(a.size / 1_048_576.0)
com.steamdeck.launcher.ui.DownloadRow(a.name, "${a.source} ${a.tag}", "${a.label} · $mb", releaseProgress[a.name])
com.droiddeck.launcher.ui.DownloadRow(a.name, "${a.source} ${a.tag}", "${a.label} · $mb", releaseProgress[a.name])
}
linuxDownloads = rows(linux = true)
androidDownloads = rows(linux = false)
@@ -828,7 +828,7 @@ class MainActivity : ComponentActivity() {
Log.w(TAG, "release driver download", e)
"Download failed: ${e.message}"
} finally {
file?.let { com.steamdeck.launcher.core.FileUtils.delete(it) }
file?.let { com.droiddeck.launcher.core.FileUtils.delete(it) }
}
ui.post {
releaseProgress.remove(assetName)
@@ -893,8 +893,8 @@ class MainActivity : ComponentActivity() {
} else null
// The libraries, off the main thread: manifests and a folder scan.
Thread({
val games = if (ready) Library.steamGames(this) + com.steamdeck.launcher.frontend.AddedGames.scan(this).map { g ->
com.steamdeck.launcher.frontend.AddedGameArt.resolve(this, g).let { art -> Library.SteamGame(g.appId.toInt(), g.name, art.portrait ?: art.header, "added", g.gameId) }
val games = if (ready) Library.steamGames(this) + com.droiddeck.launcher.frontend.AddedGames.scan(this).map { g ->
com.droiddeck.launcher.frontend.AddedGameArt.resolve(this, g).let { art -> Library.SteamGame(g.appId.toInt(), g.name, art.portrait ?: art.header, "added", g.gameId) }
} else emptyList()
val emus = Library.emulators(this) { id -> DesktopCatalog.installed(this, id) != null }
ui.post { steamGames = games; emulatorList = emus }
@@ -916,13 +916,13 @@ class MainActivity : ComponentActivity() {
// The runtime draws with Turnip, an Adreno driver: on Mali, Xclipse or PowerVR the
// compositor gets no usable Vulkan device and a session is sound over a black screen.
// Said before the download, not after it; the user may still go ahead.
if (installed == null && !com.steamdeck.launcher.core.DeviceSupport.adreno()) { showNonAdreno = release; return }
if (installed == null && !com.droiddeck.launcher.core.DeviceSupport.adreno()) { showNonAdreno = release; return }
install(release)
}
/** Starts a session; with no runtime on a non-Adreno, the same warning Setup gives comes first, before any download. */
private fun startSession(intent: Intent) {
val warn = installed == null && !com.steamdeck.launcher.core.DeviceSupport.adreno()
val warn = installed == null && !com.droiddeck.launcher.core.DeviceSupport.adreno()
if (warn && available != null) showNonAdreno = available
else startActivity(intent)
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher
package com.droiddeck.launcher
import android.hardware.input.InputManager
import android.hardware.display.DisplayManager
@@ -25,38 +25,38 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.gpu.LsfgNative
import com.steamdeck.launcher.gpu.TurnipDriver
import com.steamdeck.launcher.input.EvdevKeys
import com.steamdeck.launcher.input.KeyboardHost
import com.steamdeck.launcher.input.OnScreenControls
import com.steamdeck.launcher.input.PadBridge
import com.steamdeck.launcher.input.PointerGestures
import com.steamdeck.launcher.input.SecondScreenDisplay
import com.steamdeck.launcher.input.SecondScreenMode
import com.steamdeck.launcher.input.TouchpadGestures
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.session.LoadingState
import com.steamdeck.launcher.session.PerfHints
import com.steamdeck.launcher.session.PerfHud
import com.steamdeck.launcher.session.PerfMode
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.session.SessionPaths
import com.steamdeck.launcher.wayland.HdrSupport
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.session.SessionState
import com.steamdeck.launcher.ui.CursorOverlay
import com.steamdeck.launcher.ui.DrawerActions
import com.steamdeck.launcher.ui.HudText
import com.steamdeck.launcher.ui.LoadingOverlay
import com.steamdeck.launcher.ui.SessionDrawer
import com.steamdeck.launcher.ui.SessionPausedOverlay
import com.steamdeck.launcher.ui.SecondScreenPresentation
import com.steamdeck.launcher.ui.SteamDeckTheme
import com.steamdeck.launcher.wayland.CompositorHost
import com.steamdeck.launcher.wayland.WaylandCompositor
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.gpu.LsfgNative
import com.droiddeck.launcher.gpu.TurnipDriver
import com.droiddeck.launcher.input.EvdevKeys
import com.droiddeck.launcher.input.KeyboardHost
import com.droiddeck.launcher.input.OnScreenControls
import com.droiddeck.launcher.input.PadBridge
import com.droiddeck.launcher.input.PointerGestures
import com.droiddeck.launcher.input.SecondScreenDisplay
import com.droiddeck.launcher.input.SecondScreenMode
import com.droiddeck.launcher.input.TouchpadGestures
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.LoadingState
import com.droiddeck.launcher.session.PerfHints
import com.droiddeck.launcher.session.PerfHud
import com.droiddeck.launcher.session.PerfMode
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionPaths
import com.droiddeck.launcher.wayland.HdrSupport
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.ui.CursorOverlay
import com.droiddeck.launcher.ui.DrawerActions
import com.droiddeck.launcher.ui.HudText
import com.droiddeck.launcher.ui.LoadingOverlay
import com.droiddeck.launcher.ui.SessionDrawer
import com.droiddeck.launcher.ui.SessionPausedOverlay
import com.droiddeck.launcher.ui.SecondScreenPresentation
import com.droiddeck.launcher.ui.DroidDeckTheme
import com.droiddeck.launcher.wayland.CompositorHost
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.File
/**
@@ -157,9 +157,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
loading = LoadingState(this)
if (!SessionState.running) {
val needRuntime = com.steamdeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(this) == null
val needRuntime = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(this) == null
val needDesktop = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_DESKTOP &&
!com.steamdeck.launcher.runtime.DesktopCatalog.desktopInstalled(this)
!com.droiddeck.launcher.runtime.DesktopCatalog.desktopInstalled(this)
if (needRuntime || needDesktop) installThenStart(needRuntime, needDesktop)
}
hud = PerfHud(this)
@@ -177,10 +177,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// through to the pad and the game underneath.
root.addView(ComposeView(this).apply {
setContent {
SteamDeckTheme {
DroidDeckTheme {
CursorOverlay(cursorPos, cursorVisible, resources.displayMetrics.density)
if (hud.text.isNotEmpty()) HudText(hud.text)
if (loading.visible) LoadingOverlay(loading.step, loading.percent, loading.elapsed, loading.hint, loading.ended)
// Opening the drawer takes the controller away from the game: release its pad.
androidx.compose.runtime.LaunchedEffect(drawerOpen) { if (drawerOpen) padBridge?.releaseAll() }
SessionDrawer(drawerOpen, DrawerActions(
steam = SessionState.mode == SessionService.MODE_STEAM,
isHomeApp = isHomeApp,
@@ -261,9 +263,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private fun sendSteamGuide() {
drawerOpen = false
padBridge?.applyTouch { state -> state.press(com.steamdeck.launcher.input.PadState.GUIDE, true) }
padBridge?.applyTouch { state -> state.press(com.droiddeck.launcher.input.PadState.GUIDE, true) }
uiHandler.postDelayed({
padBridge?.applyTouch { state -> state.press(com.steamdeck.launcher.input.PadState.GUIDE, false) }
padBridge?.applyTouch { state -> state.press(com.droiddeck.launcher.input.PadState.GUIDE, false) }
}, 90)
}
@@ -340,7 +342,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
/** Reports one package's download on the loading screen: "<what> · 332 of 791 MB", checking, unpacking. */
private fun progressFor(what: String, mb: Long) = com.steamdeck.launcher.runtime.LinuxRuntimeInstaller.ProgressListener { stage, p ->
private fun progressFor(what: String, mb: Long) = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.ProgressListener { stage, p ->
uiHandler.post {
loading.percent = p
loading.step = when {
@@ -353,9 +355,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
/** Null when the runtime is in, else the loading screen's closing line. */
private fun installRuntime(): String? {
val release = com.steamdeck.launcher.runtime.LinuxRuntimeInstaller.fetchRelease()
val release = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.fetchRelease()
?: return "Could not reach the runtime catalog. Check the connection and press Play again."
val ok = com.steamdeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
val ok = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
progressFor("the Linux runtime", release.size / 1_000_000))
return if (ok) null else "The Linux runtime did not install. Check the connection and press Play again."
}
@@ -363,9 +365,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
/** Null when the desktop package is in, else the loading screen's closing line. */
private fun installDesktop(): String? {
uiHandler.post { loading.percent = -1; loading.step = "downloading the desktop" }
val entry = com.steamdeck.launcher.runtime.DesktopCatalog.fetch()?.firstOrNull { it.id == "desktop" }
val entry = com.droiddeck.launcher.runtime.DesktopCatalog.fetch()?.firstOrNull { it.id == "desktop" }
?: return "Could not reach the desktop catalog. Check the connection and press Desktop again."
val problem = com.steamdeck.launcher.runtime.DesktopCatalog.install(this, entry,
val problem = com.droiddeck.launcher.runtime.DesktopCatalog.install(this, entry,
progressFor("the desktop", entry.size / 1_000_000))
return problem?.let { "The desktop did not install ($it). Check the connection and press Desktop again." }
}
@@ -637,6 +639,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE ->
return super.dispatchKeyEvent(event)
}
// With the drawer open the controller drives the drawer, not the game: Android's own
// handling moves focus with the d-pad and stick, and its fallbacks make A select and B Back
// (which closes the drawer) - the same as on the app's main screen.
if (drawerOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchKeyEvent(event)
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
// A hardware keyboard, forwarded to the compositor's wl_keyboard. Back is left to the
// activity, which opens the drawer.
@@ -678,6 +684,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean {
if (drawerOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchGenericMotionEvent(event)
if (padBridge?.onMotionEvent(event) == true) return true
if (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) && !drawerOpen && onMouse(event)) return true
return super.dispatchGenericMotionEvent(event)
@@ -787,9 +794,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
sendWheel = { steps -> WaylandCompositor.nativeSendSceneInput(4, steps, 0) },
onSteamMenu = {
if (SessionState.mode == SessionService.MODE_STEAM) {
padBridge?.applyTouch { st -> st.press(com.steamdeck.launcher.input.PadState.GUIDE, true) }
padBridge?.applyTouch { st -> st.press(com.droiddeck.launcher.input.PadState.GUIDE, true) }
Handler(Looper.getMainLooper()).postDelayed({
padBridge?.applyTouch { st -> st.press(com.steamdeck.launcher.input.PadState.GUIDE, false) }
padBridge?.applyTouch { st -> st.press(com.droiddeck.launcher.input.PadState.GUIDE, false) }
}, 90)
}
},
@@ -884,9 +891,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
return true
}
/** The mode decides which controls appear; `steamdeck-osc` in Downloads still overrides. */
/** The mode decides which controls appear; `droiddeck-osc` in Downloads still overrides. */
private fun updateOnScreenControls() {
val forced = File(Environment.getExternalStorageDirectory(), "Download/steamdeck-osc")
val forced = File(Environment.getExternalStorageDirectory(), "Download/droiddeck-osc")
.takeIf { it.isFile }
?.let { FileUtils.readString(it)?.trim()?.lowercase() }
?: SessionPrefs.oscMode(this)
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.audio;
package com.droiddeck.launcher.audio;
import android.os.Process;
import android.util.Log;
import com.steamdeck.launcher.core.SessionPart;
import com.steamdeck.launcher.core.HostProcess;
import com.droiddeck.launcher.core.SessionPart;
import com.droiddeck.launcher.core.HostProcess;
import java.io.File;
import java.util.ArrayList;
@@ -1,13 +1,13 @@
package com.steamdeck.launcher.audio;
package com.droiddeck.launcher.audio;
import android.content.Context;
import android.os.Process;
import android.util.Log;
import com.steamdeck.launcher.core.FileUtils;
import com.steamdeck.launcher.core.SessionPart;
import com.steamdeck.launcher.core.HostProcess;
import com.steamdeck.launcher.core.TarZst;
import com.droiddeck.launcher.core.FileUtils;
import com.droiddeck.launcher.core.SessionPart;
import com.droiddeck.launcher.core.HostProcess;
import com.droiddeck.launcher.core.TarZst;
import java.io.File;
import java.io.InputStream;
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import android.app.ActivityManager
import android.content.Context
@@ -7,15 +7,15 @@ import android.os.Environment
import android.os.StatFs
import android.provider.Settings
import android.util.Log
import com.steamdeck.launcher.gpu.LinuxVulkanDriver
import com.steamdeck.launcher.gpu.LinuxVulkanDriverManager
import com.steamdeck.launcher.gpu.TurnipDriver
import com.steamdeck.launcher.runtime.DesktopCatalog
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.runtime.LinuxRuntimeInstaller
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.session.SessionState
import com.droiddeck.launcher.gpu.LinuxVulkanDriver
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
import com.droiddeck.launcher.gpu.TurnipDriver
import com.droiddeck.launcher.runtime.DesktopCatalog
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.LinuxRuntimeInstaller
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
@@ -50,7 +50,7 @@ object DeviceReport {
b.append(key.padEnd(24)).append(value ?: "unknown").append('\n')
}
b.append("SteamDeck session report\n")
b.append("DroidDeck session report\n")
b.append("========================\n")
k("Written", SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz", Locale.US).format(Date()))
k("Session mode", when (mode) { SessionService.MODE_DESKTOP -> "desktop (labwc/LXQt)"; SessionService.MODE_RUN -> "a program under gamescope"; else -> "Steam client (gamescope)" })
@@ -155,7 +155,7 @@ object DeviceReport {
k("Touch mode", SessionPrefs.touchMode(context))
k("Performance HUD", SessionPrefs.hudEnabled(context))
k("Game storage", when (val g = SessionPrefs.gameStorage(context)) {
"" -> "automatic (" + (com.steamdeck.launcher.session.GameStorage.effective(context)?.path ?: "no card present") + ")"
"" -> "automatic (" + (com.droiddeck.launcher.session.GameStorage.effective(context)?.path ?: "no card present") + ")"
SessionPrefs.GAME_STORAGE_OFF -> "internal only"
else -> g
})
@@ -178,9 +178,9 @@ object DeviceReport {
})
h("Device switch files in Download")
for (name in listOf("steamdeck-env", "steamdeck-tu-debug", "steamdeck-driver",
"steamdeck-osc", "steamdeck-no-pad", "steamdeck-pad-log",
"steamdeck-no-hud", "steamdeck-wlr-renderer")) {
for (name in listOf("droiddeck-env", "droiddeck-tu-debug", "droiddeck-driver",
"droiddeck-osc", "droiddeck-no-pad", "droiddeck-pad-log",
"droiddeck-no-hud", "droiddeck-wlr-renderer")) {
val f = File(Environment.getExternalStorageDirectory(), "Download/$name")
if (f.isFile) k(name, FileUtils.readString(f)?.trim()?.replace('\n', ' ')?.ifEmpty { "(present, empty)" } ?: "(present)")
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import android.os.Build
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core;
package com.droiddeck.launcher.core;
import android.util.Log;
@@ -106,7 +106,7 @@ public final class Downloader {
connection.setConnectTimeout(TIMEOUT_MS);
connection.setReadTimeout(TIMEOUT_MS);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("User-Agent", "SteamDeck-Android");
connection.setRequestProperty("User-Agent", "DroidDeck-Android");
return connection;
}
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
/**
* FEXCore presets for the x86 games the Steam client launches, Bannerlator's table carried over
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core;
package com.droiddeck.launcher.core;
import android.content.Context;
import android.system.ErrnoException;
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
/** The variables a host process is started with, in the order they were set. */
class HostEnvironment {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import android.util.Log
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
/**
* Scrubs credentials out of a log line before it is written somewhere a user will share.
@@ -1,11 +1,11 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
import android.util.Log
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.net.Inet4Address
import java.net.Inet6Address
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core
package com.droiddeck.launcher.core
import android.os.Process
import android.util.Log
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core;
package com.droiddeck.launcher.core;
import android.content.Context;
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.core;
package com.droiddeck.launcher.core;
import android.content.Context;
import android.util.Log;
@@ -16,7 +16,7 @@ import java.io.OutputStream;
/**
* The small zstd tarballs that ship inside the apk (the Turnip driver, the PulseAudio modules).
* The runtime rootfs is not one of these - it needs hard links and symlinks preserved, which
* {@link com.steamdeck.launcher.runtime.LinuxRuntimeInstaller} handles itself.
* {@link com.droiddeck.launcher.runtime.LinuxRuntimeInstaller} handles itself.
*/
public final class TarZst {
private static final String TAG = "TarZst";
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.content.res.Configuration
import androidx.compose.animation.core.animateDpAsState
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.content.Context
import org.json.JSONArray
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.Manifest
import android.content.pm.PackageManager
@@ -10,7 +10,7 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.steamdeck.launcher.ui.SteamDeckTheme
import com.droiddeck.launcher.ui.DroidDeckTheme
/** The File Manager as a screen of its own, from the Files tile on the main screen. */
class FileManagerActivity : ComponentActivity() {
@@ -20,7 +20,7 @@ class FileManagerActivity : ComponentActivity() {
requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1)
}
setContent {
SteamDeckTheme {
DroidDeckTheme {
Surface(modifier = Modifier.fillMaxSize().systemBarsPadding(), color = MaterialTheme.colorScheme.background) {
FileManagerScreen()
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.widget.Toast
import androidx.activity.compose.BackHandler
@@ -114,8 +114,8 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.steamdeck.launcher.R
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.SessionPrefs
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -1217,7 +1217,7 @@ fun FileManagerScreen(
// The ROMs folder chosen on the main screen: what the session shows as /root/ROMs.
SessionPrefs.romsDir(context).takeIf { it.isNotEmpty() }?.let(::File)?.takeIf { it.isDirectory }
?.let { add(locItem("ROMs", Icons.Filled.SportsEsports, it)) }
File("/storage/emulated/0/Download/SteamDeck").takeIf { it.isDirectory }?.let { add(locItem("Session logs", Icons.Filled.Description, it)) }
File("/storage/emulated/0/Download/DroidDeck").takeIf { it.isDirectory }?.let { add(locItem("Session logs", Icons.Filled.Description, it)) }
File("/storage/emulated/0/Pictures").takeIf { it.isDirectory }?.let { add(locItem("Pictures", Icons.Filled.Image, it)) }
}
val favItems = remember(favTick) { FavoritesStore.list(context).map(::File).filter { it.exists() } }
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.util.Log
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.Manifest
import android.app.Activity
@@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.steamdeck.launcher.ui.SteamDeckTheme
import com.droiddeck.launcher.ui.DroidDeckTheme
import java.io.File
/**
@@ -43,7 +43,7 @@ class FilePickerActivity : ComponentActivity() {
?.let { File(it) }?.takeIf { it.isDirectory }
setContent {
SteamDeckTheme {
DroidDeckTheme {
Surface(modifier = Modifier.fillMaxSize().systemBarsPadding(), color = MaterialTheme.colorScheme.background) {
FileManagerScreen(
pickMode = true,
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.content.Context
import android.content.Intent
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import androidx.compose.foundation.background
import androidx.compose.foundation.border
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import androidx.compose.foundation.border
import androidx.compose.material3.AlertDialog
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.graphics.Bitmap
import android.graphics.BitmapFactory
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.files
package com.droiddeck.launcher.files
import android.content.Context
import android.os.Build
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.frontend
package com.droiddeck.launcher.frontend
import android.content.Context
import android.graphics.Bitmap
import android.util.Log
import com.steamdeck.launcher.files.PeIconExtractor
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.files.PeIconExtractor
import com.droiddeck.launcher.session.SessionPrefs
import org.json.JSONObject
import java.io.File
import java.net.HttpURLConnection
@@ -161,7 +161,7 @@ object AddedGameArt {
val c = URL(url).openConnection() as HttpURLConnection
c.connectTimeout = 10_000
c.readTimeout = 15_000
c.setRequestProperty("User-Agent", "SteamDeck-launcher")
c.setRequestProperty("User-Agent", "DroidDeck-launcher")
return try {
if (c.responseCode != 200) null else c.inputStream.use { it.readBytes() }
} catch (e: Exception) {
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.frontend
package com.droiddeck.launcher.frontend
import android.content.Context
import android.os.Environment
import android.util.Log
import com.steamdeck.launcher.session.GameStorage
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import java.util.zip.CRC32
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.frontend
package com.droiddeck.launcher.frontend
import android.content.Context
import com.steamdeck.launcher.R
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.session.GameStorage
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.R
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
/**
@@ -1,8 +1,8 @@
package com.steamdeck.launcher.gpu
package com.droiddeck.launcher.gpu
import android.content.Context
import android.util.Log
import com.steamdeck.launcher.wayland.WaylandCompositor
import com.droiddeck.launcher.wayland.WaylandCompositor
/**
* The frame-generation setting and how it reaches the compositor.
@@ -110,7 +110,7 @@ object FrameGen {
}
}
android.app.AlertDialog.Builder(activity)
.setTitle(com.steamdeck.launcher.R.string.frame_gen_title)
.setTitle(com.droiddeck.launcher.R.string.frame_gen_title)
.setSingleChoiceItems(adapter, current) { dialog, which ->
when (which) {
0 -> set(activity, ENGINE_OFF, 2)
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.gpu;
package com.droiddeck.launcher.gpu;
import android.content.Context;
import android.util.Log;
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.gpu;
package com.droiddeck.launcher.gpu;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.steamdeck.launcher.core.FileUtils;
import com.droiddeck.launcher.core.FileUtils;
import org.json.JSONObject;
@@ -1,9 +1,9 @@
package com.steamdeck.launcher.gpu;
package com.droiddeck.launcher.gpu;
import android.content.Context;
import android.util.Log;
import com.steamdeck.launcher.runtime.LinuxRuntime;
import com.droiddeck.launcher.runtime.LinuxRuntime;
import java.io.File;
@@ -1,13 +1,13 @@
package com.steamdeck.launcher.gpu;
package com.droiddeck.launcher.gpu;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import com.steamdeck.launcher.core.FileUtils;
import com.steamdeck.launcher.core.TarZst;
import com.steamdeck.launcher.session.SessionPrefs;
import com.droiddeck.launcher.core.FileUtils;
import com.droiddeck.launcher.core.TarZst;
import com.droiddeck.launcher.session.SessionPrefs;
import org.json.JSONObject;
@@ -51,7 +51,7 @@ public final class TurnipDriver {
/** The two the apk carries; never removable, unpacked on demand. */
public static final List<String> BUNDLED = Collections.unmodifiableList(Arrays.asList(DRIVER_A7XX, DRIVER_A8XX));
/** Overrides the pick, for a device we cannot reach: a7xx, a8xx or system. */
private static final String OVERRIDE_FILE = "Download/steamdeck-driver";
private static final String OVERRIDE_FILE = "Download/droiddeck-driver";
/** Bundled drivers the user deleted: hidden from the list, their unpacked copy removed. */
private static final String PREFS = "graphics_driver";
private static final String KEY_HIDDEN = "hiddenBundled";
@@ -1,7 +1,7 @@
package com.steamdeck.launcher.gpu
package com.droiddeck.launcher.gpu
import android.content.Context
import com.steamdeck.launcher.core.FileUtils
import com.droiddeck.launcher.core.FileUtils
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
@@ -114,7 +114,7 @@ object TurnipReleases {
c.connectTimeout = 15_000
c.readTimeout = 20_000
c.setRequestProperty("Accept", "application/vnd.github+json")
c.setRequestProperty("User-Agent", "SteamDeck-app")
c.setRequestProperty("User-Agent", "DroidDeck-app")
try {
val code = c.responseCode
if (code == 403 || code == 429) throw IOException("GitHub's rate limit was hit - try again later")
@@ -171,7 +171,7 @@ object TurnipReleases {
val c = URL(asset.url).openConnection() as HttpURLConnection
c.connectTimeout = 15_000
c.readTimeout = 60_000
c.setRequestProperty("User-Agent", "SteamDeck-app")
c.setRequestProperty("User-Agent", "DroidDeck-app")
c.instanceFollowRedirects = true
try {
if (c.responseCode != 200) throw IOException("download answered HTTP ${c.responseCode}")
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input;
package com.droiddeck.launcher.input;
import android.view.KeyEvent;
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input;
package com.droiddeck.launcher.input;
import android.util.Log;
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
import android.app.Activity
import android.content.Context
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
import android.annotation.SuppressLint
import android.content.Context
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input;
package com.droiddeck.launcher.input;
import android.os.Handler;
import android.os.Looper;
@@ -166,6 +166,15 @@ public final class PadBridge {
else publish();
}
/**
* Everything released and centred - for when the controller stops feeding the game (the
* session drawer opened), so a button or stick held at that moment is not left down in it.
*/
public synchronized void releaseAll() {
state.clear();
publish();
}
/** Starts the same Guide-then-A sequence used by the touch QAM button. */
public synchronized void triggerQam() {
startQamChord();
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
/**
* What one Xbox-shaped pad is doing right now: two sticks and two triggers as -1..1 / 0..1, the
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
import android.os.Handler
import android.os.Looper
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
/** The control surface shown on a secondary Android display during a Linux session. */
enum class SecondScreenMode(val id: String, val label: String) {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.input
package com.droiddeck.launcher.input
import android.os.Handler
import android.os.Looper
@@ -1,9 +1,9 @@
package com.steamdeck.launcher.runtime
package com.droiddeck.launcher.runtime
import android.content.Context
import android.util.Log
import com.steamdeck.launcher.core.Downloader
import com.steamdeck.launcher.core.FileUtils
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.FileUtils
import org.json.JSONObject
import java.io.File
@@ -45,14 +45,16 @@ object DesktopCatalog {
}
}
private fun marker(context: Context, id: String) = File(LinuxRuntime.rootDir(context), ".steamdeck-pkg-$id")
private fun marker(context: Context, id: String) = File(LinuxRuntime.rootDir(context), ".droiddeck-pkg-$id")
/** The installed version of a package, or null. */
fun installed(context: Context, id: String): String? =
FileUtils.readString(marker(context, id))?.trim()?.takeIf { it.isNotEmpty() }
// labwc comes with the hosted desktop package itself (its launcher is staged by the app at
// every session, so it cannot tell whether the package is there); SessionFiles uses the same test.
fun desktopInstalled(context: Context): Boolean =
File(LinuxRuntime.rootDir(context), "usr/local/bin/steamdeck-desktop").isFile
File(LinuxRuntime.rootDir(context), "usr/bin/labwc").isFile
/** Downloads, verifies and installs one package. Returns null on success, else a message. */
fun install(context: Context, entry: Entry, listener: LinuxRuntimeInstaller.ProgressListener?): String? {
@@ -80,7 +82,7 @@ object DesktopCatalog {
else download.renameTo(target)
if (!placed) return "Could not place the AppImage"
target.setExecutable(true, false)
FileUtils.writeString(File(root, "usr/share/applications/steamdeck-${entry.id}.desktop"),
FileUtils.writeString(File(root, "usr/share/applications/droiddeck-${entry.id}.desktop"),
"[Desktop Entry]\nType=Application\nName=${entry.name}\n" +
"Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/${entry.id}.AppImage\n" +
"Icon=${entry.icon}\nTerminal=false\nCategories=${entry.category};\n")
@@ -123,7 +125,7 @@ object DesktopCatalog {
val root = LinuxRuntime.rootDir(context)
if (entry.kind == "appimage") {
File(root, "opt/appimages/${entry.id}.AppImage").delete()
File(root, "usr/share/applications/steamdeck-${entry.id}.desktop").delete()
File(root, "usr/share/applications/droiddeck-${entry.id}.desktop").delete()
}
marker(context, entry.id).delete()
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.runtime
package com.droiddeck.launcher.runtime
import android.content.Context
import android.net.ConnectivityManager
@@ -7,7 +7,7 @@ import android.net.Network
import android.os.Build
import android.provider.Settings
import android.util.Log
import com.steamdeck.launcher.core.SessionPart
import com.droiddeck.launcher.core.SessionPart
import java.io.File
import java.io.IOException
import java.net.Inet4Address
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.runtime;
package com.droiddeck.launcher.runtime;
import android.content.Context;
import android.os.Process;
@@ -33,7 +33,7 @@ public final class LinuxRuntime {
public static final String EXTRA_LINUX_MODE = "linux_mode";
private static final String KGSL_DEVICE = "/dev/kgsl-3d0";
/** Where every Linux session's debug log lands: public, so a user can just hand the folder over. */
public static final String DEBUG_LOG_DIR = "SteamDeck";
public static final String DEBUG_LOG_DIR = "DroidDeck";
public static File debugLogDir() {
return new File(android.os.Environment.getExternalStoragePublicDirectory(
@@ -1,11 +1,11 @@
package com.steamdeck.launcher.runtime;
package com.droiddeck.launcher.runtime;
import android.content.Context;
import android.util.Log;
import com.steamdeck.launcher.core.Downloader;
import com.steamdeck.launcher.core.FileUtils;
import com.droiddeck.launcher.core.Downloader;
import com.droiddeck.launcher.core.FileUtils;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import android.util.Log
import com.steamdeck.launcher.core.SessionPart
import com.droiddeck.launcher.core.SessionPart
import java.io.File
import kotlin.math.abs
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Environment
import android.os.StatFs
import android.os.storage.StorageManager
import com.steamdeck.launcher.core.FileUtils
import com.droiddeck.launcher.core.FileUtils
import java.io.File
/**
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.SystemClock
@@ -25,7 +25,7 @@ class LoadingState(context: Context) {
var hint by mutableStateOf("")
var ended by mutableStateOf(false)
private val hints = context.resources.getStringArray(com.steamdeck.launcher.R.array.loading_hints)
private val hints = context.resources.getStringArray(com.droiddeck.launcher.R.array.loading_hints)
private val startedAt = SystemClock.elapsedRealtime()
/** Once a second: the clock and the hint. */
@@ -1,8 +1,8 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
/**
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.util.Log
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Build
@@ -7,7 +7,7 @@ import android.os.Looper
import android.os.PerformanceHintManager
import android.util.Log
import androidx.annotation.RequiresApi
import com.steamdeck.launcher.wayland.WaylandCompositor
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.util.concurrent.Executors
/**
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Environment
@@ -8,8 +8,8 @@ import android.os.SystemClock
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.wayland.WaylandCompositor
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.File
import java.util.Locale
import java.util.concurrent.atomic.AtomicInteger
@@ -36,7 +36,7 @@ class PerfHud(context: Context) {
/** The session's own switch (drawer), with the Downloads file as a device-side override. */
private val enabled: Boolean
get() = SessionPrefs.hudEnabled(context)
&& !File(Environment.getExternalStorageDirectory(), "Download/steamdeck-no-hud").exists()
&& !File(Environment.getExternalStorageDirectory(), "Download/droiddeck-no-hud").exists()
/** Told, on the main thread, when the window presenting frames changes. */
var onPresentingWindowChanged: (() -> Unit)? = null
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.app.Activity
import android.app.GameManager
@@ -1,11 +1,11 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.StatFs
import android.util.Log
import com.steamdeck.launcher.core.Downloader
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.security.MessageDigest
import org.json.JSONArray
@@ -114,7 +114,7 @@ object ProtonExtras {
return try {
val root = LinuxRuntime.rootDir(context)
LinuxRuntime.writeAccounts(context)
com.steamdeck.launcher.session.SessionFiles.stage(context, root)
com.droiddeck.launcher.session.SessionFiles.stage(context, root)
val runtimeDir = File(context.filesDir, ".proton-install-rt").apply { mkdirs() }
val guest = listOf(
"/usr/bin/env", "-i", "HOME=/root", "USER=root", "PATH=/usr/local/bin:/usr/bin:/bin",
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.app.ActivityManager
import android.content.Context
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.net.LocalServerSocket
import android.os.Build
@@ -6,7 +6,7 @@ import android.os.VibrationEffect
import android.os.Vibrator
import android.os.VibratorManager
import android.util.Log
import com.steamdeck.launcher.core.SessionPart
import com.droiddeck.launcher.core.SessionPart
import java.io.DataInputStream
import kotlin.math.max
@@ -70,6 +70,6 @@ class RumbleComponent : SessionPart() {
companion object {
private const val TAG = "SessionService"
/** Must match the fake evdev layer (fakeinput_steam.cpp). */
const val NAME = "steamdeck-rumble"
const val NAME = "droiddeck-rumble"
}
}
@@ -1,11 +1,11 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
import com.steamdeck.launcher.core.LogRedactor
import com.steamdeck.launcher.core.SessionLogCapture
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.wayland.WaylandCompositor
import com.droiddeck.launcher.core.LogRedactor
import com.droiddeck.launcher.core.SessionLogCapture
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.wayland.WaylandCompositor
import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
@@ -1,16 +1,16 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Environment
import android.util.Log
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
/** Everything the session needs written into the runtime before it starts. */
object SessionFiles {
private const val TAG = "SessionFiles"
private const val NO_PAD_SWITCH = "Download/steamdeck-no-pad"
private const val NO_PAD_SWITCH = "Download/droiddeck-no-pad"
/** Where the DirectAudio driver lives inside the runtime; the wrappers get it as BL_DIRECTAUDIO. */
const val DIRECTAUDIO_DIR = "usr/local/lib/directaudio"
@@ -55,11 +55,11 @@ object SessionFiles {
// The desktop's launcher and labwc defaults, only where the desktop package is installed:
// staging them into a runtime without it would make the desktop look present when it is not.
val desktop = arrayOf(
"usr/local/bin/steamdeck-desktop" to "usr/local/bin/steamdeck-desktop",
"usr/local/bin/droiddeck-desktop" to "usr/local/bin/droiddeck-desktop",
"etc/xdg/labwc/autostart" to "etc/xdg/labwc/autostart",
"etc/xdg/labwc/rc.xml" to "etc/xdg/labwc/rc.xml",
"etc/xdg/lxqt/panel.conf" to "etc/xdg/lxqt/panel.conf",
"usr/lib/firefox/defaults/pref/steamdeck.js" to "usr/lib/firefox/defaults/pref/steamdeck.js",
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
)
// The patched gamescope (tools/gamescope): the runtime's own version rebuilt with the ARM64
// client fixes, over /usr/local/bin so it comes first in the session's PATH. Only when the
@@ -1,10 +1,10 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.ClipData
import android.content.Context
import android.content.Intent
import androidx.core.content.FileProvider
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
@@ -25,7 +25,7 @@ object SessionLogShare {
fun zipLatest(context: Context): File? {
val folder = latest(context) ?: return null
val out = File(context.cacheDir, "shared-logs").apply { deleteRecursively(); mkdirs() }
val zip = File(out, "SteamDeck-${folder.name}.zip")
val zip = File(out, "DroidDeck-${folder.name}.zip")
ZipOutputStream(zip.outputStream().buffered()).use { z ->
folder.walkTopDown().filter { it.isFile }.forEach { f ->
z.putNextEntry(ZipEntry(folder.name + "/" + f.relativeTo(folder).path))
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
@@ -8,10 +8,10 @@ import java.util.Date
import java.util.Locale
/**
* One folder per session under `Download/SteamDeck/`, holding everything that session recorded:
* One folder per session under `Download/DroidDeck/`, holding everything that session recorded:
*
* ```
* Download/SteamDeck/session-20260921-161256/
* Download/DroidDeck/session-20260921-161256/
* device.txt what this device is, and every setting the session ran with
* session.log the guest session: proot, gamescope, the client's stdout
* wayland.log the app's compositor
@@ -74,7 +74,7 @@ object SessionPaths {
if (dir == ended) dir = null
// A folder kept in the cache was never meant to outlive its session.
if (ended != null && ended.path.startsWith(context.cacheDir.path)) {
com.steamdeck.launcher.core.FileUtils.delete(ended)
com.droiddeck.launcher.core.FileUtils.delete(ended)
}
}
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.content.Context
@@ -233,7 +233,7 @@ object SessionPrefs {
}
/**
* Whether a session writes its folder under Download/SteamDeck. Off, the same logs are kept in
* Whether a session writes its folder under Download/DroidDeck. Off, the same logs are kept in
* the app's cache for the session's lifetime (the scripts need somewhere to write) and thrown
* away at the end, so nothing accumulates in Downloads.
*/
@@ -345,7 +345,7 @@ object SessionPrefs {
/**
* What the desktop shell composites with: pixman (software, the default - the Adreno stand-in
* is not a DRM render node, so labwc's gbm allocator cannot use it), or gles2 / vulkan for a
* device that has a real node. `Download/steamdeck-wlr-renderer` still overrides it.
* device that has a real node. `Download/droiddeck-wlr-renderer` still overrides it.
*/
fun desktopRenderer(context: Context): String = prefs(context).getString("desktopRenderer", "pixman") ?: "pixman"
@@ -1,7 +1,7 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import com.steamdeck.launcher.gpu.LinuxVulkanDriver
import com.steamdeck.launcher.gpu.LinuxVulkanDriverManager
import com.droiddeck.launcher.gpu.LinuxVulkanDriver
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
import android.app.Notification
import android.app.NotificationChannel
@@ -21,21 +21,21 @@ import android.os.Handler
import android.os.Looper
import android.os.PowerManager
import android.util.Log
import com.steamdeck.launcher.R
import com.steamdeck.launcher.SessionActivity
import com.steamdeck.launcher.audio.DirectAudioRelayComponent
import com.steamdeck.launcher.audio.PulseAudioComponent
import com.steamdeck.launcher.core.CpuCores
import com.steamdeck.launcher.core.DeviceReport
import com.steamdeck.launcher.core.HostEnvironment
import com.steamdeck.launcher.core.SessionLogCapture
import com.steamdeck.launcher.core.NetworkReport
import com.steamdeck.launcher.core.SessionPart
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.core.HostProcess
import com.steamdeck.launcher.input.FakeInputWriter
import com.steamdeck.launcher.runtime.LinuxNetworkLinkComponent
import com.steamdeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.R
import com.droiddeck.launcher.SessionActivity
import com.droiddeck.launcher.audio.DirectAudioRelayComponent
import com.droiddeck.launcher.audio.PulseAudioComponent
import com.droiddeck.launcher.core.CpuCores
import com.droiddeck.launcher.core.DeviceReport
import com.droiddeck.launcher.core.HostEnvironment
import com.droiddeck.launcher.core.SessionLogCapture
import com.droiddeck.launcher.core.NetworkReport
import com.droiddeck.launcher.core.SessionPart
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.core.HostProcess
import com.droiddeck.launcher.input.FakeInputWriter
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
@@ -53,7 +53,7 @@ import java.util.Locale
* backgrounded download does not throttle to nothing. All three are Bannerlator's recipe, where
* each was added to fix a failure seen on a device.
*
* The activity comes and goes on top of this; see [com.steamdeck.launcher.wayland.CompositorHost].
* The activity comes and goes on top of this; see [com.droiddeck.launcher.wayland.CompositorHost].
*/
class SessionService : Service() {
private val components = java.util.concurrent.CopyOnWriteArrayList<SessionPart>()
@@ -308,11 +308,11 @@ class SessionService : Service() {
// default preset sets nothing, which is what every session ran on before.
if (SessionState.mode == MODE_STEAM) {
val preset = SessionPrefs.fexPreset(this)
val vars = com.steamdeck.launcher.core.FexPreset.env(preset)
val vars = com.droiddeck.launcher.core.FexPreset.env(preset)
vars.forEach { guest.add(it) }
if (vars.isNotEmpty()) Log.i(TAG, "fex preset $preset: ${vars.joinToString(" ")}")
}
// Anything else, for a device that cannot be reached with a debugger: Downloads/steamdeck-env
// Anything else, for a device that cannot be reached with a debugger: Downloads/droiddeck-env
// holds KEY=VALUE lines that go into the session's environment as written, after ours, so a
// line here wins. Zink and Turnip tunables (ZINK_DESCRIPTORS=lazy, MESA_*), gamescope's,
// the client's - whatever the experiment needs, without a build per attempt.
@@ -411,18 +411,18 @@ class SessionService : Service() {
// DRM render node. Ours is a KGSL stand-in that gbm cannot use - labwc dies at "unable to
// create allocator" - so the desktop shell is composited by pixman (software, a shm
// allocator, no DRM). Accelerated clients on it pay a CPU copy; a 2D emulator does not
// notice, a demanding one does. steamdeck-wlr-renderer in Downloads (pixman/vulkan/gles2)
// notice, a demanding one does. droiddeck-wlr-renderer in Downloads (pixman/vulkan/gles2)
// overrides it, for trying acceleration on a device that has a real node.
if (SessionState.mode == MODE_DESKTOP) {
val override = File(Environment.getExternalStorageDirectory(), "Download/steamdeck-wlr-renderer")
val override = File(Environment.getExternalStorageDirectory(), "Download/droiddeck-wlr-renderer")
.takeIf { it.isFile }?.let { FileUtils.readString(it)?.trim() }
guest.add("BL_WLR_RENDERER=" + (override?.takeIf { it.isNotEmpty() } ?: SessionPrefs.desktopRenderer(this)))
}
// The user's own games, for the runtime's shortcuts writer to put in the client's library
// before the client starts (see frontend/AddedGames and bannerlator-steam-shortcuts).
if (SessionState.mode == MODE_STEAM) {
val added = com.steamdeck.launcher.frontend.AddedGames.scan(this)
val listing = com.steamdeck.launcher.frontend.AddedGames.writeListing(this, added)
val added = com.droiddeck.launcher.frontend.AddedGames.scan(this)
val listing = com.droiddeck.launcher.frontend.AddedGames.writeListing(this, added)
guest.add("BL_ADDED_GAMES=" + listing.path)
if (added.isNotEmpty()) Log.i(TAG, "added games: " + added.joinToString { "${it.name} (${it.exe.name})" })
}
@@ -505,7 +505,7 @@ class SessionService : Service() {
}
// The user's own games folder (the Steam cog's "Added games"), bound at a fixed place so
// the shortcuts the app writes point somewhere whatever storage the folder is on.
for (root in com.steamdeck.launcher.frontend.AddedGames.roots(this)) {
for (root in com.droiddeck.launcher.frontend.AddedGames.roots(this)) {
if (root.host.isDirectory && root.host.canRead()) {
File(LinuxRuntime.rootDir(this), root.guest.removePrefix("/")).mkdirs()
binds.add(root.host.path + ":" + root.guest)
@@ -707,7 +707,7 @@ class SessionService : Service() {
}
}
Log.i(TAG, "launch request from the session: Steam $ui" + (if (url.isNotEmpty()) " $url" else ""))
val next = Intent(this@SessionService, com.steamdeck.launcher.SessionActivity::class.java)
val next = Intent(this@SessionService, com.droiddeck.launcher.SessionActivity::class.java)
.putExtra(EXTRA_MODE, MODE_STEAM)
.putExtra(EXTRA_STEAM_UI, ui)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -857,7 +857,7 @@ class SessionService : Service() {
try {
if (wakeLock?.isHeld != true) {
val power = getSystemService(Context.POWER_SERVICE) as? PowerManager
wakeLock = power?.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SteamDeck:session")?.apply {
wakeLock = power?.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "DroidDeck:session")?.apply {
setReferenceCounted(false)
acquire(12L * 60L * 60L * 1000L)
}
@@ -870,7 +870,7 @@ class SessionService : Service() {
val wifi = applicationContext.getSystemService(Context.WIFI_SERVICE) as? WifiManager
@Suppress("DEPRECATION") // deprecated from API 29, still honoured; targetSdk is 28
if (wifiLock?.isHeld != true) {
wifiLock = wifi?.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "SteamDeck:session-wifi")
wifiLock = wifi?.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "DroidDeck:session-wifi")
?.apply {
setReferenceCounted(false)
acquire()
@@ -954,27 +954,27 @@ class SessionService : Service() {
companion object {
private const val TAG = "SessionService"
/** Downloads file whose contents become TU_DEBUG inside the session, e.g. "sysmem". */
private const val TU_DEBUG_SWITCH = "Download/steamdeck-tu-debug"
private const val TU_DEBUG_SWITCH = "Download/droiddeck-tu-debug"
/** Downloads file of KEY=VALUE lines added to the session environment verbatim. */
private const val ENV_SWITCH = "Download/steamdeck-env"
private const val ENV_SWITCH = "Download/droiddeck-env"
private const val CHANNEL_ID = "session"
private const val NOTIFICATION_ID = 1001
const val ACTION_STOP = "com.steamdeck.launcher.STOP_SESSION"
const val ACTION_RESUME = "com.steamdeck.launcher.RESUME_SESSION"
const val ACTION_HOME_GUIDE = "com.steamdeck.launcher.HOME_GUIDE"
private const val ACTION_ACTIVITY_VISIBLE = "com.steamdeck.launcher.ACTIVITY_VISIBLE"
private const val ACTION_ACTIVITY_HIDDEN = "com.steamdeck.launcher.ACTIVITY_HIDDEN"
private const val ACTION_TRACK_AUXILIARY = "com.steamdeck.launcher.TRACK_AUXILIARY"
private const val ACTION_STOP_AUXILIARY = "com.steamdeck.launcher.STOP_AUXILIARY"
private const val ACTION_AUXILIARY_EXITED = "com.steamdeck.launcher.AUXILIARY_EXITED"
const val ACTION_STOP = "com.droiddeck.launcher.STOP_SESSION"
const val ACTION_RESUME = "com.droiddeck.launcher.RESUME_SESSION"
const val ACTION_HOME_GUIDE = "com.droiddeck.launcher.HOME_GUIDE"
private const val ACTION_ACTIVITY_VISIBLE = "com.droiddeck.launcher.ACTIVITY_VISIBLE"
private const val ACTION_ACTIVITY_HIDDEN = "com.droiddeck.launcher.ACTIVITY_HIDDEN"
private const val ACTION_TRACK_AUXILIARY = "com.droiddeck.launcher.TRACK_AUXILIARY"
private const val ACTION_STOP_AUXILIARY = "com.droiddeck.launcher.STOP_AUXILIARY"
private const val ACTION_AUXILIARY_EXITED = "com.droiddeck.launcher.AUXILIARY_EXITED"
private const val EXTRA_AUXILIARY_PID = "auxiliaryPid"
/** Command lines that can only belong to a session of ours. */
private val STRAGGLERS = listOf("bannerlator-session", "gamescope", "Xwayland", "steamrtarm64",
"steamwebhelper", "linuxfs/opt/android-host/proot", "pulseaudio/libpulseaudio.so")
/** How long proot gets to run its own cleanup before it is killed outright. */
private const val GRACE_MS = 1200L
private const val NO_PAD_SWITCH = "Download/steamdeck-no-pad"
private const val PAD_LOG_SWITCH = "Download/steamdeck-pad-log"
private const val NO_PAD_SWITCH = "Download/droiddeck-no-pad"
private const val PAD_LOG_SWITCH = "Download/droiddeck-pad-log"
const val EXTRA_MODE = "mode"
const val MODE_STEAM = "steam"
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import java.io.File
import androidx.compose.runtime.getValue
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import android.os.Process
import java.io.File
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.session
package com.droiddeck.launcher.session
import com.termux.terminal.TerminalSession
import com.termux.terminal.TerminalSessionClient
@@ -30,7 +30,7 @@ object SessionTerminal {
return TerminalSession(
current.command.first(), current.workingDirectory, current.command,
current.hostEnvironment, 3000, client,
).also { it.mSessionName = "SteamDeck Linux shell" }
).also { it.mSessionName = "DroidDeck Linux shell" }
}
fun clear(generation: Int? = null) {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import android.graphics.Bitmap
import android.os.Build
@@ -105,10 +105,10 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import coil.compose.AsyncImage
import com.steamdeck.launcher.R
import com.steamdeck.launcher.frontend.Library
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import kotlin.math.roundToInt
@@ -135,7 +135,7 @@ class FrontEndState(
val theme: String = Themes.PAPER,
val isHomeApp: Boolean = false,
val defaultHomeLabel: String? = null,
val androidApps: List<com.steamdeck.launcher.HomeApp.LaunchableApp> = emptyList(),
val androidApps: List<com.droiddeck.launcher.HomeApp.LaunchableApp> = emptyList(),
val packages: List<PackageRow>? = null,
val packageCatalogLoading: Boolean = false,
val packageBusyId: String? = null,
@@ -170,7 +170,7 @@ class FrontEndActions(
val onPageBack: () -> Unit = {},
val onTheme: (String) -> Unit = {},
val onHomeApp: () -> Unit = {},
val onAndroidApp: (com.steamdeck.launcher.HomeApp.LaunchableApp) -> Unit = {},
val onAndroidApp: (com.droiddeck.launcher.HomeApp.LaunchableApp) -> Unit = {},
val onBackActionsInverted: (Boolean) -> Unit = {},
)
@@ -281,7 +281,7 @@ private fun Rail(
Image(painterResource(R.drawable.logo), null, modifier = Modifier.size(30.dp))
Spacer(Modifier.width(10.dp))
Column {
Text("SteamDeck", fontSize = 18.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
Text("DroidDeck", fontSize = 18.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
val status = when {
s.busy -> if (s.percent >= 0) "${s.stage} ${s.percent}%" else s.stage
!s.ready -> "runtime not installed"
@@ -340,9 +340,16 @@ private fun Rail(
}
}
// Outlined when a controller is on it, like every other control; the ripple alone was
// a faint box on the dark rail.
val creditsSrc = remember { MutableInteractionSource() }
val creditsHot = rememberHot(creditsSrc)
Text(
"credits", fontSize = 11.sp, color = colors.onSurfaceVariant,
modifier = Modifier.clip(Shape10).clickable(onClick = a.onCredits).padding(horizontal = 10.dp, vertical = 8.dp),
"credits", fontSize = 11.sp, color = if (creditsHot) LocalPalette.current.signal else colors.onSurfaceVariant,
modifier = Modifier.clip(Shape10)
.border(2.dp, if (creditsHot) LocalPalette.current.signal else Color.Transparent, Shape10)
.hoverable(creditsSrc).clickable(interactionSource = creditsSrc, indication = null, onClick = a.onCredits)
.padding(horizontal = 10.dp, vertical = 8.dp),
)
}
}
@@ -799,6 +806,9 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () ->
.clip(Shape12)
.background(if (enabled) Brush.linearGradient(listOf(colors.primary, pal.primary2)) else Brush.linearGradient(listOf(colors.surfaceVariant, colors.surfaceVariant)))
.shine(hot, 0.45f)
// The grow and shine alone barely show on the light fill: outline it when a
// controller is on it, as the other controls are.
.border(2.dp, if (hot) pal.signal else Color.Transparent, Shape12)
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick)
.padding(horizontal = 18.dp, vertical = 11.dp),
) {
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
@@ -14,9 +14,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.steamdeck.launcher.core.FexPreset
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.session.SessionService
import com.droiddeck.launcher.core.FexPreset
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
/** [tag] is shown beside the name: [BUNDLED], [DOWNLOADED], [IMPORTED], or "" for Auto / Runtime default. */
class DriverRow(val id: String, val name: String, val detail: String, val removable: Boolean, val tag: String = "") {
@@ -182,7 +182,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
ChoiceRow(
host, "shape", "Shape",
if (custom != null) "Set by the custom resolution." else "The panel's shape stays at 16:9 or wider; pick Exactly this panel for a 4:3 or 3:2 screen.",
com.steamdeck.launcher.session.SessionPrefs.shapeChoices, s.shapeMode, enabled = custom == null, onPick = a.onShape,
com.droiddeck.launcher.session.SessionPrefs.shapeChoices, s.shapeMode, enabled = custom == null, onPick = a.onShape,
)
if (editCustom) CustomResolutionDialog(
initial = custom,
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
/** Package metadata shown on an emulator's own detail page. */
class PackageRow(
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.border
@@ -89,7 +89,7 @@ fun PerformancePage(
)
ToggleRow(
host, "deck", "Steam Deck mode",
"Runs the client with -steamdeck. SteamOS helpers and battery info are provided.",
"Runs the client with -droiddeck. SteamOS helpers and battery info are provided.",
steamDeckMode, onChange = onSteamDeckMode,
)
}
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.ui.Modifier
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import android.app.Presentation
import android.content.ClipboardManager
@@ -21,14 +21,14 @@ import android.widget.FrameLayout
import android.widget.HorizontalScrollView
import android.widget.LinearLayout
import android.widget.TextView
import com.steamdeck.launcher.input.KeyboardHost
import com.steamdeck.launcher.input.PointerGestures
import com.steamdeck.launcher.input.SecondScreenMode
import com.steamdeck.launcher.input.TouchpadGestures
import com.steamdeck.launcher.SessionActivity
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.session.SessionState
import com.steamdeck.launcher.session.SessionTerminal
import com.droiddeck.launcher.input.KeyboardHost
import com.droiddeck.launcher.input.PointerGestures
import com.droiddeck.launcher.input.SecondScreenMode
import com.droiddeck.launcher.input.TouchpadGestures
import com.droiddeck.launcher.SessionActivity
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.session.SessionTerminal
import com.termux.terminal.TerminalEmulator
import com.termux.terminal.TerminalSession
import com.termux.terminal.TerminalSessionClient
@@ -1,9 +1,12 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.ui.focus.focusRequester
import androidx.compose.material3.ButtonDefaults
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -35,8 +38,8 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.steamdeck.launcher.R
import com.steamdeck.launcher.HomeApp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.HomeApp
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.Spring
@@ -64,11 +67,11 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import com.steamdeck.launcher.core.FexPreset
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.input.SecondScreenDisplay
import com.steamdeck.launcher.input.SecondScreenMode
import com.droiddeck.launcher.core.FexPreset
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.input.SecondScreenDisplay
import com.droiddeck.launcher.input.SecondScreenMode
import kotlinx.coroutines.flow.collect
@Composable
@@ -179,6 +182,16 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
val host = rememberMenuHost()
var androidAppsExpanded by rememberSaveable { mutableStateOf(false) }
val veil by animateFloatAsState(if (open) 1f else 0f, Motion.tw(260), label = "veil")
// A controller starts on the drawer's first control, highlighted, as on the app's main screen:
// the STEAM button, or in a desktop session the first setting.
val firstFocus = remember { androidx.compose.ui.focus.FocusRequester() }
val steamButtons = a.onSteamMenu != null && a.onQam != null
LaunchedEffect(open) {
if (open) {
androidx.compose.runtime.withFrameNanos { }
runCatching { firstFocus.requestFocus() }
}
}
if (open || veil > 0.01f) Box(
modifier = Modifier.fillMaxSize().graphicsLayer { alpha = veil }.background(Color(0x8A000000))
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) { host.open = null; a.onClose() },
@@ -205,6 +218,7 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
}
if (a.onSteamMenu != null && a.onQam != null) {
val qamInteraction = remember { MutableInteractionSource() }
val qamHot = qamInteraction.collectIsFocusedAsState().value || qamInteraction.collectIsHoveredAsState().value
var qamStartedOnPress by remember { mutableStateOf(false) }
LaunchedEffect(qamInteraction) {
qamInteraction.interactions.collect { interaction ->
@@ -219,10 +233,15 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
horizontalArrangement = Arrangement.spacedBy(8.dp),
modifier = Modifier.fillMaxWidth().padding(bottom = 12.dp),
) {
val steamSrc = remember { MutableInteractionSource() }
val steamHot = steamSrc.collectIsFocusedAsState().value || steamSrc.collectIsHoveredAsState().value
OutlinedButton(
onClick = { host.open = null; a.onSteamMenu.invoke() },
modifier = Modifier.weight(1f).height(48.dp),
interactionSource = steamSrc,
modifier = Modifier.weight(1f).height(48.dp).focusRequester(firstFocus),
shape = RoundedCornerShape(12.dp),
border = BorderStroke(if (steamHot) 2.dp else 1.dp, if (steamHot) pal.signal else colors.outline),
colors = ButtonDefaults.outlinedButtonColors(containerColor = if (steamHot) pal.signal.copy(alpha = 0.16f) else Color.Transparent),
) {
Text("STEAM", fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 0.5.sp)
}
@@ -235,6 +254,8 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
interactionSource = qamInteraction,
modifier = Modifier.weight(1f).height(48.dp).semantics { contentDescription = "Open Quick Access Menu" },
shape = RoundedCornerShape(12.dp),
border = BorderStroke(if (qamHot) 2.dp else 1.dp, if (qamHot) pal.signal else colors.outline),
colors = ButtonDefaults.outlinedButtonColors(containerColor = if (qamHot) pal.signal.copy(alpha = 0.16f) else Color.Transparent),
) {
Text("…", fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
}
@@ -270,7 +291,10 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
}
SettingsGroup("Now") {
ToggleRow(host, "hud", "Performance HUD", null, a.hudOn, onChange = a.onHud)
ToggleRow(
host, "hud", "Performance HUD", null, a.hudOn,
chipModifier = if (steamButtons) Modifier else Modifier.focusRequester(firstFocus), onChange = a.onHud,
)
val fgOpen = host.open == "fg"
val fgLabel = when (a.frameGenEngine) {
FrameGen.ENGINE_WINFG -> "Win-FG ${a.frameGenMultiplier}×"
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
@@ -242,8 +242,8 @@ fun <T> ChoiceRow(
}
@Composable
fun ToggleRow(host: MenuHost, key: String, label: String, hint: String?, checked: Boolean, enabled: Boolean = true, onChange: (Boolean) -> Unit) =
ChoiceRow(host, key, label, hint, listOf(true to "On", false to "Off"), checked, enabled, onPick = onChange)
fun ToggleRow(host: MenuHost, key: String, label: String, hint: String?, checked: Boolean, enabled: Boolean = true, chipModifier: Modifier = Modifier, onChange: (Boolean) -> Unit) =
ChoiceRow(host, key, label, hint, listOf(true to "On", false to "Off"), checked, enabled, chipModifier = chipModifier, onPick = onChange)
@Composable
fun MultiRow(
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.ui
package com.droiddeck.launcher.ui
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
@@ -7,7 +7,7 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import com.steamdeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionPrefs
class Palette(
val id: String, val label: String, val detail: String,
@@ -52,7 +52,7 @@ object Themes {
val LocalPalette = staticCompositionLocalOf { Themes.byId(Themes.PAPER) }
@Composable
fun SteamDeckTheme(theme: String? = null, content: @Composable () -> Unit) {
fun DroidDeckTheme(theme: String? = null, content: @Composable () -> Unit) {
val id = theme ?: SessionPrefs.theme(LocalContext.current)
val p = Themes.byId(id)
val scheme = darkColorScheme(
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.wayland
package com.droiddeck.launcher.wayland
import android.view.Choreographer
import android.view.Surface
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.wayland
package com.droiddeck.launcher.wayland
import android.content.Context
import android.os.Build
@@ -1,4 +1,4 @@
package com.steamdeck.launcher.wayland;
package com.droiddeck.launcher.wayland;
import android.view.Surface;
@@ -62,7 +62,7 @@ public final class WaylandCompositor {
/** Invoked from native (banner_on_game_frame) for every frame of the HUD's window. */
@SuppressWarnings("unused")
static void onGameFrame() {
com.steamdeck.launcher.session.PerfHints.onFrame();
com.droiddeck.launcher.session.PerfHints.onFrame();
GameListener l = gameListener;
if (l != null) l.onGameFrame();
}