Skip to content

Commit de8d375

Browse files
committed
Fix double-launch issue when switching games from external launcher
When launching a different game via FLAG_ACTIVITY_CLEAR_TOP (e.g., from Daijishou), onNewIntent() was calling finish() + System.exit(0), which killed the app without restarting. Users had to tap twice to launch a new game. Now starts a fresh activity with FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK before calling System.exit(0). This queues the new game to launch, then kills the current process so Android starts fresh.
1 parent abc7ea3 commit de8d375

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ public void onNewIntent(Intent intent) {
8080
String currentCore = currentIntent != null ? currentIntent.getStringExtra("LIBRETRO") : null;
8181

8282

83-
// Check if we're trying to launch different content
83+
// Check if we're trying to launch different content
8484
if ((newRom != null && !newRom.equals(currentRom)) ||
8585
(newCore != null && !newCore.equals(currentCore))) {
86-
// Different game content - exit cleanly and let launcher restart us
87-
finish();
86+
// Different game content - start fresh instance then exit
87+
Intent restartIntent = new Intent(intent);
88+
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
89+
startActivity(restartIntent);
8890
System.exit(0);
8991
} else {
9092
// Same content, just update intent

0 commit comments

Comments
 (0)