diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index afd5407f37e1..991660b8ac19 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -610,6 +610,7 @@ void EditorNode::_notification(int p_what) {
get_tree()->get_root()->set_snap_2d_transforms_to_pixel(false);
get_tree()->get_root()->set_snap_2d_vertices_to_pixel(false);
get_tree()->set_auto_accept_quit(false);
+ get_tree()->set_quit_on_go_back(false);
get_tree()->get_root()->connect("files_dropped", callable_mp(this, &EditorNode::_dropped_files));
command_palette->register_shortcuts_as_command();
diff --git a/main/main.cpp b/main/main.cpp
index 9767d4f5fbc6..84fe82ac61e9 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2251,9 +2251,10 @@ bool Main::start() {
bool embed_subwindows = GLOBAL_DEF("display/window/subwindows/embed_subwindows", true);
- if (OS::get_singleton()->is_single_window() || (!project_manager && !editor && embed_subwindows)) {
+ if (OS::get_singleton()->is_single_window() || (!project_manager && !editor && embed_subwindows) || !DisplayServer::get_singleton()->has_feature(DisplayServer::Feature::FEATURE_SUBWINDOWS)) {
sml->get_root()->set_embed_subwindows_hint(true);
}
+
ResourceLoader::add_custom_loaders();
ResourceSaver::add_custom_savers();
diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle
index 5d1a9d7b99a9..87ad0050f9cf 100644
--- a/platform/android/java/app/build.gradle
+++ b/platform/android/java/app/build.gradle
@@ -45,6 +45,7 @@ dependencies {
// Custom build mode. In this scenario this project is the only one around and the Godot
// library is available through the pre-generated godot-lib.*.aar android archive files.
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
+ releaseDebugmIplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
}
@@ -66,6 +67,7 @@ dependencies {
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
+ ndkVersion versions.ndkVersion
compileOptions {
sourceCompatibility versions.javaVersion
@@ -95,6 +97,10 @@ android {
targetSdkVersion getExportTargetSdkVersion()
}
+ buildTypes {
+ release_debug {}
+ }
+
lintOptions {
abortOnError false
disable 'MissingTranslation', 'UnusedResources'
@@ -167,6 +173,7 @@ android {
assets.srcDirs = ['assets']
}
debug.jniLibs.srcDirs = ['libs/debug', 'libs/debug/vulkan_validation_layers']
+ release_debug.jniLibs.srcDirs = ['libs/debug']
release.jniLibs.srcDirs = ['libs/release']
}
diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle
index ac008edbedbf..ec838652bc83 100644
--- a/platform/android/java/build.gradle
+++ b/platform/android/java/build.gradle
@@ -22,7 +22,7 @@ allprojects {
ext {
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
- supportedTargets = ["release", "debug"]
+ supportedTargets = ["release", "release_debug", "debug"]
// Used by gradle to specify which architecture to build for by default when running `./gradlew build`.
// This command is usually used by Android Studio.
@@ -30,6 +30,9 @@ ext {
// `./gradlew generateGodotTemplates` build command instead after running the `scons` command.
// The defaultAbi must be one of the {supportedAbis} values.
defaultAbi = "arm64v8"
+
+ //default for building on Android Studio so editor would be built as well
+ tools=true
}
def rootDir = "../../.."
diff --git a/platform/android/java/editor/AndroidManifest.xml b/platform/android/java/editor/AndroidManifest.xml
new file mode 100644
index 000000000000..f49e8df87244
--- /dev/null
+++ b/platform/android/java/editor/AndroidManifest.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/android/java/editor/build.gradle b/platform/android/java/editor/build.gradle
new file mode 100644
index 000000000000..508bc64f4f87
--- /dev/null
+++ b/platform/android/java/editor/build.gradle
@@ -0,0 +1,63 @@
+// Gradle build config for Godot Engine's Android port.
+apply plugin: 'com.android.application'
+
+dependencies {
+ implementation libraries.kotlinStdLib
+ implementation libraries.androidxFragment
+ implementation project(":lib")
+}
+
+android {
+ compileSdkVersion versions.compileSdk
+ buildToolsVersion versions.buildTools
+ ndkVersion versions.ndkVersion
+
+ defaultConfig {
+ applicationId "org.godotengine.editor"
+ minSdkVersion versions.minSdk
+ targetSdkVersion versions.targetSdk
+ }
+
+ compileOptions {
+ sourceCompatibility versions.javaVersion
+ targetCompatibility versions.javaVersion
+ }
+
+ buildTypes {
+ release_debug {}
+ }
+
+ lintOptions {
+ abortOnError false
+ disable 'MissingTranslation', 'UnusedResources'
+ }
+
+ packagingOptions {
+ exclude 'META-INF/LICENSE'
+ exclude 'META-INF/NOTICE'
+
+ // 'doNotStrip' is enabled for development within Android Studio
+ if (shouldNotStrip()) {
+ doNotStrip '**/*.so'
+ }
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ res.srcDirs = ['res']
+ aidl.srcDirs = ['aidl']
+ assets.srcDirs = ['assets']
+ }
+ debug.jniLibs.srcDirs = ['libs/debug']
+ release_debug.jniLibs.srcDirs = ['libs/debug']
+ release.jniLibs.srcDirs = ['libs/release']
+ }
+
+ applicationVariants.all { variant ->
+ variant.outputs.all { output ->
+ output.outputFileName = "android_editor_${variant.name}.apk"
+ }
+ }
+}
diff --git a/platform/android/java/editor/res/values/strings.xml b/platform/android/java/editor/res/values/strings.xml
new file mode 100644
index 000000000000..fed1308ef639
--- /dev/null
+++ b/platform/android/java/editor/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ Godot Editor
+
diff --git a/platform/android/java/editor/src/org/godotengine/editor/GodotEditor.java b/platform/android/java/editor/src/org/godotengine/editor/GodotEditor.java
new file mode 100644
index 000000000000..dbeda193e46b
--- /dev/null
+++ b/platform/android/java/editor/src/org/godotengine/editor/GodotEditor.java
@@ -0,0 +1,36 @@
+/*************************************************************************/
+/* GodotEditor.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+package org.godotengine.editor;
+
+import org.godotengine.godot.FullScreenGodotApp;
+
+public class GodotEditor extends FullScreenGodotApp {
+}
diff --git a/platform/android/java/editor/src/org/godotengine/editor/GodotGame.java b/platform/android/java/editor/src/org/godotengine/editor/GodotGame.java
new file mode 100644
index 000000000000..61fe78f4b08d
--- /dev/null
+++ b/platform/android/java/editor/src/org/godotengine/editor/GodotGame.java
@@ -0,0 +1,36 @@
+/*************************************************************************/
+/* GodotGame.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+package org.godotengine.editor;
+
+import org.godotengine.godot.FullScreenGodotApp;
+
+public class GodotGame extends FullScreenGodotApp {
+}
diff --git a/platform/android/java/editor/src/org/godotengine/editor/GodotProjects.java b/platform/android/java/editor/src/org/godotengine/editor/GodotProjects.java
new file mode 100644
index 000000000000..d11361b1e163
--- /dev/null
+++ b/platform/android/java/editor/src/org/godotengine/editor/GodotProjects.java
@@ -0,0 +1,52 @@
+/*************************************************************************/
+/* GodotProjects.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+package org.godotengine.editor;
+import org.godotengine.godot.FullScreenGodotApp;
+
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.Settings;
+
+/**
+ * Activity for Godot projects.
+ */
+public class GodotProjects extends FullScreenGodotApp {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getGodotFragment().requestPermissions();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !Environment.isExternalStorageManager()) {
+ startActivity(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
+ }
+ }
+}
diff --git a/platform/android/java/gradle.properties b/platform/android/java/gradle.properties
index 5cd94e85d9ab..ab1ddc20e79f 100644
--- a/platform/android/java/gradle.properties
+++ b/platform/android/java/gradle.properties
@@ -14,7 +14,7 @@ android.useAndroidX=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx4536m
+org.gradle.jvmargs=-Xmx8536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle
index fbed4ed0787e..9ad6df59d2b5 100644
--- a/platform/android/java/lib/build.gradle
+++ b/platform/android/java/lib/build.gradle
@@ -11,7 +11,6 @@ def pathToRootDir = "../../../../"
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
-
ndkVersion versions.ndkVersion
defaultConfig {
@@ -26,6 +25,10 @@ android {
targetCompatibility versions.javaVersion
}
+ buildTypes {
+ release_debug {}
+ }
+
lintOptions {
abortOnError false
disable 'MissingTranslation', 'UnusedResources'
@@ -50,6 +53,7 @@ android {
assets.srcDirs = ['assets']
}
debug.jniLibs.srcDirs = ['libs/debug']
+ release_debug.jniLibs.srcDirs = ['libs/debug']
release.jniLibs.srcDirs = ['libs/release']
}
@@ -105,7 +109,7 @@ android {
def taskName = getSconsTaskName(buildType)
tasks.create(name: taskName, type: Exec) {
executable sconsExecutableFile.absolutePath
- args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${defaultAbi}", "-j" + Runtime.runtime.availableProcessors()
+ args "tools=${tools}", "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${defaultAbi}", "-j" + Runtime.runtime.availableProcessors()
}
// Schedule the tasks so the generated libs are present before the aar file is packaged.
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
index 3fbbd8fbcc19..9bccbbe074d7 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
@@ -357,6 +357,8 @@ public int getGLESVersionCode() {
return deviceInfo.reqGlEsVersion;
}
+ private String COMMAND_LINE_INTENT_NAME = "command line args";
+
@CallSuper
protected String[] getCommandLine() {
String[] original = parseCommandLine();
@@ -375,6 +377,12 @@ protected String[] getCommandLine() {
private String[] parseCommandLine() {
InputStream is;
+ String[] activityCommandLine = getActivity().getIntent().getStringArrayExtra(COMMAND_LINE_INTENT_NAME);
+ int activityCommandLineCount = 0;
+ if (activityCommandLine != null) {
+ activityCommandLineCount = activityCommandLine.length;
+ }
+
try {
is = getActivity().getAssets().open("_cl_");
byte[] len = new byte[4];
@@ -383,7 +391,7 @@ private String[] parseCommandLine() {
return new String[0];
}
int argc = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
- String[] cmdline = new String[argc];
+ String[] cmdline = new String[argc + activityCommandLineCount];
for (int i = 0; i < argc; i++) {
r = is.read(len);
@@ -400,10 +408,19 @@ private String[] parseCommandLine() {
cmdline[i] = new String(arg, "UTF-8");
}
}
+
+ if (activityCommandLine != null) {
+ System.arraycopy(activityCommandLine, 0, cmdline, argc, activityCommandLine.length);
+ }
+
return cmdline;
} catch (Exception e) {
e.printStackTrace();
- return new String[0];
+ if (activityCommandLine != null) {
+ return activityCommandLine;
+ } else {
+ return new String[0];
+ }
}
}
@@ -1006,6 +1023,7 @@ public void onDownloadProgress(DownloadProgressInfo progress) {
mProgressFraction.setText(Helpers.getDownloadProgressString(progress.mOverallProgress,
progress.mOverallTotal));
}
+
public void initInputDevices() {
mRenderView.initInputDevices();
}
@@ -1014,4 +1032,12 @@ public void initInputDevices() {
private GodotRenderView getRenderView() { // used by native side to get renderView
return mRenderView;
}
+
+ @Keep
+ private void callIntentWithCommandLineArgs(String intentName, String[] args) throws ClassNotFoundException {
+ Class> c = Class.forName(intentName);
+ Intent intent = new Intent(getActivity(), c);
+ intent.putExtra(COMMAND_LINE_INTENT_NAME, args);
+ startActivity(intent);
+ }
}
diff --git a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt
index 34925684dab3..7df7eb23dc86 100644
--- a/platform/android/java/nativeSrcsConfigs/CMakeLists.txt
+++ b/platform/android/java/nativeSrcsConfigs/CMakeLists.txt
@@ -17,3 +17,5 @@ target_include_directories(${PROJECT_NAME}
SYSTEM PUBLIC
${GODOT_ROOT_DIR}
${GODOT_ROOT_DIR}/modules/gdnative/include)
+
+add_definitions(-DUNIX_ENABLED -DVULKAN_ENABLED -DTOOLS_ENABLED)
diff --git a/platform/android/java/nativeSrcsConfigs/build.gradle b/platform/android/java/nativeSrcsConfigs/build.gradle
index 158bb2b98ef6..535a611d9ede 100644
--- a/platform/android/java/nativeSrcsConfigs/build.gradle
+++ b/platform/android/java/nativeSrcsConfigs/build.gradle
@@ -6,6 +6,7 @@ plugins {
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
+ ndkVersion versions.ndkVersion
defaultConfig {
minSdkVersion versions.minSdk
diff --git a/platform/android/java/settings.gradle b/platform/android/java/settings.gradle
index 584b62690098..56e1b6fd3a49 100644
--- a/platform/android/java/settings.gradle
+++ b/platform/android/java/settings.gradle
@@ -4,6 +4,7 @@ rootProject.name = "Godot"
include ':app'
include ':lib'
include ':nativeSrcsConfigs'
+include ':editor'
include ':assetPacks:installTime'
project(':assetPacks:installTime').projectDir = file("app/assetPacks/installTime")
diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp
index 115264d7ee3f..ec45b4b85f15 100644
--- a/platform/android/java_godot_wrapper.cpp
+++ b/platform/android/java_godot_wrapper.cpp
@@ -76,6 +76,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_
_get_input_fallback_mapping = p_env->GetMethodID(godot_class, "getInputFallbackMapping", "()Ljava/lang/String;");
_on_godot_setup_completed = p_env->GetMethodID(godot_class, "onGodotSetupCompleted", "()V");
_on_godot_main_loop_started = p_env->GetMethodID(godot_class, "onGodotMainLoopStarted", "()V");
+ _call_intent_with_command_line_args = p_env->GetMethodID(godot_class, "callIntentWithCommandLineArgs", "(Ljava/lang/String;[Ljava/lang/String;)V");
// get some Activity method pointers...
_get_class_loader = p_env->GetMethodID(activity_class, "getClassLoader", "()Ljava/lang/ClassLoader;");
@@ -331,3 +332,15 @@ void GodotJavaWrapper::vibrate(int p_duration_ms) {
env->CallVoidMethod(godot_instance, _vibrate, p_duration_ms);
}
}
+
+void GodotJavaWrapper::call_intent_with_command_line_args(String intent, List args) {
+ if (_call_intent_with_command_line_args) {
+ JNIEnv *env = get_jni_env();
+ jstring jStrIntent = env->NewStringUTF(intent.utf8().get_data());
+ jobjectArray jargs = env->NewObjectArray(args.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
+ for (int i = 0; i < args.size(); i++) {
+ env->SetObjectArrayElement(jargs, i, env->NewStringUTF(args[i].utf8().get_data()));
+ }
+ env->CallVoidMethod(godot_instance, _call_intent_with_command_line_args, jStrIntent, jargs);
+ }
+}
diff --git a/platform/android/java_godot_wrapper.h b/platform/android/java_godot_wrapper.h
index 4d058ac426a2..69bdd8edfcdb 100644
--- a/platform/android/java_godot_wrapper.h
+++ b/platform/android/java_godot_wrapper.h
@@ -37,6 +37,7 @@
#include
#include
+#include "core/templates/list.h"
#include "java_godot_view_wrapper.h"
#include "string_android.h"
@@ -69,6 +70,7 @@ class GodotJavaWrapper {
jmethodID _on_godot_setup_completed = 0;
jmethodID _on_godot_main_loop_started = 0;
jmethodID _get_class_loader = 0;
+ jmethodID _call_intent_with_command_line_args = 0;
public:
GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_godot_instance);
@@ -100,6 +102,7 @@ class GodotJavaWrapper {
bool is_activity_resumed();
void vibrate(int p_duration_ms);
String get_input_fallback_mapping();
+ void call_intent_with_command_line_args(String intent, List args);
};
#endif /* !JAVA_GODOT_WRAPPER_H */
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index d1672d6ea3af..d1876496ae65 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -81,17 +81,27 @@ void OS_Android::alert(const String &p_alert, const String &p_title) {
void OS_Android::initialize_core() {
OS_Unix::initialize_core();
+#ifdef TOOLS_ENABLED
+ FileAccess::make_default(FileAccess::ACCESS_RESOURCES);
+#else
if (use_apk_expansion)
FileAccess::make_default(FileAccess::ACCESS_RESOURCES);
else {
FileAccess::make_default(FileAccess::ACCESS_RESOURCES);
}
+#endif
FileAccess::make_default(FileAccess::ACCESS_USERDATA);
FileAccess::make_default(FileAccess::ACCESS_FILESYSTEM);
+
+#ifdef TOOLS_ENABLED
+ DirAccess::make_default(DirAccess::ACCESS_RESOURCES);
+#else
if (use_apk_expansion)
DirAccess::make_default(DirAccess::ACCESS_RESOURCES);
else
DirAccess::make_default(DirAccess::ACCESS_RESOURCES);
+#endif
+
DirAccess::make_default(DirAccess::ACCESS_USERDATA);
DirAccess::make_default(DirAccess::ACCESS_FILESYSTEM);
@@ -193,7 +203,11 @@ Error OS_Android::shell_open(String p_uri) {
}
String OS_Android::get_resource_dir() const {
+#ifdef TOOLS_ENABLED
+ return ProjectSettings::get_singleton()->get_resource_path();
+#else
return "/"; //android has its own filesystem for resources inside the APK
+#endif
}
String OS_Android::get_locale() const {
@@ -286,6 +300,10 @@ void OS_Android::vibrate_handheld(int p_duration_ms) {
godot_java->vibrate(p_duration_ms);
}
+String OS_Android::get_config_path() const {
+ return "/sdcard/godot";
+}
+
bool OS_Android::_check_internal_feature_support(const String &p_feature) {
if (p_feature == "mobile") {
return true;
@@ -335,5 +353,24 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god
DisplayServerAndroid::register_android_driver();
}
+Error OS_Android::create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id) {
+ if (p_path == "/system/bin/app_process64") {
+ String activity = "org.godotengine.editor.GodotGame";
+ const List::Element *arg_pointer = p_arguments.front();
+ while (arg_pointer) {
+ if (arg_pointer->get() == "--editor") {
+ activity = "org.godotengine.editor.GodotEditor";
+ break;
+ } else {
+ arg_pointer = arg_pointer->next();
+ }
+ }
+ godot_java->call_intent_with_command_line_args(activity, p_arguments);
+ return OK;
+ } else {
+ return OS_Unix::create_process(p_path, p_arguments, r_child_id);
+ }
+}
+
OS_Android::~OS_Android() {
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index f523f172c691..df24178e6834 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -121,6 +121,10 @@ class OS_Android : public OS_Unix {
void vibrate_handheld(int p_duration_ms) override;
+ virtual String get_config_path() const override;
+
+ virtual Error create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id) override;
+
virtual bool _check_internal_feature_support(const String &p_feature) override;
OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion);
~OS_Android();