From fe812081ec4f5741794e3cd62f481471fc9738f7 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Mon, 21 Sep 2026 08:42:17 -0400 Subject: [PATCH] Restore Steam's overlay, and stop the app that takes the Steam login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two deviations from a normal Steam launch, both removed rather than worked around — Bannerlator's fix (334955ea), brought across unchanged. The overlay was being stripped from every game because it landed in front of open() and read() on /dev/input, letting Wine open the session's pad and then answering every read of it with nothing. That was the wrong cure for an ordering problem: glibc reads LD_PRELOAD before /etc/ld.so.preload, and the interposer lives in the latter, so the overlay was simply ahead of it. Naming the interposer first in LD_PRELOAD puts it back in front and the overlay loads as Valve intends, in both wrappers — Valve's depot and an adopted GE-Proton or proton-cachyos. Every difference between the launch Valve ships and what runs here is a difference this runtime would otherwise have to account for. Second, the competing Steam client is asked to stop rather than only named. killBackgroundProcesses is a normal permission and ends exactly the case that keeps recurring: GameHub declares boot receivers, so it is running from the moment the phone starts without ever being opened, and it takes the login off the client seconds after every sign-in. Done at Steam-session start only; the desktop signs into nothing. README: the GPU requirement now says which Adrenos Turnip actually drives. A user's session log ended at "device (chip_id = 7010000, gpu_id = 710) is unsupported" — an Adreno 710, which Mesa has no entry for. --- README.md | 7 +- app/src/main/AndroidManifest.xml | 4 ++ .../launcher/session/RivalClients.kt | 64 +++++++++++++++++++ .../launcher/session/SessionService.kt | 3 + .../usr/local/bin/bannerlator-steam-compat | 49 +++++++------- 5 files changed, 103 insertions(+), 24 deletions(-) create mode 100644 app/src/main/java/com/steamdeck/launcher/session/RivalClients.kt diff --git a/README.md b/README.md index ad25b36220..d70c6e0835 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,11 @@ One screen, one button: install the runtime, press Play, Big Picture comes up. O ## Requirements -- An **arm64 Android device with an Adreno GPU**. The compositor loads a Turnip driver; Mali, - Xclipse and PowerVR are not supported here. +- An **arm64 Android device with an Adreno GPU that Turnip supports** — in practice Adreno **730 or + newer** (Snapdragon 8 Gen 1 onward) and the **8xx** series. Mali, Xclipse and PowerVR are not + supported here, and neither is the low-end Adreno 710 (Snapdragon 6 Gen 1): Mesa has no entry + for it at all, so the session log ends at `device (chip_id = 7010000, gpu_id = 710) is + unsupported` before anything is drawn. - **Android 9 or newer**, and roughly **3 GB free** for the runtime before any games. The desktop and its emulator packages are another ~1.1 GB if you install them. - **No root required.** Root only helps if you want to copy an existing Bannerlator runtime across diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d0ab605e54..3dd7ae4e0d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,6 +13,10 @@ + + diff --git a/app/src/main/java/com/steamdeck/launcher/session/RivalClients.kt b/app/src/main/java/com/steamdeck/launcher/session/RivalClients.kt new file mode 100644 index 0000000000..de53881d28 --- /dev/null +++ b/app/src/main/java/com/steamdeck/launcher/session/RivalClients.kt @@ -0,0 +1,64 @@ +package com.steamdeck.launcher.session + +import android.app.ActivityManager +import android.content.Context +import android.util.Log +import android.widget.Toast + +/** + * Other apps on the device that sign into the user's Steam account with their own client. Steam + * allows one session per account: the moment one of them signs in, ours is signed out — which + * shows up as "Session Replaced" in the client's log 2-3 seconds after every login, and looks + * like a bug in this app. + * + * Installed is the most a normal app can know (since Android 7 `getRunningAppProcesses()` returns + * only the caller's own), so the list is checked for presence and then asked to stop. + * `killBackgroundProcesses` is a normal permission: it ends an app's background processes and + * leaves anything in the foreground alone — and background is exactly the case that keeps + * happening, because GameHub declares boot receivers and is running from the moment the phone + * starts without ever having been opened. Telling someone to close an app they never opened is + * not much help. Ported from Bannerlator's Linux session (GPL-3.0). + */ +object RivalClients { + private const val TAG = "RivalClients" + + private val PACKAGES = arrayOf( + "com.xiaoji.egggame", // GameHub + ) + + fun installed(context: Context): List = + PACKAGES.filter { pkg -> + try { context.packageManager.getPackageInfo(pkg, 0); true } catch (e: Throwable) { false } + } + + fun name(pkg: String): String = if (pkg == "com.xiaoji.egggame") "GameHub" else pkg + + /** + * Stop the installed rivals' background processes before the client starts, and say so. A + * rival in the foreground survives this, so the wording covers that case too. Call on the main + * thread; the Toast is shown from here. + */ + fun stopBeforeSession(context: Context) { + val rivals = installed(context) + if (rivals.isEmpty()) return + val who = name(rivals[0]) + Log.w(TAG, "competing Steam client installed: $rivals") + var asked = false + try { + val am = context.getSystemService(Context.ACTIVITY_SERVICE) as? ActivityManager + if (am != null) { + for (pkg in rivals) am.killBackgroundProcesses(pkg) + asked = true + Log.i(TAG, "asked Android to stop background processes of $rivals") + } + } catch (t: Throwable) { + Log.w(TAG, "could not stop competing Steam clients", t) + } + Toast.makeText( + context, + if (asked) "Closed $who in the background — it signs into your Steam account." + else "If $who is open, close it first — it signs into your Steam account and will sign this client out.", + Toast.LENGTH_LONG, + ).show() + } +} diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt index 1261b469bf..3322fb410b 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt @@ -59,6 +59,9 @@ class SessionService : Service() { startForeground(NOTIFICATION_ID, buildNotification()) if (SessionState.running) return START_NOT_STICKY SessionState.mode = intent?.getStringExtra(EXTRA_MODE) ?: MODE_STEAM + // Another Steam client on the device signs ours out seconds after every login; the one that + // does it here runs from boot without being opened. Only the Steam session signs in. + if (SessionState.mode == MODE_STEAM) RivalClients.stopBeforeSession(this) SessionState.running = true SessionState.firstFrameSeen = false acquireLocks() diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat b/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat index 44d2416bc8..7669773638 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-steam-compat @@ -78,18 +78,23 @@ LAUNCHER_SH = """#!/bin/bash # Steam Linux Runtime container its own manifest asks for (no user namespaces on Android). verb=$1; shift steam_root=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam} -# The client preloads its overlay library into every game. In a gamescope session the overlay is -# the client's own window, so the library draws nothing - but it stands in front of open() and -# read() on /dev/input, lets Wine open the session's pad and answers every read of it with nothing: -# a controller that never reports, and Wine's HID thread spinning a core on it. Dropped here; -# anything else in LD_PRELOAD is kept. -kept= -IFS=': ' -for lib in ${LD_PRELOAD:-}; do - case $lib in */gameoverlayrenderer.so) ;; *) kept=${kept:+$kept:}$lib ;; esac -done -unset IFS -if [ -n "$kept" ]; then export LD_PRELOAD="$kept"; else unset LD_PRELOAD; fi +# Steam's overlay is preloaded into every game Valve launches, and used to be dropped here: it was +# landing in front of open() and read() on /dev/input, letting Wine open the session's pad and +# answering every read of it with nothing - a controller that never reports, and Wine's HID thread +# spinning a core on it. +# +# Removing it was the wrong cure for an ordering problem. glibc processes LD_PRELOAD BEFORE +# /etc/ld.so.preload, and the interposer lives in the latter, so the overlay was simply ahead of it. +# Naming the interposer first in LD_PRELOAD puts it back in front and the overlay loads as Valve +# intends. That matters beyond the overlay itself: every deviation from the launch Valve ships is a +# difference this runtime would otherwise have to justify. +fake=/usr/local/lib/libfakeinput.so +if [ -f "$fake" ]; then + case ":${LD_PRELOAD:-}:" in + *":$fake:"*) ;; + *) LD_PRELOAD="$fake${LD_PRELOAD:+:$LD_PRELOAD}"; export LD_PRELOAD ;; + esac +fi for name in %s; do depot="$steam_root/steamapps/common/$name" if [ -d "$depot/files/bin-arm64" ] && [ -x "$depot/proton" ]; then @@ -120,16 +125,16 @@ EXTRA_WRAPPER_SH = """#!/bin/bash # an Android app does not get, and the launch dies before Proton is reached. verb=$1; shift here=$(dirname "$0") -# See bannerlator-proton: in a gamescope session the client's overlay draws nothing, but it stands -# in front of open() and read() on /dev/input and answers every read of the session's pad with -# nothing - a controller that never reports. Dropped here; anything else in LD_PRELOAD is kept. -kept= -IFS=': ' -for lib in ${LD_PRELOAD:-}; do - case $lib in */gameoverlayrenderer.so) ;; *) kept=${kept:+$kept:}$lib ;; esac -done -unset IFS -if [ -n "$kept" ]; then export LD_PRELOAD="$kept"; else unset LD_PRELOAD; fi +# See bannerlator-proton: the interposer goes first in LD_PRELOAD rather than the overlay being +# removed, because glibc reads LD_PRELOAD before /etc/ld.so.preload and the overlay was simply +# ahead of it on /dev/input. +fake=/usr/local/lib/libfakeinput.so +if [ -f "$fake" ]; then + case ":${LD_PRELOAD:-}:" in + *":$fake:"*) ;; + *) LD_PRELOAD="$fake${LD_PRELOAD:+:$LD_PRELOAD}"; export LD_PRELOAD ;; + esac +fi # Proton takes its base directory from dirname(sys.argv[0]) without resolving it, so it has to be # started from its own tree. exec "$here/%s" "$verb" "$@"