summaryrefslogtreecommitdiffstats
path: root/platform/android/java/editor
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuyakou@gmail.com>2023-06-15 21:11:40 -0700
committerFredia Huya-Kouadio <fhuyakou@gmail.com>2023-06-15 21:41:49 -0700
commit0664f5ec3b9a3174872ee6302ccb672f8f361699 (patch)
treebb7ca6b0505514c7b1e0bcf7d25211e5601a0f9e /platform/android/java/editor
parentc0d8d91b15597209a1ca865c6ff4f84f06f7de86 (diff)
downloadredot-engine-0664f5ec3b9a3174872ee6302ccb672f8f361699.tar.gz
Add parameters for the Godot Activity starting intent to allow restarting or force-quitting the engine
Follow-up code cleanup for https://github.com/godotengine/godot/pull/78129
Diffstat (limited to 'platform/android/java/editor')
-rw-r--r--platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt27
1 files changed, 5 insertions, 22 deletions
diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
index 3d1d4d22ce..64d3d4eca1 100644
--- a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
+++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
@@ -62,7 +62,6 @@ open class GodotEditor : FullScreenGodotApp() {
private const val WAIT_FOR_DEBUGGER = false
- private const val EXTRA_FORCE_QUIT = "force_quit_requested"
private const val EXTRA_COMMAND_LINE_PARAMS = "command_line_params"
private const val EDITOR_ID = 777
@@ -96,7 +95,9 @@ open class GodotEditor : FullScreenGodotApp() {
// requested on demand based on use-cases.
PermissionsUtil.requestManifestPermissions(this, setOf(Manifest.permission.RECORD_AUDIO))
- handleIntentParams(intent)
+ val params = intent.getStringArrayExtra(EXTRA_COMMAND_LINE_PARAMS)
+ Log.d(TAG, "Received parameters ${params.contentToString()}")
+ updateCommandLineParams(params)
if (BuildConfig.BUILD_TYPE == "dev" && WAIT_FOR_DEBUGGER) {
Debug.waitForDebugger()
@@ -105,25 +106,6 @@ open class GodotEditor : FullScreenGodotApp() {
super.onCreate(savedInstanceState)
}
- override fun onNewIntent(newIntent: Intent) {
- intent = newIntent
- handleIntentParams(newIntent)
- super.onNewIntent(newIntent)
- }
-
- private fun handleIntentParams(receivedIntent: Intent) {
- val forceQuitRequested = receivedIntent.getBooleanExtra(EXTRA_FORCE_QUIT, false)
- if (forceQuitRequested) {
- Log.d(TAG, "Force quit requested, terminating..")
- ProcessPhoenix.forceQuit(this)
- return
- }
-
- val params = receivedIntent.getStringArrayExtra(EXTRA_COMMAND_LINE_PARAMS)
- Log.d(TAG, "Received parameters ${params.contentToString()}")
- updateCommandLineParams(params)
- }
-
override fun onGodotSetupCompleted() {
super.onGodotSetupCompleted()
val longPressEnabled = enableLongPressGestures()
@@ -154,7 +136,7 @@ open class GodotEditor : FullScreenGodotApp() {
private fun updateCommandLineParams(args: Array<String>?) {
// Update the list of command line params with the new args
commandLineParams.clear()
- if (args != null && args.isNotEmpty()) {
+ if (!args.isNullOrEmpty()) {
commandLineParams.addAll(listOf(*args))
}
if (BuildConfig.BUILD_TYPE == "dev") {
@@ -201,6 +183,7 @@ open class GodotEditor : FullScreenGodotApp() {
ProcessPhoenix.triggerRebirth(this, newInstance)
} else {
Log.d(TAG, "Starting $targetClass with parameters ${args.contentToString()}")
+ newInstance.putExtra(EXTRA_NEW_LAUNCH, true)
startActivity(newInstance)
}
return instanceId