summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/api/java_class_wrapper.h6
-rw-r--r--platform/android/api/jni_singleton.h4
-rw-r--r--platform/android/detect.py7
-rw-r--r--platform/android/export/export_plugin.cpp10
-rw-r--r--platform/android/export/export_plugin.h2
-rw-r--r--platform/android/java_class_wrapper.cpp4
-rw-r--r--platform/android/tts_android.cpp6
-rw-r--r--platform/android/tts_android.h2
8 files changed, 23 insertions, 18 deletions
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index 96b7b48e48..ac8d6585d3 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -63,7 +63,7 @@ class JavaClass : public RefCounted {
ARG_TYPE_MASK = (1 << 16) - 1
};
- Map<StringName, Variant> constant_map;
+ RBMap<StringName, Variant> constant_map;
struct MethodInfo {
bool _static = false;
@@ -174,7 +174,7 @@ class JavaClass : public RefCounted {
bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret);
friend class JavaClassWrapper;
- Map<StringName, List<MethodInfo>> methods;
+ HashMap<StringName, List<MethodInfo>> methods;
jclass _class;
#endif
@@ -207,7 +207,7 @@ class JavaClassWrapper : public Object {
GDCLASS(JavaClassWrapper, Object);
#ifdef ANDROID_ENABLED
- Map<String, Ref<JavaClass>> class_cache;
+ RBMap<String, Ref<JavaClass>> class_cache;
friend class JavaClass;
jclass activityClass;
jmethodID findClass;
diff --git a/platform/android/api/jni_singleton.h b/platform/android/api/jni_singleton.h
index 74ca10e5e2..8a0e021157 100644
--- a/platform/android/api/jni_singleton.h
+++ b/platform/android/api/jni_singleton.h
@@ -48,13 +48,13 @@ class JNISingleton : public Object {
};
jobject instance;
- Map<StringName, MethodData> method_map;
+ RBMap<StringName, MethodData> method_map;
#endif
public:
virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override {
#ifdef ANDROID_ENABLED
- Map<StringName, MethodData>::Element *E = method_map.find(p_method);
+ RBMap<StringName, MethodData>::Element *E = method_map.find(p_method);
// Check the method we're looking for is in the JNISingleton map and that
// the arguments match.
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 3319d5890c..0099ac7e0d 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -188,8 +188,11 @@ def configure(env):
if env["target"].startswith("release"):
if env["optimize"] == "speed": # optimize for speed (default)
- env.Append(LINKFLAGS=["-O2"])
- env.Append(CCFLAGS=["-O2", "-fomit-frame-pointer"])
+ # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
+ # when using `target=release_debug`.
+ opt = "-O3" if env["target"] == "release" else "-O2"
+ env.Append(LINKFLAGS=[opt])
+ env.Append(CCFLAGS=[opt, "-fomit-frame-pointer"])
elif env["optimize"] == "size": # optimize for size
env.Append(CCFLAGS=["-Os"])
env.Append(LINKFLAGS=["-Os"])
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index d357cd586e..a893571e54 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -2775,7 +2775,8 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
return ERR_FILE_BAD_PATH;
}
- zlib_filefunc_def io = zipio_create_io();
+ Ref<FileAccess> io_fa;
+ zlib_filefunc_def io = zipio_create_io(&io_fa);
if (ep.step(TTR("Creating APK..."), 0)) {
return ERR_SKIP;
@@ -2789,7 +2790,8 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
int ret = unzGoToFirstFile(pkg);
- zlib_filefunc_def io2 = zipio_create_io();
+ Ref<FileAccess> io2_fa;
+ zlib_filefunc_def io2 = zipio_create_io(&io2_fa);
String tmp_unaligned_path = EditorPaths::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned." + uitos(OS::get_singleton()->get_unix_time()) + ".apk");
@@ -2985,7 +2987,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
ret = unzGoToFirstFile(tmp_unaligned);
- io2 = zipio_create_io();
+ io2 = zipio_create_io(&io2_fa);
zipFile final_apk = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io2);
// Take files from the unaligned APK and write them out to the aligned one
@@ -3065,7 +3067,7 @@ void EditorExportPlatformAndroid::get_platform_features(List<String> *r_features
r_features->push_back("android");
}
-void EditorExportPlatformAndroid::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) {
+void EditorExportPlatformAndroid::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, RBSet<String> &p_features) {
}
EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h
index 0f267cf13a..c857850007 100644
--- a/platform/android/export/export_plugin.h
+++ b/platform/android/export/export_plugin.h
@@ -228,7 +228,7 @@ public:
virtual void get_platform_features(List<String> *r_features) override;
- virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) override;
+ virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, RBSet<String> &p_features) override;
EditorExportPlatformAndroid();
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 1805807f90..349c3a3ab3 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -34,7 +34,7 @@
#include "thread_jandroid.h"
bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret) {
- Map<StringName, List<MethodInfo>>::Element *M = methods.find(p_method);
+ HashMap<StringName, List<MethodInfo>>::Iterator M = methods.find(p_method);
if (!M) {
return false;
}
@@ -43,7 +43,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
ERR_FAIL_COND_V(env == nullptr, false);
MethodInfo *method = nullptr;
- for (MethodInfo &E : M->get()) {
+ for (MethodInfo &E : M->value) {
if (!p_instance && !E._static) {
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
continue;
diff --git a/platform/android/tts_android.cpp b/platform/android/tts_android.cpp
index 528878f14e..d3f3773344 100644
--- a/platform/android/tts_android.cpp
+++ b/platform/android/tts_android.cpp
@@ -46,7 +46,7 @@ jmethodID TTS_Android::_pause_speaking = 0;
jmethodID TTS_Android::_resume_speaking = 0;
jmethodID TTS_Android::_stop_speaking = 0;
-Map<int, Char16String> TTS_Android::ids;
+HashMap<int, Char16String> TTS_Android::ids;
void TTS_Android::setup(jobject p_tts) {
JNIEnv *env = get_jni_env();
@@ -175,8 +175,8 @@ void TTS_Android::resume() {
}
void TTS_Android::stop() {
- for (Map<int, Char16String>::Element *E = ids.front(); E; E = E->next()) {
- DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, E->key());
+ for (const KeyValue<int, Char16String> &E : ids) {
+ DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, E.key);
}
ids.clear();
diff --git a/platform/android/tts_android.h b/platform/android/tts_android.h
index efeed94856..bc0cdb8d55 100644
--- a/platform/android/tts_android.h
+++ b/platform/android/tts_android.h
@@ -49,7 +49,7 @@ class TTS_Android {
static jmethodID _resume_speaking;
static jmethodID _stop_speaking;
- static Map<int, Char16String> ids;
+ static HashMap<int, Char16String> ids;
public:
static void setup(jobject p_tts);