mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
Restore Steam's overlay, and stop the app that takes the Steam login
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.
This commit is contained in:
1 parent
539fd692ed
commit
fe812081ec
5 files changed
+103
-24
No files matched your search
@@ -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<String> =
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user