Merge branch 'main' into fix/curseforge-game-instance

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-26 18:39:33 -05:00
commit d7b36f5a4f
4 files changed
+27 -1

No files matched your search

@@ -1349,6 +1349,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
val shortcutsFilter = android.content.IntentFilter(SteamIntegration.SHORTCUTS_STATUS)
if (android.os.Build.VERSION.SDK_INT >= 33) registerReceiver(shortcutsInstallStatus, shortcutsFilter, RECEIVER_NOT_EXPORTED)
else registerReceiver(shortcutsInstallStatus, shortcutsFilter)
if (GameLaunchIntent.accepts(intent.action) &&
GameLaunchIntent.replayed(intent, savedInstanceState != null, savedInstanceState?.getString(STATE_PROCESS), PROCESS))
clearGameLinkIntent(intent)
readGameIntent(intent)
// A Lab build is usually the agent's work, so the app comes back where the agent is.
if (savedInstanceState == null && navRequest == null && com.droiddeck.launcher.lab.LabOverlay.promoted && com.droiddeck.launcher.agent.AgentTab.visible) navRequest = "agent"
@@ -2312,6 +2315,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
private fun saveLauncherState(outState: Bundle) {
outState.putString(STATE_PROCESS, PROCESS)
outState.putBoolean(STATE_HOME_CHOICE_OPEN, homeChoiceOpen)
outState.putBoolean(STATE_GAME_SPACE_OFFERED, gameSpaceOffered)
pendingSessionLogExport?.let { outState.putString(KEY_PENDING_SESSION_LOG_EXPORT, it.absolutePath) }
@@ -3684,6 +3688,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
companion object {
private val PROCESS = java.util.UUID.randomUUID().toString()
private const val STATE_PROCESS = "process"
private const val REQUEST_NOTIFICATIONS = 7103
private const val EXTRA_RESTARTED = "com.droiddeck.launcher.extra.RESTARTED"
private const val STATE_HOME_CHOICE_OPEN = "home_choice_open"
@@ -11,6 +11,10 @@ object GameLaunchIntent {
fun accepts(action: String?): Boolean = action == Intent.ACTION_VIEW || action == ACTION || action == GAMENATIVE_ACTION
fun replayed(intent: Intent, restored: Boolean, savedProcess: String?, process: String): Boolean =
!(intent.data?.scheme == "droiddeck" && intent.data?.host == "settings") &&
(intent.flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0 || restored && savedProcess != process)
fun read(context: Context, intent: Intent): GameRequest? = when (intent.action) {
Intent.ACTION_VIEW -> GameFiles.readIntent(context, intent)
ACTION, GAMENATIVE_ACTION -> readExtras(intent)
@@ -20,6 +20,22 @@ class GameLaunchIntentTest {
}
}
@Test fun aLinkIsReplayedOnlyWhenANewProcessRestoresItOrRecentsReopensIt() {
val link = Intent(Intent.ACTION_VIEW)
assertFalse(GameLaunchIntent.replayed(link, restored = false, savedProcess = null, process = "b"))
assertFalse(GameLaunchIntent.replayed(link, restored = true, savedProcess = "b", process = "b"))
assertTrue(GameLaunchIntent.replayed(link, restored = true, savedProcess = "a", process = "b"))
assertTrue(GameLaunchIntent.replayed(link, restored = true, savedProcess = null, process = "b"))
val fromRecents = Intent(link).addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)
assertTrue(GameLaunchIntent.replayed(fromRecents, restored = false, savedProcess = null, process = "b"))
assertTrue(GameLaunchIntent.replayed(fromRecents, restored = true, savedProcess = "b", process = "b"))
val settings = Intent(Intent.ACTION_VIEW, android.net.Uri.parse("droiddeck://settings/storage"))
.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)
assertFalse(GameLaunchIntent.replayed(settings, restored = true, savedProcess = "a", process = "b"))
assertTrue(GameLaunchIntent.replayed(Intent(Intent.ACTION_VIEW, android.net.Uri.parse("droiddeck://game/620")),
restored = true, savedProcess = "a", process = "b"))
}
@Test fun longAndStringIdsPreserveUnsignedShortcutIds() {
listOf("2147483648", "18446744073709551615").forEach { id ->
assertEquals(id, GameLaunchIntent.readExtras(Intent(GameLaunchIntent.ACTION).putExtra("app_id", id))?.id)
@@ -778,7 +778,7 @@ case $mode in
for _d in /proc/[0-9]*; do
[ "${_d##*/}" != "$BASHPID" ] || continue
_args=()
while IFS= read -r -d '' _c; do _args+=("$_c"); done 2>/dev/null < "$_d/cmdline" || true
mapfile -d '' -t _args 2>/dev/null < "$_d/cmdline" || true
[ "${#_args[@]}" -gt 0 ] || continue
_name=${_args[0]} _fex=0
if [ "${#_args[@]}" -gt 1 ]; then