From cc71e7b56c7dd9f02597f42ea1ac65339eee7d24 Mon Sep 17 00:00:00 2001 From: lynxnb Date: Fri, 21 Oct 2022 12:41:36 +0200 Subject: [PATCH] Run emulation in a separate process Exiting from emulation has always been a big issue for Skyline, with guest and host threads that would keep running in the background unless the app was manually killed. Running emulation in a separate process allows us to kill it when we are done, avoiding the need for complex exiting management code. --- app/src/main/AndroidManifest.xml | 1 + app/src/main/java/emu/skyline/EmulationActivity.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index de5f006c..6f77432f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -68,6 +68,7 @@ android:configChanges="orientation|screenSize|uiMode" android:exported="true" android:launchMode="singleTask" + android:process=":emulationProcess" android:parentActivityName=".MainActivity"> diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index 76bf84d1..1f7c7c80 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -219,7 +219,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo shouldFinish = false if (returnToMain) startActivity(Intent(applicationContext, MainActivity::class.java).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) - finishAffinity() + Process.killProcess(Process.myPid()) } } }