summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/AndroidManifest.xml.template7
-rw-r--r--platform/android/SCsub20
-rw-r--r--platform/android/audio_driver_jandroid.cpp24
-rw-r--r--platform/android/audio_driver_opensl.cpp3
-rw-r--r--platform/android/build.gradle.template1
-rw-r--r--platform/android/detect.py19
-rw-r--r--platform/android/dir_access_jandroid.cpp15
-rw-r--r--platform/android/export/export.cpp34
-rw-r--r--platform/android/file_access_jandroid.cpp27
-rw-r--r--platform/android/godot_android.cpp16
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java10
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java8
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java50
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java23
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java28
-rw-r--r--platform/android/java_class_wrapper.cpp8
-rw-r--r--platform/android/java_glue.cpp93
-rw-r--r--platform/android/os_android.cpp53
-rw-r--r--platform/android/os_android.h1
20 files changed, 130 insertions, 314 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index 9d8eb951c4..13d10b5026 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -16,7 +16,8 @@
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:screenOrientation="landscape"
- android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize">
+ android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"
+ android:resizeableActivity="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -31,7 +32,7 @@
$$ADD_APPLICATION_CHUNKS$$
</application>
- <uses-feature android:glEsVersion="0x00030000"/>
+ <uses-feature android:glEsVersion="0x00030000" android:required="true" />
$$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.ACCESS_CHECKIN_PROPERTIES"/>
@@ -200,6 +201,6 @@ $$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.custom.18"/>
<uses-permission android:name="godot.custom.19"/>
-<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="23"/>
+<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="27"/>
</manifest>
diff --git a/platform/android/SCsub b/platform/android/SCsub
index d2285a82dd..8c08289932 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -41,10 +41,8 @@ prog = None
abspath = env.Dir(".").abspath
-gradle_basein = open_utf8(abspath + "/build.gradle.template", "r")
-gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w")
-
-gradle_text = gradle_basein.read()
+with open_utf8(abspath + "/build.gradle.template", "r") as gradle_basein:
+ gradle_text = gradle_basein.read()
gradle_maven_flat_text = ""
if len(env.android_flat_dirs) > 0:
@@ -131,17 +129,19 @@ gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_co
gradle_text = gradle_text.replace("$$GRADLE_PLUGINS$$", gradle_plugins)
gradle_text = gradle_text.replace("$$GRADLE_CLASSPATH$$", gradle_classpath)
-gradle_baseout.write(gradle_text)
-gradle_baseout.close()
+with open_utf8(abspath + "/java/build.gradle", "w") as gradle_baseout:
+ gradle_baseout.write(gradle_text)
+
+with open_utf8(abspath + "/AndroidManifest.xml.template", "r") as pp_basein:
+ manifest = pp_basein.read()
-pp_basein = open_utf8(abspath + "/AndroidManifest.xml.template", "r")
-pp_baseout = open_utf8(abspath + "/java/AndroidManifest.xml", "w")
-manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk)
-pp_baseout.write(manifest)
+
+with open_utf8(abspath + "/java/AndroidManifest.xml", "w") as pp_baseout:
+ pp_baseout.write(manifest)
lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 7545ee88d0..3d80e76707 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -86,7 +86,6 @@ Error AudioDriverAndroid::init() {
print_line("audio buffer size: " + itos(buffer_size));
}
- __android_log_print(ANDROID_LOG_INFO, "godot", "Initializing audio! params: %i,%i ", mix_rate, buffer_size);
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
ERR_FAIL_COND_V(audioBuffer == NULL, ERR_INVALID_PARAMETER);
@@ -113,29 +112,10 @@ void AudioDriverAndroid::setup(jobject p_io) {
jclass c = env->GetObjectClass(io);
cls = (jclass)env->NewGlobalRef(c);
- __android_log_print(ANDROID_LOG_INFO, "godot", "starting to attempt get methods");
-
_init_audio = env->GetMethodID(cls, "audioInit", "(II)Ljava/lang/Object;");
- if (_init_audio != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _init_audio ok!!");
- } else {
- __android_log_print(ANDROID_LOG_INFO, "godot", "audioinit ok!");
- }
-
_write_buffer = env->GetMethodID(cls, "audioWriteShortBuffer", "([S)V");
- if (_write_buffer != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _write_buffer ok!!");
- }
-
_quit = env->GetMethodID(cls, "audioQuit", "()V");
- if (_quit != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _quit ok!!");
- }
-
_pause = env->GetMethodID(cls, "audioPause", "(Z)V");
- if (_quit != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _pause ok!!");
- }
}
void AudioDriverAndroid::thread_func(JNIEnv *env) {
@@ -144,7 +124,6 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
if (cls) {
cls = (jclass)env->NewGlobalRef(cls);
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******CLASS FOUND!!!");
}
jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;");
jobject ob = env->GetStaticObjectField(cls, fid);
@@ -152,9 +131,6 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
jclass c = env->GetObjectClass(gob);
jclass lcls = (jclass)env->NewGlobalRef(c);
_write_buffer = env->GetMethodID(lcls, "audioWriteShortBuffer", "([S)V");
- if (_write_buffer != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _write_buffer ok!!");
- }
while (!quit) {
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index 87a7d04e01..e6bd3ff253 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -117,8 +117,6 @@ Error AudioDriverOpenSL::init() {
ERR_FAIL_V(ERR_INVALID_PARAMETER);
}
- print_line("OpenSL Init OK!");
-
return OK;
}
@@ -273,4 +271,5 @@ AudioDriverOpenSL::AudioDriverOpenSL() {
s_ad = this;
mutex = Mutex::create(); //NULL;
pause = false;
+ active = false;
}
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 7269e658b4..cc45fee95f 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -21,7 +21,6 @@ allprojects {
}
dependencies {
- compile 'com.android.support:support-v4:27.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
$$GRADLE_DEPENDENCIES$$
}
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 892b1b6a85..971368db17 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -14,10 +14,13 @@ def get_name():
def can_build():
-
return ("ANDROID_NDK_ROOT" in os.environ)
+def get_platform(platform):
+ return int(platform.split("-")[1])
+
+
def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
@@ -124,6 +127,9 @@ def configure(env):
else:
env.extra_suffix = ".armv7" + env.extra_suffix
elif env["android_arch"] == "arm64v8":
+ if get_platform(env["ndk_platform"]) < 21:
+ print("WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than andorid-21; setting ndk_platform=android-21")
+ env["ndk_platform"] = "android-21"
env['ARCH'] = 'arch-arm64'
target_subpath = "aarch64-linux-android-4.9"
abi_subpath = "aarch64-linux-android"
@@ -160,12 +166,13 @@ def configure(env):
elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')):
host_subpath = "windows-x86_64"
- if env["android_arch"] == "arm64v8":
- mt_link = False
else:
mt_link = False
host_subpath = "windows"
+ if env["android_arch"] == "arm64v8":
+ mt_link = False
+
compiler_path = env["ANDROID_NDK_ROOT"] + "/toolchains/llvm/prebuilt/" + host_subpath + "/bin"
gcc_toolchain_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + target_subpath + "/prebuilt/" + host_subpath
tools_path = gcc_toolchain_path + "/" + abi_subpath + "/bin"
@@ -199,7 +206,7 @@ def configure(env):
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include"])
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
# For unified headers this define has to be set manually
- env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(int(env['ndk_platform'].split("-")[1]))])
+ env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(get_platform(env['ndk_platform']))])
else:
print("Using NDK deprecated headers")
env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"])
@@ -254,10 +261,10 @@ def configure(env):
env.Append(LINKFLAGS=target_opts)
env.Append(LINKFLAGS=common_opts)
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/arm-linux-androideabi-4.9/prebuilt/' +
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/' + target_subpath + '/prebuilt/' +
host_subpath + '/lib/gcc/' + abi_subpath + '/4.9.x'])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
- '/toolchains/arm-linux-androideabi-4.9/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
+ '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
env.Append(CPPPATH=['#platform/android'])
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT'])
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 5601dcc763..3e40b59de9 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -130,7 +130,6 @@ Error DirAccessJAndroid::change_dir(String p_dir) {
else
new_dir = current_dir.plus_file(p_dir);
- //print_line("new dir is: "+new_dir);
//test if newdir exists
new_dir = new_dir.simplify_path();
@@ -226,28 +225,14 @@ void DirAccessJAndroid::setup(jobject p_io) {
JNIEnv *env = ThreadAndroid::get_env();
io = p_io;
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP7");
jclass c = env->GetObjectClass(io);
cls = (jclass)env->NewGlobalRef(c);
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP8");
_dir_open = env->GetMethodID(cls, "dir_open", "(Ljava/lang/String;)I");
- if (_dir_open != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_open ok!!");
- }
_dir_next = env->GetMethodID(cls, "dir_next", "(I)Ljava/lang/String;");
- if (_dir_next != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_next ok!!");
- }
_dir_close = env->GetMethodID(cls, "dir_close", "(I)V");
- if (_dir_close != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_close ok!!");
- }
_dir_is_dir = env->GetMethodID(cls, "dir_is_dir", "(I)Z");
- if (_dir_is_dir != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_is_dir ok!!");
- }
//(*env)->CallVoidMethod(env,obj,aMethodID, myvar);
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 2a61f8d873..6fe137a386 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -257,7 +257,7 @@ class EditorExportAndroid : public EditorExportPlatform {
if (dpos == -1)
continue;
d = d.substr(0, dpos).strip_edges();
- //print_line("found devuce: "+d);
+ //print_line("found device: "+d);
ldevices.push_back(d);
}
@@ -301,8 +301,7 @@ class EditorExportAndroid : public EditorExportPlatform {
args.push_back("-s");
args.push_back(d.id);
args.push_back("shell");
- args.push_back("cat");
- args.push_back("/system/build.prop");
+ args.push_back("getprop");
int ec;
String dp;
@@ -315,7 +314,14 @@ class EditorExportAndroid : public EditorExportPlatform {
d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
+ // got information by `shell cat /system/build.prop` before and its format is "property=value"
+ // it's now changed to use `shell getporp` because of permission issue with Android 8.0 and above
+ // its format is "[property]: [value]" so changed it as like build.prop
String p = props[j];
+ p = p.replace("]: ", "=");
+ p = p.replace("[", "");
+ p = p.replace("]", "");
+
if (p.begins_with("ro.product.model=")) {
device = p.get_slice("=", 1).strip_edges();
} else if (p.begins_with("ro.product.brand=")) {
@@ -996,7 +1002,7 @@ public:
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
- // Reenable when a GLES 2.0 backend is readded
+ // Re-enable when a GLES 2.0 backend is read
/*int api = p_preset->get("graphics/api");
if (api == 0)
r_features->push_back("etc");
@@ -1147,7 +1153,7 @@ public:
String package_name = p_preset->get("package/unique_name");
if (remove_prev) {
- ep.step("Uninstalling..", 1);
+ ep.step("Uninstalling...", 1);
print_line("Uninstalling previous version: " + devices[p_device].name);
@@ -1226,7 +1232,7 @@ public:
}
}
- ep.step("Running on Device..", 3);
+ ep.step("Running on Device...", 3);
args.clear();
args.push_back("-s");
args.push_back(devices[p_device].id);
@@ -1317,6 +1323,8 @@ public:
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+
String src_apk;
EditorProgress ep("export", "Exporting for Android", 105);
@@ -1484,7 +1492,7 @@ public:
ret = unzGoToNextFile(pkg);
}
- ep.step("Adding Files..", 1);
+ ep.step("Adding Files...", 1);
Error err = OK;
Vector<String> cl = cmdline.strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -1618,14 +1626,14 @@ public:
password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass");
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
- ep.step("Signing Debug APK..", 103);
+ ep.step("Signing Debug APK...", 103);
} else {
keystore = release_keystore;
password = release_password;
user = release_username;
- ep.step("Signing Release APK..", 103);
+ ep.step("Signing Release APK...", 103);
}
if (!FileAccess::exists(keystore)) {
@@ -1635,9 +1643,9 @@ public:
List<String> args;
args.push_back("-digestalg");
- args.push_back("SHA1");
+ args.push_back("SHA-256");
args.push_back("-sigalg");
- args.push_back("MD5withRSA");
+ args.push_back("SHA256withRSA");
String tsa_url = EditorSettings::get_singleton()->get("export/android/timestamping_authority_url");
if (tsa_url != "") {
args.push_back("-tsa");
@@ -1657,7 +1665,7 @@ public:
return ERR_CANT_CREATE;
}
- ep.step("Verifying APK..", 104);
+ ep.step("Verifying APK...", 104);
args.clear();
args.push_back("-verify");
@@ -1677,7 +1685,7 @@ public:
static const int ZIP_ALIGNMENT = 4;
- ep.step("Aligning APK..", 105);
+ ep.step("Aligning APK...", 105);
unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index 1a9d3af4ea..214e273d9b 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -190,43 +190,16 @@ void FileAccessJAndroid::setup(jobject p_io) {
io = p_io;
JNIEnv *env = ThreadAndroid::get_env();
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP5");
-
jclass c = env->GetObjectClass(io);
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP6");
cls = (jclass)env->NewGlobalRef(c);
_file_open = env->GetMethodID(cls, "file_open", "(Ljava/lang/String;Z)I");
- if (_file_open != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_open ok!!");
- }
_file_get_size = env->GetMethodID(cls, "file_get_size", "(I)I");
- if (_file_get_size != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_get_size ok!!");
- }
_file_tell = env->GetMethodID(cls, "file_tell", "(I)I");
- if (_file_tell != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_tell ok!!");
- }
_file_eof = env->GetMethodID(cls, "file_eof", "(I)Z");
-
- if (_file_eof != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_eof ok!!");
- }
_file_seek = env->GetMethodID(cls, "file_seek", "(II)V");
- if (_file_seek != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_seek ok!!");
- }
_file_read = env->GetMethodID(cls, "file_read", "(II)[B");
- if (_file_read != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_read ok!!");
- }
_file_close = env->GetMethodID(cls, "file_close", "(I)V");
- if (_file_close != 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_close ok!!");
- }
-
- //(*env)->CallVoidMethod(env,obj,aMethodID, myvar);
}
FileAccessJAndroid::FileAccessJAndroid() {
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 64715b3683..0e5f4fb93a 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -76,14 +76,11 @@ public:
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
- print_line("attempt to call " + String(p_method));
-
r_error.error = Variant::CallError::CALL_OK;
Map<StringName, MethodData>::Element *E = method_map.find(p_method);
if (!E) {
- print_line("no exists");
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
return Variant();
}
@@ -91,7 +88,6 @@ public:
int ac = E->get().argtypes.size();
if (ac < p_argcount) {
- print_line("fewargs");
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = ac;
return Variant();
@@ -99,7 +95,6 @@ public:
if (ac > p_argcount) {
- print_line("manyargs");
r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = ac;
return Variant();
@@ -181,26 +176,21 @@ public:
}
}
- print_line("calling method!!");
-
Variant ret;
switch (E->get().ret_type) {
case Variant::NIL: {
- print_line("call void");
env->CallVoidMethodA(instance, E->get().method, v);
} break;
case Variant::BOOL: {
ret = env->CallBooleanMethodA(instance, E->get().method, v);
- print_line("call bool");
} break;
case Variant::INT: {
ret = env->CallIntMethodA(instance, E->get().method, v);
- print_line("call int");
} break;
case Variant::REAL: {
@@ -255,13 +245,10 @@ public:
} break;
default: {
- print_line("failure..");
ERR_FAIL_V(Variant());
} break;
}
- print_line("success");
-
return ret;
}
@@ -389,7 +376,6 @@ static int engine_init_display(struct engine *engine, bool p_gl2) {
eglQuerySurface(display, surface, EGL_WIDTH, &w);
eglQuerySurface(display, surface, EGL_HEIGHT, &h);
- print_line("INIT VIDEO MODE: " + itos(w) + "," + itos(h));
//engine->os->set_egl_extensions(eglQueryString(display,EGL_EXTENSIONS));
engine->os->init_video_mode(w, h);
@@ -942,7 +928,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
if (!mid) {
- print_line("FAILED GETTING METHOID " + mname);
+ print_line("FAILED GETTING METHOD ID " + mname);
}
s->add_method(mname, mid, types, get_jni_type(retval));
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
index 73e6f83bec..a9f674803c 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
@@ -27,7 +27,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Messenger;
-import android.support.v4.app.NotificationCompat;
/**
* This class handles displaying the notification associated with the download
@@ -49,9 +48,8 @@ public class DownloadNotification implements IDownloaderClient {
private IDownloaderClient mClientProxy;
final ICustomNotification mCustomNotification;
- // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
- private NotificationCompat.Builder mNotificationBuilder;
- private NotificationCompat.Builder mCurrentNotificationBuilder;
+ private Notification.Builder mNotificationBuilder;
+ private Notification.Builder mCurrentNotificationBuilder;
private CharSequence mLabel;
private String mCurrentText;
private PendingIntent mContentIntent;
@@ -187,7 +185,7 @@ public class DownloadNotification implements IDownloaderClient {
void setTimeRemaining(long timeRemaining);
- NotificationCompat.Builder updateNotification(Context c);
+ Notification.Builder updateNotification(Context c);
}
/**
@@ -220,7 +218,7 @@ public class DownloadNotification implements IDownloaderClient {
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mCustomNotification = CustomNotificationFactory
.createCustomNotification();
- mNotificationBuilder = new NotificationCompat.Builder(ctx);
+ mNotificationBuilder = new Notification.Builder(ctx);
mCurrentNotificationBuilder = mNotificationBuilder;
}
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
index 390bde96e9..56b2331e31 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
@@ -22,7 +22,6 @@ import com.google.android.vending.expansion.downloader.Helpers;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
-import android.support.v4.app.NotificationCompat;
public class V14CustomNotification implements DownloadNotification.ICustomNotification {
@@ -54,14 +53,13 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi
mCurrentKB = currentBytes;
}
- void setProgress(NotificationCompat.Builder builder) {
+ void setProgress(Notification.Builder builder) {
}
@Override
- public NotificationCompat.Builder updateNotification(Context c) {
- // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
- NotificationCompat.Builder builder = new NotificationCompat.Builder(c);
+ public Notification.Builder updateNotification(Context c) {
+ Notification.Builder builder = new Notification.Builder(c);
builder.setContentTitle(mTitle);
if (mTotalKB > 0 && -1 != mCurrentKB) {
builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false);
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index b5b0afb9e0..90848e6a90 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -150,21 +150,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
boolean found = false;
- Log.d("XXX", "METHOD: %s\n" + method.getName());
for (String s : p_methods) {
- Log.d("XXX", "METHOD CMP WITH: %s\n" + s);
if (s.equals(method.getName())) {
found = true;
- Log.d("XXX", "METHOD CMP VALID");
break;
}
}
if (!found)
continue;
- Log.d("XXX", "METHOD FOUND: %s\n" + method.getName());
-
List<String> ptr = new ArrayList<String>();
Class[] paramTypes = method.getParameterTypes();
@@ -281,7 +276,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
godot.mView.getWindowVisibleDisplayFrame(gameSize);
final int keyboardHeight = fullSize.y - gameSize.bottom;
- Log.d("GODOT", "setVirtualKeyboardHeight: " + keyboardHeight);
GodotLib.setVirtualKeyboardHeight(keyboardHeight);
}
});
@@ -351,8 +345,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
byte[] len = new byte[4];
int r = is.read(len);
if (r < 4) {
- Log.d("XXX", "**ERROR** Wrong cmdline length.\n");
- Log.d("GODOT", "**ERROR** Wrong cmdline length.\n");
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));
@@ -362,12 +354,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
r = is.read(len);
if (r < 4) {
- Log.d("GODOT", "**ERROR** Wrong cmdline param length.\n");
return new String[0];
}
int strlen = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
if (strlen > 65535) {
- Log.d("GODOT", "**ERROR** Wrong command len\n");
return new String[0];
}
byte[] arg = new byte[strlen];
@@ -379,7 +369,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
return cmdline;
} catch (Exception e) {
e.printStackTrace();
- Log.d("GODOT", "**ERROR** Exception " + e.getClass().getName() + ":" + e.getMessage());
return new String[0];
}
}
@@ -393,18 +382,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
String[] new_cmdline;
int cll = 0;
if (command_line != null) {
- Log.d("GODOT", "initializeGodot: command_line: is not null");
new_cmdline = new String[command_line.length + 2];
cll = command_line.length;
for (int i = 0; i < command_line.length; i++) {
new_cmdline[i] = command_line[i];
}
} else {
- Log.d("GODOT", "initializeGodot: command_line: is null");
new_cmdline = new String[2];
}
- new_cmdline[cll] = "--main_pack";
+ new_cmdline[cll] = "--main-pack";
new_cmdline[cll + 1] = expansion_pack_path;
command_line = new_cmdline;
}
@@ -412,13 +399,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
io = new GodotIO(this);
io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
GodotLib.io = io;
- Log.d("GODOT", "command_line is null? " + ((command_line == null) ? "yes" : "no"));
- /*if(command_line != null){
- Log.d("GODOT", "Command Line:");
- for(int w=0;w <command_line.length;w++){
- Log.d("GODOT"," " + command_line[w]);
- }
- }*/
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
@@ -447,8 +427,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
@Override
protected void onCreate(Bundle icicle) {
- Log.d("GODOT", "** GODOT ACTIVITY CREATED HERE ***\n");
-
super.onCreate(icicle);
_self = this;
Window window = getWindow();
@@ -509,7 +487,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
//check that environment is ok!
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
- Log.d("GODOT", "**ERROR! No media mounted!");
//show popup and die
}
@@ -524,25 +501,20 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
File f = new File(expansion_pack_path);
boolean pack_valid = true;
- Log.d("GODOT", "**PACK** - Path " + expansion_pack_path);
if (!f.exists()) {
pack_valid = false;
- Log.d("GODOT", "**PACK** - File does not exist");
} else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
- Log.d("GODOT", "**PACK** - Expansion pack (obb) is corrupted");
pack_valid = false;
try {
f.delete();
} catch (Exception e) {
- Log.d("GODOT", "**PACK** - Error deleting corrupted expansion pack (obb)");
}
}
if (!pack_valid) {
- Log.d("GODOT", "Pack Invalid, try re-downloading.");
Intent notifierIntent = new Intent(this, this.getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
@@ -553,15 +525,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
int startResult;
try {
- Log.d("GODOT", "INITIALIZING DOWNLOAD");
startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(
getApplicationContext(),
pendingIntent,
GodotDownloaderService.class);
- Log.d("GODOT", "DOWNLOAD SERVICE FINISHED:" + startResult);
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
- Log.d("GODOT", "DOWNLOAD REQUIRED");
// This is where you do set up to display the download
// progress (next step)
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this,
@@ -581,11 +550,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
return;
} else {
- Log.d("GODOT", "NO DOWNLOAD REQUIRED");
}
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
- Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
}
}
}
@@ -763,7 +730,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
}
- System.out.printf("** BACK REQUEST!\n");
if (shouldQuit && mView != null) {
mView.queueEvent(new Runnable() {
@Override
@@ -812,15 +778,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
String md5str = hexString.toString();
- //Log.d("GODOT","**PACK** - My MD5: "+hexString+" - APK md5: "+main_pack_md5);
if (!md5str.equals(main_pack_md5)) {
- Log.d("GODOT", "**PACK MD5 MISMATCH???** - MD5 Found: " + md5str + " " + Integer.toString(md5str.length()) + " - MD5 Expected: " + main_pack_md5 + " " + Integer.toString(main_pack_md5.length()));
return true;
}
return false;
} catch (Exception e) {
e.printStackTrace();
- Log.d("GODOT", "**PACK FAIL**");
return true;
}
}
@@ -936,7 +899,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
*/
@Override
public void onDownloadStateChanged(int newState) {
- Log.d("GODOT", "onDownloadStateChanged:" + newState);
setState(newState);
boolean showDashboard = true;
boolean showCellMessage = false;
@@ -944,7 +906,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
boolean indeterminate;
switch (newState) {
case IDownloaderClient.STATE_IDLE:
- Log.d("GODOT", "DOWNLOAD STATE IDLE");
// STATE_IDLE means the service is listening, so it's
// safe to start making calls via mRemoteService.
paused = false;
@@ -952,13 +913,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
break;
case IDownloaderClient.STATE_CONNECTING:
case IDownloaderClient.STATE_FETCHING_URL:
- Log.d("GODOT", "DOWNLOAD STATE CONNECTION / FETCHING URL");
showDashboard = true;
paused = false;
indeterminate = true;
break;
case IDownloaderClient.STATE_DOWNLOADING:
- Log.d("GODOT", "DOWNLOAD STATE DOWNLOADING");
paused = false;
showDashboard = true;
indeterminate = false;
@@ -968,14 +927,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
case IDownloaderClient.STATE_FAILED:
case IDownloaderClient.STATE_FAILED_FETCHING_URL:
case IDownloaderClient.STATE_FAILED_UNLICENSED:
- Log.d("GODOT", "DOWNLOAD STATE: FAILED, CANCELLED, UNLICENSED OR FAILED TO FETCH URL");
paused = true;
showDashboard = false;
indeterminate = false;
break;
case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
- Log.d("GODOT", "DOWNLOAD STATE: PAUSED BY MISSING CELLULAR PERMISSION");
showDashboard = false;
paused = true;
indeterminate = false;
@@ -983,26 +940,21 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
break;
case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
- Log.d("GODOT", "DOWNLOAD STATE: PAUSED BY USER");
paused = true;
indeterminate = false;
break;
case IDownloaderClient.STATE_PAUSED_ROAMING:
case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
- Log.d("GODOT", "DOWNLOAD STATE: PAUSED BY ROAMING OR SDCARD UNAVAILABLE");
paused = true;
indeterminate = false;
break;
case IDownloaderClient.STATE_COMPLETED:
- Log.d("GODOT", "DOWNLOAD STATE: COMPLETED");
showDashboard = false;
paused = false;
indeterminate = false;
- // validateXAPKZipFiles();
initializeGodot();
return;
default:
- Log.d("GODOT", "DOWNLOAD STATE: DEFAULT");
paused = true;
indeterminate = true;
showDashboard = true;
diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
index 6b7f7a283e..bde4221644 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
@@ -67,7 +67,7 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
public GodotPaymentV3(Activity p_activity) {
- registerClass("GodotPayments", new String[] { "purchase", "setPurchaseCallbackId", "setPurchaseValidationUrlPrefix", "setTransactionId", "getSignature", "consumeUnconsumedPurchases", "requestPurchased", "setAutoConsume", "consume", "querySkuDetails" });
+ registerClass("GodotPayments", new String[] { "purchase", "setPurchaseCallbackId", "setPurchaseValidationUrlPrefix", "setTransactionId", "getSignature", "consumeUnconsumedPurchases", "requestPurchased", "setAutoConsume", "consume", "querySkuDetails", "isConnected" });
activity = (Godot)p_activity;
mPaymentManager = activity.getPaymentsManager();
mPaymentManager.setBaseSingleton(this);
@@ -101,12 +101,12 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
GodotLib.calldeferred(purchaseCallbackId, "consume_not_required", new Object[] {});
}
- public void callbackFailConsume() {
- GodotLib.calldeferred(purchaseCallbackId, "consume_fail", new Object[] {});
+ public void callbackFailConsume(String message) {
+ GodotLib.calldeferred(purchaseCallbackId, "consume_fail", new Object[] { message });
}
- public void callbackFail() {
- GodotLib.calldeferred(purchaseCallbackId, "purchase_fail", new Object[] {});
+ public void callbackFail(String message) {
+ GodotLib.calldeferred(purchaseCallbackId, "purchase_fail", new Object[] { message });
}
public void callbackCancel() {
@@ -164,6 +164,19 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
GodotLib.calldeferred(purchaseCallbackId, "has_purchased", new Object[] { receipt, signature, sku });
}
+ public void callbackDisconnected() {
+ GodotLib.calldeferred(purchaseCallbackId, "iap_disconnected", new Object[] {});
+ }
+
+ public void callbackConnected() {
+ GodotLib.calldeferred(purchaseCallbackId, "iap_connected", new Object[] {});
+ }
+
+ // true if connected, false otherwise
+ public boolean isConnected() {
+ return mPaymentManager.isConnected();
+ }
+
// consume item automatically after purchase. default is true.
public void setAutoConsume(boolean autoConsume) {
mPaymentManager.setAutoConsume(autoConsume);
diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java
index 0222758c2b..23723c2696 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotView.java
@@ -261,7 +261,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
};
int source = event.getSource();
- if ((source & InputDevice.SOURCE_JOYSTICK) != 0 || (source & InputDevice.SOURCE_DPAD) != 0 || (source & InputDevice.SOURCE_GAMEPAD) != 0) {
+ if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
final int button = get_godot_button(keyCode);
final int device = find_joy_device(event.getDeviceId());
@@ -302,7 +302,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
int source = event.getSource();
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
- if ((source & InputDevice.SOURCE_JOYSTICK) != 0 || (source & InputDevice.SOURCE_DPAD) != 0 || (source & InputDevice.SOURCE_GAMEPAD) != 0) {
+ if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
if (event.getRepeatCount() > 0) // ignore key echo
return true;
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
index da6d66ae88..b7bf2362cc 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -93,11 +93,21 @@ public class PaymentsManager {
@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
+
+ // At this stage, godotPaymentV3 might not have been initialized yet.
+ if (godotPaymentV3 != null) {
+ godotPaymentV3.callbackDisconnected();
+ }
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
+
+ // At this stage, godotPaymentV3 might not have been initialized yet.
+ if (godotPaymentV3 != null) {
+ godotPaymentV3.callbackConnected();
+ }
}
};
@@ -106,7 +116,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -123,6 +133,10 @@ public class PaymentsManager {
.purchase(sku, transactionId);
}
+ public boolean isConnected() {
+ return mService != null;
+ }
+
public void consumeUnconsumedPurchases() {
new ReleaseAllConsumablesTask(mService, activity) {
@@ -134,7 +148,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
Log.d("godot", "consumeUnconsumedPurchases :" + message);
- godotPaymentV3.callbackFailConsume();
+ godotPaymentV3.callbackFailConsume(message);
}
@Override
@@ -208,7 +222,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
}
.consume(sku);
@@ -217,7 +231,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -244,7 +258,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
}
.consume(sku);
@@ -252,7 +266,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -277,7 +291,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFailConsume();
+ godotPaymentV3.callbackFailConsume(message);
}
}
.consume(sku);
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 80a32452a5..446a5911e5 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -1117,7 +1117,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
}
if (!valid) {
- print_line("Method Can't be bound (unsupported arguments): " + p_class + "::" + str_method);
+ print_line("Method can't be bound (unsupported arguments): " + p_class + "::" + str_method);
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
continue;
@@ -1130,7 +1130,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
String strsig;
uint32_t sig = 0;
if (!_get_type_sig(env, return_type, sig, strsig)) {
- print_line("Method Can't be bound (unsupported return type): " + p_class + "::" + str_method);
+ print_line("Method can't be bound (unsupported return type): " + p_class + "::" + str_method);
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
env->DeleteLocalRef(return_type);
@@ -1140,8 +1140,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
signature += strsig;
mi.return_type = sig;
- print_line("METHOD: " + str_method + " SIG: " + signature + " static: " + itos(mi._static));
-
bool discard = false;
for (List<JavaClass::MethodInfo>::Element *E = java_class->methods[str_method].front(); E; E = E->next()) {
@@ -1173,11 +1171,9 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
if (new_likeliness > existing_likeliness) {
java_class->methods[str_method].erase(E);
- print_line("replace old");
break;
} else {
discard = true;
- print_line("old is better");
}
}
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 4e9e4f6260..579c06f76b 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -240,7 +240,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jclass c = env->GetObjectClass(obj);
bool array;
String name = _get_class_name(env, c, &array);
- //print_line("name is " + name + ", array "+Variant(array));
if (name == "java.lang.String") {
@@ -251,7 +250,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
jobjectArray arr = (jobjectArray)obj;
int stringCount = env->GetArrayLength(arr);
- //print_line("String array! " + String::num(stringCount));
PoolVector<String> sarr;
for (int i = 0; i < stringCount; i++) {
@@ -380,7 +378,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
Array vals = _jobject_to_variant(env, arr);
env->DeleteLocalRef(arr);
- //print_line("adding " + String::num(keys.size()) + " to Dictionary!");
for (int i = 0; i < keys.size(); i++) {
ret[keys[i]] = vals[i];
@@ -411,7 +408,6 @@ class JNISingleton : public Object {
public:
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
- //print_line("attempt to call "+String(p_method));
ERR_FAIL_COND_V(!instance, Variant());
r_error.error = Variant::CallError::CALL_OK;
@@ -419,7 +415,6 @@ public:
Map<StringName, MethodData>::Element *E = method_map.find(p_method);
if (!E) {
- print_line("no exists");
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
return Variant();
}
@@ -427,7 +422,6 @@ public:
int ac = E->get().argtypes.size();
if (ac < p_argcount) {
- print_line("fewargs");
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = ac;
return Variant();
@@ -435,7 +429,6 @@ public:
if (ac > p_argcount) {
- print_line("manyargs");
r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = ac;
return Variant();
@@ -464,7 +457,6 @@ public:
ERR_FAIL_COND_V(res != 0, Variant());
- //print_line("argcount "+String::num(p_argcount));
List<jobject> to_erase;
for (int i = 0; i < p_argcount; i++) {
@@ -474,26 +466,21 @@ public:
to_erase.push_back(vr.obj);
}
- //print_line("calling method!!");
-
Variant ret;
switch (E->get().ret_type) {
case Variant::NIL: {
- //print_line("call void");
env->CallVoidMethodA(instance, E->get().method, v);
} break;
case Variant::BOOL: {
ret = env->CallBooleanMethodA(instance, E->get().method, v) == JNI_TRUE;
- //print_line("call bool");
} break;
case Variant::INT: {
ret = env->CallIntMethodA(instance, E->get().method, v);
- //print_line("call int");
} break;
case Variant::REAL: {
@@ -544,7 +531,6 @@ public:
case Variant::DICTIONARY: {
- //print_line("call dictionary");
jobject obj = env->CallObjectMethodA(instance, E->get().method, v);
ret = _jobject_to_variant(env, obj);
env->DeleteLocalRef(obj);
@@ -552,7 +538,6 @@ public:
} break;
default: {
- print_line("failure..");
env->PopLocalFrame(NULL);
ERR_FAIL_V(Variant());
} break;
@@ -564,7 +549,6 @@ public:
}
env->PopLocalFrame(NULL);
- //print_line("success");
return ret;
}
@@ -757,8 +741,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHei
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jboolean p_need_reload_hook, jobject p_asset_manager, jboolean p_use_apk_expansion) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "**INIT EVENT! - %p\n", env);
-
initialized = true;
JavaVM *jvm;
@@ -767,8 +749,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
_godot_instance = env->NewGlobalRef(activity);
//_godot_instance=activity;
- __android_log_print(ANDROID_LOG_INFO, "godot", "***************** HELLO FROM JNI!!!!!!!!");
-
{
//setup IO Object
@@ -776,17 +756,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
if (cls) {
cls = (jclass)env->NewGlobalRef(cls);
- __android_log_print(ANDROID_LOG_INFO, "godot", "*******CLASS FOUND!!!");
}
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP2, %p", cls);
jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;");
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP3 %i", fid);
jobject ob = env->GetStaticObjectField(cls, fid);
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP4, %p", ob);
jobject gob = env->NewGlobalRef(ob);
- __android_log_print(ANDROID_LOG_INFO, "godot", "STEP4.5, %p", gob);
godot_io = gob;
_on_video_init = env->GetMethodID(cls, "onVideoInit", "(Z)V");
@@ -831,9 +806,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
char wd[500];
getcwd(wd, 500);
- __android_log_print(ANDROID_LOG_INFO, "godot", "test construction %i\n", tst.a);
- __android_log_print(ANDROID_LOG_INFO, "godot", "running from dir %s\n", wd);
-
//video driver is determined here, because once initialized, it can't be changed
// String vd = ProjectSettings::get_singleton()->get("display/driver");
@@ -843,7 +815,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
static void _initialize_java_modules() {
if (!ProjectSettings::get_singleton()->has_setting("android/modules")) {
- print_line("ANDROID MODULES: Nothing to load, aborting");
+ print_line("Android modules: Nothing to load, aborting");
return;
}
@@ -853,8 +825,6 @@ static void _initialize_java_modules() {
return;
}
Vector<String> mods = modules.split(",", false);
- print_line("ANDROID MODULES : " + modules);
- __android_log_print(ANDROID_LOG_INFO, "godot", "mod count: %i", mods.size());
if (mods.size()) {
@@ -877,7 +847,7 @@ static void _initialize_java_modules() {
String m = mods[i];
//jclass singletonClass = env->FindClass(m.utf8().get_data());
- print_line("LOADING MODULE: " + m);
+ print_line("Loading module: " + m);
jstring strClassName = env->NewStringUTF(m.utf8().get_data());
jclass singletonClass = (jclass)env->CallObjectMethod(cls, findClass, strClassName);
@@ -888,7 +858,6 @@ static void _initialize_java_modules() {
}
//singletonClass=(jclass)env->NewGlobalRef(singletonClass);
- __android_log_print(ANDROID_LOG_INFO, "godot", "****^*^*?^*^*class data %x", singletonClass);
jmethodID initialize = env->GetStaticMethodID(singletonClass, "initialize", "(Landroid/app/Activity;)Lorg/godotengine/godot/Godot$SingletonBase;");
if (!initialize) {
@@ -897,7 +866,6 @@ static void _initialize_java_modules() {
ERR_CONTINUE(!initialize);
}
jobject obj = env->CallStaticObjectMethod(singletonClass, initialize, _godot_instance);
- __android_log_print(ANDROID_LOG_INFO, "godot", "****^*^*?^*^*class instance %x", obj);
jobject gob = env->NewGlobalRef(obj);
}
}
@@ -906,8 +874,6 @@ static void _initialize_java_modules() {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jobject obj, jobjectArray p_cmdline) {
ThreadAndroid::setup_thread();
- __android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
-
const char **cmdline = NULL;
int cmdlen = 0;
bool use_apk_expansion = false;
@@ -921,20 +887,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
jstring string = (jstring)env->GetObjectArrayElement(p_cmdline, i);
const char *rawString = env->GetStringUTFChars(string, 0);
- if (!rawString) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "cmdline arg %i is null\n", i);
- } else {
- //__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
-
- if (strcmp(rawString, "-main_pack") == 0)
- use_apk_expansion = true;
+ if (rawString && strcmp(rawString, "--main-pack") == 0) {
+ use_apk_expansion = true;
}
cmdline[i] = rawString;
}
}
}
- __android_log_print(ANDROID_LOG_INFO, "godot", "CMDLINE LEN %i - APK EXPANSION %i\n", cmdlen, int(use_apk_expansion));
Error err = Main::setup("apk", cmdlen, (char **)cmdline, false);
if (cmdline) {
@@ -942,10 +902,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
}
if (err != OK) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "*****UNABLE TO SETUP");
return; //should exit instead and print the error
}
- __android_log_print(ANDROID_LOG_INFO, "godot", "*****SETUP OK");
java_class_wrapper = memnew(JavaClassWrapper(_godot_instance));
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaClassWrapper", java_class_wrapper));
@@ -954,7 +912,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jobject obj, jint width, jint height, jboolean reload) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ resize %lld, %i, %i\n", Thread::get_caller_id(), width, height);
if (os_android)
os_android->set_display_size(Size2(width, height));
@@ -968,8 +925,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, j
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jobject obj, bool p_32_bits) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ newcontext %lld\n", Thread::get_caller_id());
-
if (os_android) {
os_android->set_context_is_16_bits(!p_32_bits);
}
@@ -981,12 +936,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *en
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj) {
+ if (step == 0)
+ return;
+
os_android->main_loop_request_go_back();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jobject obj) {
if (step == 0) {
- __android_log_print(ANDROID_LOG_INFO, "godot", "**FIRST_STEP");
// Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id,
// but for Godot purposes, the main thread is the one running the game loop
@@ -1004,8 +961,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
++step;
}
- //__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_id());
-
os_android->process_accelerometer(accelerometer);
os_android->process_gravity(gravity);
@@ -1019,13 +974,13 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
jclass cls = env->FindClass("org/godotengine/godot/Godot");
jmethodID _finish = env->GetMethodID(cls, "forceQuit", "()V");
env->CallVoidMethod(_godot_instance, _finish);
- __android_log_print(ANDROID_LOG_INFO, "godot", "**FINISH REQUEST!!! - %p-%i\n", env, Thread::get_caller_id());
}
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions) {
- //__android_log_print(ANDROID_LOG_INFO,"godot","**TOUCH EVENT! - %p-%i\n",env,Thread::get_caller_id());
+ if (step == 0)
+ return;
Vector<OS_Android::TouchPos> points;
for (int i = 0; i < count; i++) {
@@ -1292,7 +1247,6 @@ static unsigned int android_get_keysym(unsigned int p_code) {
for (int i = 0; _ak_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
if (_ak_to_keycode[i].keycode == p_code) {
- //print_line("outcode: " + _ak_to_keycode[i].keysym);
return _ak_to_keycode[i].keysym;
}
@@ -1302,6 +1256,8 @@ static unsigned int android_get_keysym(unsigned int p_code) {
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jobject obj, jint p_device, jint p_button, jboolean p_pressed) {
+ if (step == 0)
+ return;
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
@@ -1313,6 +1269,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
+ if (step == 0)
+ return;
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
@@ -1324,6 +1282,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
+ if (step == 0)
+ return;
+
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_HAT;
@@ -1353,6 +1314,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) {
+ if (step == 0)
+ return;
Ref<InputEventKey> ievent;
ievent.instance();
@@ -1362,8 +1325,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobj
ievent->set_unicode(val);
ievent->set_pressed(p_pressed);
- print_line("Scancode: " + String::num(p_scancode) + ":" + String::num(ievent->get_scancode()) + " Unicode: " + String::num(val));
-
if (val == '\n') {
ievent->set_scancode(KEY_ENTER);
} else if (val == 61448) {
@@ -1398,14 +1359,18 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jobject obj) {
- if (os_android && step > 0)
- os_android->main_loop_focusin();
+ if (step == 0)
+ return;
+
+ os_android->main_loop_focusin();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jobject obj) {
- if (os_android && step > 0)
- os_android->main_loop_focusout();
+ if (step == 0)
+ return;
+
+ os_android->main_loop_focusout();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jobject obj) {
@@ -1527,7 +1492,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, j
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
if (!mid) {
- print_line("FAILED GETTING METHOID " + mname);
+ print_line("Failed getting method ID " + mname);
}
s->add_method(mname, mid, types, get_jni_type(retval));
@@ -1578,16 +1543,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *
int count = env->GetArrayLength(params);
Variant args[VARIANT_ARG_MAX];
- //print_line("Java->GD call: "+obj->get_type()+"::"+str_method+" argc "+itos(count));
-
for (int i = 0; i < MIN(count, VARIANT_ARG_MAX); i++) {
jobject obj = env->GetObjectArrayElement(params, i);
if (obj)
args[i] = _jobject_to_variant(env, obj);
env->DeleteLocalRef(obj);
-
- //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
obj->call_deferred(str_method, args[0], args[1], args[2], args[3], args[4]);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 67ce796279..fc41adeb76 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -130,8 +130,6 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
if (gfx_init_func)
gfx_init_func(gfx_init_ud, use_gl2);
- AudioDriverManager::add_driver(&audio_driver_android);
-
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
@@ -332,17 +330,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
if (touch.size()) {
//end all if exist
- {
- Ref<InputEventMouseButton> ev;
- ev.instance();
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(false);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->parse_input_event(ev);
- }
-
for (int i = 0; i < touch.size(); i++) {
Ref<InputEventScreenTouch> ev;
@@ -360,21 +347,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
touch[i].pos = p_points[i].pos;
}
- {
- //send mouse
- Ref<InputEventMouseButton> ev;
- ev.instance();
- // ev.type = Ref<InputEvent>::MOUSE_BUTTON;
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(true);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
- last_mouse = touch[0].pos;
- input->parse_input_event(ev);
- }
-
//send touch
for (int i = 0; i < touch.size(); i++) {
@@ -389,19 +361,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
} break;
case 1: { //motion
- if (p_points.size()) {
- //send mouse, should look for point 0?
- Ref<InputEventMouseMotion> ev;
- ev.instance();
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_position(p_points[0].pos);
- input->set_mouse_position(Point2(ev->get_position().x, ev->get_position().y));
- ev->set_speed(input->get_last_mouse_speed());
- ev->set_relative(p_points[0].pos - last_mouse);
- last_mouse = p_points[0].pos;
- input->parse_input_event(ev);
- }
-
ERR_FAIL_COND(touch.size() != p_points.size());
for (int i = 0; i < touch.size(); i++) {
@@ -434,16 +393,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
if (touch.size()) {
//end all if exist
- Ref<InputEventMouseButton> ev;
- ev.instance();
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(false);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
- input->parse_input_event(ev);
-
for (int i = 0; i < touch.size(); i++) {
Ref<InputEventScreenTouch> ev;
@@ -775,6 +724,8 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
Vector<Logger *> loggers;
loggers.push_back(memnew(AndroidLogger));
_set_logger(memnew(CompositeLogger(loggers)));
+
+ AudioDriverManager::add_driver(&audio_driver_android);
}
OS_Android::~OS_Android() {
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 12181b3688..d2457e538d 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -93,7 +93,6 @@ public:
private:
Vector<TouchPos> touch;
- Point2 last_mouse;
GFXInitFunc gfx_init_func;
void *gfx_init_ud;