diff options
Diffstat (limited to 'platform/android')
50 files changed, 1080 insertions, 350 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template index 37dee4a9a5..852a821c65 100644 --- a/platform/android/AndroidManifest.xml.template +++ b/platform/android/AndroidManifest.xml.template @@ -200,6 +200,6 @@ $$ADD_PERMISSION_CHUNKS$$ <uses-permission android:name="godot.custom.18"/> <uses-permission android:name="godot.custom.19"/> -<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/> +<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="23"/> </manifest> diff --git a/platform/android/SCsub b/platform/android/SCsub index fab8458b26..c8feac8690 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -65,17 +65,17 @@ for x in env.android_java_dirs: gradle_res_dirs_text="" for x in env.android_res_dirs: - gradle_res_dirs_text+=",'"+x+"'" + gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_aidl_dirs_text="" for x in env.android_aidl_dirs: - gradle_aidl_dirs_text+=",'"+x+"'" + gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_jni_dirs_text="" for x in env.android_jni_dirs: - gradle_jni_dirs_text+=",'"+x+"'" + gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'" gradle_asset_dirs_text="" diff --git a/platform/android/android_native_app_glue.h b/platform/android/android_native_app_glue.h index 3e7a4ea7a0..36278d4c66 100644 --- a/platform/android/android_native_app_glue.h +++ b/platform/android/android_native_app_glue.h @@ -1,32 +1,5 @@ -/*************************************************************************/ -/* android_native_app_glue.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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. */ -/*************************************************************************/ -/* Copyright (C) 2010 The Android Open Source Project +/* + * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 9461cd2e99..b0630d9a3a 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.0' + classpath 'com.android.tools.build:gradle:1.3.1' } } @@ -17,7 +17,7 @@ allprojects { } dependencies { - + compile 'com.android.support:support-v4:23.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java $$GRADLE_DEPENDENCIES$$ } @@ -25,10 +25,12 @@ android { lintOptions { abortOnError false + disable 'MissingTranslation' } - compileSdkVersion 19 - buildToolsVersion "19.1" + compileSdkVersion 23 + buildToolsVersion "23.0.3" + useLibrary 'org.apache.http.legacy' packagingOptions { exclude 'META-INF/LICENSE' @@ -36,7 +38,7 @@ android { } defaultConfig { minSdkVersion 14 - targetSdkVersion 19 + targetSdkVersion 23 } sourceSets { main { diff --git a/platform/android/detect.py b/platform/android/detect.py index d4038f6584..ba6b73a89f 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -5,7 +5,7 @@ import platform def is_active(): return True - + def get_name(): return "Android" @@ -21,7 +21,6 @@ def get_opts(): return [ ('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)), - ('NDK_TOOLCHAIN', 'toolchain to use for the NDK',"arm-eabi-4.4.0"), ('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")), ('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")), ('ndk_platform', 'compile for platform: (android-<api> , example: android-15)',"android-15"), @@ -56,9 +55,9 @@ def configure(env): # http://www.scons.org/wiki/LongCmdLinesOnWin32 import os if (os.name=="nt"): - + import subprocess - + def mySubProcess(cmdline,env): #print "SPAWNED : " + cmdline startupinfo = subprocess.STARTUPINFO() @@ -72,26 +71,26 @@ def configure(env): print err print "=====" return rv - + def mySpawn(sh, escape, cmd, args, env): - + newargs = ' '.join(args[1:]) cmdline = cmd + " " + newargs - + rv=0 if len(cmdline) > 32000 and cmd.endswith("ar") : cmdline = cmd + " " + args[1] + " " + args[2] + " " for i in range(3,len(args)) : rv = mySubProcess( cmdline + args[i], env ) if rv : - break - else: + break + else: rv = mySubProcess( cmdline, env ) - + return rv - + env['SPAWN'] = mySpawn - + ndk_platform=env['ndk_platform'] if env['android_arch'] not in ['armv7','armv6','x86']: @@ -102,9 +101,7 @@ def configure(env): env["x86_opt_gcc"]=True if env['PLATFORM'] == 'win32': - import methods env.Tool('gcc') - #env['SPAWN'] = methods.win32_spawn env['SHLIBSUFFIX'] = '.so' @@ -114,7 +111,7 @@ def configure(env): print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text) env.Append(CPPPATH=['#platform/android']) - + if env['android_arch']=='x86': env.extra_suffix=".x86"+env.extra_suffix elif env['android_arch']=='armv6': @@ -126,8 +123,7 @@ def configure(env): env.extra_suffix=".armv7"+env.extra_suffix gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/"; - - import os + if (sys.platform.find("linux")==0): if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working gcc_path=gcc_path+"/linux-x86_64/bin" @@ -136,10 +132,11 @@ def configure(env): elif (sys.platform=="darwin"): gcc_path=gcc_path+"/darwin-x86_64/bin" #this may be wrong env['SHLINKFLAGS'][1] = '-shared' + env['SHLIBSUFFIX'] = '.so' elif (os.name=="nt"): gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong - - + + env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH'] if env['android_arch']=='x86': @@ -171,11 +168,11 @@ def configure(env): env['neon_enabled']=False if env['android_arch']=='x86': - env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') + env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') elif env["android_arch"]=="armv6": - env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') + env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') elif env["android_arch"]=="armv7": - env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') + env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED') if env['android_neon']=='yes': env['neon_enabled']=True env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__']) @@ -224,7 +221,7 @@ def configure(env): elif env["android_arch"]=="armv7": env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"]) - + env.Append(LIBS=["gnustl_static","supc++"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 60f4e61c68..b8c44a4fc8 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* export.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ #include "version.h" #include "export.h" #include "tools/editor/editor_settings.h" @@ -9,6 +37,7 @@ #include "os/file_access.h" #include "os/os.h" #include "platform/android/logo.h" +#include <string.h> static const char* android_perms[]={ @@ -231,6 +260,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { void _fix_manifest(Vector<uint8_t>& p_manifest, bool p_give_internet); void _fix_resources(Vector<uint8_t>& p_manifest); static Error save_apk_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); + static bool _should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data); protected: @@ -251,7 +281,7 @@ public: virtual String get_device_info(int p_device) const; virtual Error run(int p_device,int p_flags=0); - virtual bool requieres_password(bool p_debug) const { return !p_debug; } + virtual bool requires_password(bool p_debug) const { return !p_debug; } virtual String get_binary_extension() const { return "apk"; } virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0); @@ -1001,7 +1031,7 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String& NULL, 0, NULL, - Z_DEFLATED, + _should_compress_asset(p_path,p_data) ? Z_DEFLATED : 0, Z_DEFAULT_COMPRESSION); @@ -1012,13 +1042,58 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String& } +bool EditorExportPlatformAndroid::_should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data) { + + /* + * By not compressing files with little or not benefit in doing so, + * a performance gain is expected at runtime. Moreover, if the APK is + * zip-aligned, assets stored as they are can be efficiently read by + * Android by memory-mapping them. + */ + + // -- Unconditional uncompress to mimic AAPT plus some other + + static const char* unconditional_compress_ext[] = { + // From https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/Package.cpp + // These formats are already compressed, or don't compress well: + ".jpg", ".jpeg", ".png", ".gif", + ".wav", ".mp2", ".mp3", ".ogg", ".aac", + ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet", + ".rtttl", ".imy", ".xmf", ".mp4", ".m4a", + ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", + ".amr", ".awb", ".wma", ".wmv", + // Godot-specific: + ".webp", // Same reasoning as .png + ".cfb", // Don't let small config files slow-down startup + // Trailer for easier processing + NULL + }; + + for (const char** ext=unconditional_compress_ext; *ext; ++ext) { + if (p_path.to_lower().ends_with(String(*ext))) { + return false; + } + } + + // -- Compressed resource? + + if (p_data.size() >= 4 && p_data[0]=='R' && p_data[1]=='S' && p_data[2]=='C' && p_data[3]=='C') { + // Already compressed + return false; + } + + // --- TODO: Decide on texture resources according to their image compression setting + + return true; +} + Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) { String src_apk; - EditorProgress ep("export","Exporting for Android",104); + EditorProgress ep("export","Exporting for Android",105); if (p_debug) src_apk=custom_debug_package; @@ -1058,7 +1133,8 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d zlib_filefunc_def io2=io; FileAccess *dst_f=NULL; io2.opaque=&dst_f; - zipFile apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2); + String unaligned_path=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport-unaligned.apk"; + zipFile unaligned_apk=zipOpen2(unaligned_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2); while(ret==UNZ_OK) { @@ -1137,7 +1213,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d print_line("ADDING: "+file); if (!skip) { - zipOpenNewFileInZip(apk, + + // Respect decision on compression made by AAPT for the export template + const bool uncompressed = info.compression_method == 0; + + zipOpenNewFileInZip(unaligned_apk, file.utf8().get_data(), NULL, NULL, @@ -1145,11 +1225,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d NULL, 0, NULL, - Z_DEFLATED, + uncompressed ? 0 : Z_DEFLATED, Z_DEFAULT_COMPRESSION); - zipWriteInFileInZip(apk,data.ptr(),data.size()); - zipCloseFileInZip(apk); + zipWriteInFileInZip(unaligned_apk,data.ptr(),data.size()); + zipCloseFileInZip(unaligned_apk); } ret = unzGoToNextFile(pkg); @@ -1206,7 +1286,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d APKExportData ed; ed.ep=&ep; - ed.apk=apk; + ed.apk=unaligned_apk; err = export_project_files(save_apk_file,&ed,false); } @@ -1235,7 +1315,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d print_line(itos(i)+" param: "+cl[i]); } - zipOpenNewFileInZip(apk, + zipOpenNewFileInZip(unaligned_apk, "assets/_cl_", NULL, NULL, @@ -1243,15 +1323,15 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d NULL, 0, NULL, - Z_DEFLATED, + 0, // No compress (little size gain and potentially slower startup) Z_DEFAULT_COMPRESSION); - zipWriteInFileInZip(apk,clf.ptr(),clf.size()); - zipCloseFileInZip(apk); + zipWriteInFileInZip(unaligned_apk,clf.ptr(),clf.size()); + zipCloseFileInZip(unaligned_apk); } - zipClose(apk,NULL); + zipClose(unaligned_apk,NULL); unzClose(pkg); if (err) { @@ -1308,7 +1388,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d args.push_back(keystore); args.push_back("-storepass"); args.push_back(password); - args.push_back(p_path); + args.push_back(unaligned_path); args.push_back(user); int retval; int err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); @@ -1321,16 +1401,102 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d args.clear(); args.push_back("-verify"); - args.push_back(p_path); + args.push_back(unaligned_path); args.push_back("-verbose"); err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval); if (retval) { - EditorNode::add_io_error("'jarsigner' verificaiton of APK failed. Make sure to use jarsigner from Java 6."); + EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6."); return ERR_CANT_CREATE; } } + + + + // Let's zip-align (must be done after signing) + + static const int ZIP_ALIGNMENT = 4; + + ep.step("Aligning APK..",105); + + unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io); + if (!tmp_unaligned) { + + EditorNode::add_io_error("Could not find temp unaligned APK."); + return ERR_FILE_NOT_FOUND; + } + + ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN); + ret = unzGoToFirstFile(tmp_unaligned); + + io2=io; + dst_f=NULL; + io2.opaque=&dst_f; + zipFile final_apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2); + + // Take files from the unaligned APK and write them out to the aligned one + // in raw mode, i.e. not uncompressing and recompressing, aligning them as needed, + // following what is done in https://github.com/android/platform_build/blob/master/tools/zipalign/ZipAlign.cpp + int bias = 0; + while(ret==UNZ_OK) { + + unz_file_info info; + memset(&info, 0, sizeof(info)); + + char fname[16384]; + char extra[16384]; + ret = unzGetCurrentFileInfo(tmp_unaligned,&info,fname,16384,extra,16384-ZIP_ALIGNMENT,NULL,0); + + String file=fname; + + Vector<uint8_t> data; + data.resize(info.compressed_size); + + // read + int method, level; + unzOpenCurrentFile2(tmp_unaligned, &method, &level, 1); // raw read + long file_offset = unzGetCurrentFileZStreamPos64(tmp_unaligned); + unzReadCurrentFile(tmp_unaligned,data.ptr(),data.size()); + unzCloseCurrentFile(tmp_unaligned); + + // align + int padding = 0; + if (!info.compression_method) { + // Uncompressed file => Align + long new_offset = file_offset + bias; + padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT; + } + + memset(extra + info.size_file_extra, 0, padding); + + // write + zipOpenNewFileInZip2(final_apk, + file.utf8().get_data(), + NULL, + extra, + info.size_file_extra + padding, + NULL, + 0, + NULL, + method, + level, + 1); // raw write + zipWriteInFileInZip(final_apk,data.ptr(),data.size()); + zipCloseFileInZipRaw(final_apk,info.uncompressed_size,info.crc); + + bias += padding; + + ret = unzGoToNextFile(tmp_unaligned); + } + + zipClose(final_apk,NULL); + unzClose(tmp_unaligned); + + if (err) { + return err; + } + return OK; } @@ -1377,120 +1543,125 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { while(!ea->quit_request) { String adb=EditorSettings::get_singleton()->get("android/adb"); - if (!FileAccess::exists(adb)) { - OS::get_singleton()->delay_usec(3000000); - continue; //adb not configured - } - - String devices; - List<String> args; - args.push_back("devices"); - int ec; - Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec); - Vector<String> ds = devices.split("\n"); - Vector<String> ldevices; - for(int i=1;i<ds.size();i++) { - - String d = ds[i]; - int dpos = d.find("device"); - if (dpos==-1) - continue; - d=d.substr(0,dpos).strip_edges(); -// print_line("found devuce: "+d); - ldevices.push_back(d); - } + if (FileAccess::exists(adb)) { + + String devices; + List<String> args; + args.push_back("devices"); + int ec; + Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec); + Vector<String> ds = devices.split("\n"); + Vector<String> ldevices; + for(int i=1;i<ds.size();i++) { + + String d = ds[i]; + int dpos = d.find("device"); + if (dpos==-1) + continue; + d=d.substr(0,dpos).strip_edges(); + // print_line("found devuce: "+d); + ldevices.push_back(d); + } - ea->device_lock->lock(); + ea->device_lock->lock(); - bool different=false; + bool different=false; - if (devices.size()!=ldevices.size()) { + if (devices.size()!=ldevices.size()) { - different=true; - } else { + different=true; + } else { - for(int i=0;i<ea->devices.size();i++) { + for(int i=0;i<ea->devices.size();i++) { - if (ea->devices[i].id!=ldevices[i]) { - different=true; - break; + if (ea->devices[i].id!=ldevices[i]) { + different=true; + break; + } } } - } - if (different) { + if (different) { - Vector<Device> ndevices; + Vector<Device> ndevices; - for(int i=0;i<ldevices.size();i++) { + for(int i=0;i<ldevices.size();i++) { - Device d; - d.id=ldevices[i]; - for(int j=0;j<ea->devices.size();j++) { - if (ea->devices[j].id==ldevices[i]) { - d.description=ea->devices[j].description; - d.name=ea->devices[j].name; + Device d; + d.id=ldevices[i]; + for(int j=0;j<ea->devices.size();j++) { + if (ea->devices[j].id==ldevices[i]) { + d.description=ea->devices[j].description; + d.name=ea->devices[j].name; + } } - } - if (d.description=="") { - //in the oven, request! - args.clear(); - args.push_back("-s"); - args.push_back(d.id); - args.push_back("shell"); - args.push_back("cat"); - args.push_back("/system/build.prop"); - int ec; - String dp; - - Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec); - print_line("RV: "+itos(ec)); - Vector<String> props = dp.split("\n"); - String vendor; - String device; - d.description+"Device ID: "+d.id+"\n"; - for(int j=0;j<props.size();j++) { - - String p = props[j]; - if (p.begins_with("ro.product.model=")) { - device=p.get_slice("=",1).strip_edges(); - } else if (p.begins_with("ro.product.brand=")) { - vendor=p.get_slice("=",1).strip_edges().capitalize(); - } else if (p.begins_with("ro.build.display.id=")) { - d.description+="Build: "+p.get_slice("=",1).strip_edges()+"\n"; - } else if (p.begins_with("ro.build.version.release=")) { - d.description+="Release: "+p.get_slice("=",1).strip_edges()+"\n"; - } else if (p.begins_with("ro.product.cpu.abi=")) { - d.description+="CPU: "+p.get_slice("=",1).strip_edges()+"\n"; - } else if (p.begins_with("ro.product.manufacturer=")) { - d.description+="Manufacturer: "+p.get_slice("=",1).strip_edges()+"\n"; - } else if (p.begins_with("ro.board.platform=")) { - d.description+="Chipset: "+p.get_slice("=",1).strip_edges()+"\n"; - } else if (p.begins_with("ro.opengles.version=")) { - uint32_t opengl = p.get_slice("=",1).to_int(); - d.description+="OpenGL: "+itos(opengl>>16)+"."+itos((opengl>>8)&0xFF)+"."+itos((opengl)&0xFF)+"\n"; + if (d.description=="") { + //in the oven, request! + args.clear(); + args.push_back("-s"); + args.push_back(d.id); + args.push_back("shell"); + args.push_back("cat"); + args.push_back("/system/build.prop"); + int ec; + String dp; + + Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec); + print_line("RV: "+itos(ec)); + Vector<String> props = dp.split("\n"); + String vendor; + String device; + d.description+"Device ID: "+d.id+"\n"; + for(int j=0;j<props.size();j++) { + + String p = props[j]; + if (p.begins_with("ro.product.model=")) { + device=p.get_slice("=",1).strip_edges(); + } else if (p.begins_with("ro.product.brand=")) { + vendor=p.get_slice("=",1).strip_edges().capitalize(); + } else if (p.begins_with("ro.build.display.id=")) { + d.description+="Build: "+p.get_slice("=",1).strip_edges()+"\n"; + } else if (p.begins_with("ro.build.version.release=")) { + d.description+="Release: "+p.get_slice("=",1).strip_edges()+"\n"; + } else if (p.begins_with("ro.product.cpu.abi=")) { + d.description+="CPU: "+p.get_slice("=",1).strip_edges()+"\n"; + } else if (p.begins_with("ro.product.manufacturer=")) { + d.description+="Manufacturer: "+p.get_slice("=",1).strip_edges()+"\n"; + } else if (p.begins_with("ro.board.platform=")) { + d.description+="Chipset: "+p.get_slice("=",1).strip_edges()+"\n"; + } else if (p.begins_with("ro.opengles.version=")) { + uint32_t opengl = p.get_slice("=",1).to_int(); + d.description+="OpenGL: "+itos(opengl>>16)+"."+itos((opengl>>8)&0xFF)+"."+itos((opengl)&0xFF)+"\n"; + } } + + d.name=vendor+" "+device; + // print_line("name: "+d.name); + // print_line("description: "+d.description); + } - d.name=vendor+" "+device; -// print_line("name: "+d.name); -// print_line("description: "+d.description); + ndevices.push_back(d); } - ndevices.push_back(d); - + ea->devices=ndevices; + ea->devices_changed=true; } - ea->devices=ndevices; - ea->devices_changed=true; + ea->device_lock->unlock(); } - ea->device_lock->unlock(); + uint64_t wait = 3000000; + uint64_t time = OS::get_singleton()->get_ticks_usec(); + while(OS::get_singleton()->get_ticks_usec() - time < wait ) { + OS::get_singleton()->delay_usec(1000); + if (ea->quit_request) + break; + } - OS::get_singleton()->delay_usec(3000000); } if (EditorSettings::get_singleton()->get("android/shutdown_adb_on_exit")) { diff --git a/platform/android/export/export.h b/platform/android/export/export.h index 88581802b8..a9421e692e 100644 --- a/platform/android/export/export.h +++ b/platform/android/export/export.h @@ -1,3 +1,29 @@ - - +/*************************************************************************/ +/* export.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ void register_android_exporter(); diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index 824a4e3606..9a4252bde0 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -1,4 +1,31 @@ - +/*************************************************************************/ +/* global_defaults.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ #include "global_defaults.h" #include "globals.h" diff --git a/platform/android/globals/global_defaults.h b/platform/android/globals/global_defaults.h index 64eb26c482..6f240572d8 100644 --- a/platform/android/globals/global_defaults.h +++ b/platform/android/globals/global_defaults.h @@ -1,3 +1,29 @@ - - -void register_android_global_defaults();
\ No newline at end of file +/*************************************************************************/ +/* global_defaults.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ +void register_android_global_defaults(); diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index f9feb3481f..edb051575f 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -313,6 +313,7 @@ struct engine { ASensorManager* sensorManager; const ASensor* accelerometerSensor; + const ASensor* magnetometerSensor; ASensorEventQueue* sensorEventQueue; bool display_active; @@ -736,15 +737,28 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { engine->accelerometerSensor, (1000L/60)*1000); } + // Also start monitoring the magnetometer. + if (engine->magnetometerSensor != NULL) { + ASensorEventQueue_enableSensor(engine->sensorEventQueue, + engine->magnetometerSensor); + // We'd like to get 60 events per second (in us). + ASensorEventQueue_setEventRate(engine->sensorEventQueue, + engine->magnetometerSensor, (1000L/60)*1000); + + } engine->animating = 1; break; case APP_CMD_LOST_FOCUS: - // When our app loses focus, we stop monitoring the accelerometer. + // When our app loses focus, we stop monitoring the sensors. // This is to avoid consuming battery while not being used. if (engine->accelerometerSensor != NULL) { ASensorEventQueue_disableSensor(engine->sensorEventQueue, engine->accelerometerSensor); } + if (engine->magnetometerSensor != NULL) { + ASensorEventQueue_disableSensor(engine->sensorEventQueue, + engine->magnetometerSensor); + } // Also stop animating. engine->animating = 0; engine_draw_frame(engine); @@ -768,10 +782,12 @@ void android_main(struct android_app* state) { FileAccessAndroid::asset_manager=state->activity->assetManager; - // Prepare to monitor accelerometer + // Prepare to monitor sensors engine.sensorManager = ASensorManager_getInstance(); engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager, - ASENSOR_TYPE_ACCELEROMETER); + ASENSOR_TYPE_ACCELEROMETER); + engine.magnetometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager, + ASENSOR_TYPE_MAGNETIC_FIELD); engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager, state->looper, LOOPER_ID_USER, NULL, NULL); @@ -812,16 +828,21 @@ void android_main(struct android_app* state) { // If a sensor has data, process it now. // LOGI("events\n"); if (ident == LOOPER_ID_USER) { - if (engine.accelerometerSensor != NULL) { + if (engine.accelerometerSensor != NULL || engine.magnetometerSensor != NULL) { ASensorEvent event; while (ASensorEventQueue_getEvents(engine.sensorEventQueue, &event, 1) > 0) { if (engine.os) { + if (event.acceleration != NULL) { engine.os->process_accelerometer(Vector3(event.acceleration.x, event.acceleration.y, event.acceleration.z)); - + } + if (event.magnetic != NULL) { + engine.os->process_magnetometer(Vector3(event.magnetic.x, event.magnetic.y, + event.magnetic.z)); + } } } diff --git a/platform/android/java/res/drawable/icon.png b/platform/android/java/res/drawable/icon.png Binary files differindex 013632ddf1..e334f5fa78 100644 --- a/platform/android/java/res/drawable/icon.png +++ b/platform/android/java/res/drawable/icon.png diff --git a/platform/android/java/res/layout/downloading_expansion.xml b/platform/android/java/res/layout/downloading_expansion.xml index 553155dcd3..d678d94eac 100644 --- a/platform/android/java/res/layout/downloading_expansion.xml +++ b/platform/android/java/res/layout/downloading_expansion.xml @@ -80,7 +80,7 @@ </RelativeLayout> <LinearLayout - android:id="@+id/downloaderDashboard" + android:id="@+id/downloadButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > diff --git a/platform/android/java/res/values-fa/strings.xml b/platform/android/java/res/values-fa/strings.xml index 450f9fe212..f1e29013c4 100644 --- a/platform/android/java/res/values-fa/strings.xml +++ b/platform/android/java/res/values-fa/strings.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="godot_project_name_string">godot-project-name-fa</string> - <string name="testuf8">سلام</string> <string name="text_paused_cellular">آیا می خواهید بر روی اتصال داده همراه دانلود را شروع کنید؟ بر اساس نوع سطح داده شما این ممکن است برای شما هزینه مالی داشته باشد.</string> <string name="text_paused_cellular_2">اگر نمی خواهید بر روی اتصال داده همراه دانلود را شروع کنید ، دانلود به صورت خودکار در زمان دسترسی به وای-فای شروع می شود.</string> <string name="text_button_resume_cellular">ادامه دانلود</string> diff --git a/platform/android/java/res/values-ko/strings.xml b/platform/android/java/res/values-ko/strings.xml index 6d27498af8..b997b934b2 100644 --- a/platform/android/java/res/values-ko/strings.xml +++ b/platform/android/java/res/values-ko/strings.xml @@ -1,4 +1,55 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="godot_project_name_string">godot-project-name-ko</string> + <string name="text_paused_cellular">모바일 네트워크를 사용하여 다운로드 하시겠습니까? 남은 데이터 사용량에 따라, 요금이 부과될 수 있습니다.</string> + <string name="text_paused_cellular_2">모바일 네트워크를 사용하여 다운로드 하지 않을 경우, 와이파이 연결이 가능할 때 자동적으로 다운로드가 이루어집니다.</string> + <string name="text_button_resume_cellular">다운로드 계속하기</string> + <string name="text_button_wifi_settings">와이파이 설정</string> + <string name="text_verifying_download">다운로드 확인중</string> + <string name="text_validation_complete">추가 파일 확인이 완료되었습니다. 확인을 눌러 진행하세요.</string> + <string name="text_validation_failed">추가 파일 확인에 실패하였습니다.</string> + <string name="text_button_pause">다운로드 일시정지</string> + <string name="text_button_resume">다운로드 계속하기</string> + <string name="text_button_cancel">취소</string> + <string name="text_button_cancel_verify">파일 확인 취소</string> + + <!-- APK Expansion Strings --> + + <!-- When a download completes, a notification is displayed, and this + string is used to indicate that the download successfully completed. + Note that such a download could have been initiated by a variety of + applications, including (but not limited to) the browser, an email + application, a content marketplace. --> + <string name="notification_download_complete">다운로드 완료</string> + + <!-- When a download completes, a notification is displayed, and this + string is used to indicate that the download failed. + Note that such a download could have been initiated by a variety of + applications, including (but not limited to) the browser, an email + application, a content marketplace. --> + <string name="notification_download_failed">다운로드 실패</string> + + + <string name="state_unknown">시작중...</string> + <string name="state_idle">다운로드 시작을 기다리는 중</string> + <string name="state_fetching_url">다운로드할 항목을 찾는 중</string> + <string name="state_connecting">다운로드 서버에 연결 중</string> + <string name="state_downloading">다운로드 중</string> + <string name="state_completed">다운로드 종료</string> + <string name="state_paused_network_unavailable">와이파이를 찾을 수 없어 다운로드가 일시정지 되었습니다.</string> + <string name="state_paused_network_setup_failure">다운로드가 일시정지 되었습니다. 네트워크 연결 상태를 확인하세요.</string> + <string name="state_paused_by_request">다운로드 일시정지</string> + <string name="state_paused_wifi_unavailable">와이파이가 사용하능하지 않아 다운로드가 일시정지 되었습니다.</string> + <string name="state_paused_wifi_disabled">와이파이가 비활성화 되어 다운로드가 일시정지 되었습니다.</string> + <string name="state_paused_roaming">로밍 상태이어서 다운로드가 일시정지 되었습니다.</string> + <string name="state_paused_sdcard_unavailable">외부 저장소를 사용할 수 없어 다운로드가 일시정지 되었습니다.</string> + <string name="state_failed_unlicensed">이 앱을 구매하지 않아 다운로드가 정지 되었습니다.</string> + <string name="state_failed_fetching_url">다운로드 항목을 찾을 수 없어 다운로드가 정지 되었습니다.</string> + <string name="state_failed_sdcard_full">외부 저장소가 가득차서 다운로드가 실패하였습니다.</string> + <string name="state_failed_cancelled">다운로드 취소</string> + <string name="state_failed">다운로드 실패</string> + + <string name="kilobytes_per_second">%1$s KB/s</string> + <string name="time_remaining">남은 시간: %1$s</string> + <string name="time_remaining_notification">%1$s 남음</string> </resources>
\ No newline at end of file diff --git a/platform/android/java/res/values/strings.xml b/platform/android/java/res/values/strings.xml index e1dbdfc062..f0ea56148f 100644 --- a/platform/android/java/res/values/strings.xml +++ b/platform/android/java/res/values/strings.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="godot_project_name_string">godot-project-name</string> - <string name="testuf8">元気です</string> - <string name="testuf2">元気です元気です元気です</string> <string name="text_paused_cellular">Would you like to enable downloading over cellular connections? Depending on your data plan, this may cost you money.</string> <string name="text_paused_cellular_2">If you choose not to enable downloading over cellular connections, the download will automatically resume when wi-fi is available.</string> <string name="text_button_resume_cellular">Resume download</string> @@ -32,7 +30,7 @@ <string name="notification_download_failed">Download unsuccessful</string> - <string name="state_unknown">Starting..."</string> + <string name="state_unknown">Starting...</string> <string name="state_idle">Waiting for download to start</string> <string name="state_fetching_url">Looking for resources to download</string> <string name="state_connecting">Connecting to the download server</string> diff --git a/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java b/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java index 0b1c4b6cca..531cb22f8c 100644 --- a/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java +++ b/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java @@ -146,11 +146,11 @@ public class LicenseChecker implements ServiceConnection { if (mService == null) { Log.i(TAG, "Binding to licensing service."); try { + Intent serviceIntent = new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))); + serviceIntent.setPackage("com.android.vending"); boolean bindResult = mContext .bindService( - new Intent( - new String( - Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))), + serviceIntent, this, // ServiceConnection. Context.BIND_AUTO_CREATE); diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java index ff2c6f535a..2af33b96b9 100644 --- a/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java +++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java @@ -33,6 +33,10 @@ public class Constants { public static final String EXP_PATH = File.separator + "Android" + File.separator + "obb" + File.separator; + // save to private app's data on Android 6.0 to skip requesting permission. + public static final String EXP_PATH_API23 = File.separator + "Android" + + File.separator + "data" + File.separator; + /** The intent that gets sent when the service must wake up for a retry */ public static final String ACTION_RETRY = "android.intent.action.DOWNLOAD_WAKEUP"; @@ -70,7 +74,7 @@ public class Constants { * The number of times that the download manager will retry its network * operations when no progress is happening before it gives up. */ - public static final int MAX_RETRIES = 5; + public static final int MAX_RETRIES = 10; /** * The minimum amount of time that the download manager accepts for diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java index b4c28d36e7..ae3fe957cb 100644 --- a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java +++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java @@ -19,6 +19,7 @@ package com.google.android.vending.expansion.downloader; import com.godot.game.R; import android.content.Context; +import android.os.Build; import android.os.Environment; import android.os.StatFs; import android.os.SystemClock; @@ -220,8 +221,8 @@ public class Helpers { static public String getSaveFilePath(Context c) { File root = Environment.getExternalStorageDirectory(); - String path = root.toString() + Constants.EXP_PATH + c.getPackageName(); - return path; + String path = Build.VERSION.SDK_INT >= 23 ? Constants.EXP_PATH_API23 : Constants.EXP_PATH; + return root.toString() + path + c.getPackageName(); } /** diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java index 9a0ca02122..e2673a9dd7 100644 --- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java +++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java @@ -25,6 +25,6 @@ public class CustomNotificationFactory { if (android.os.Build.VERSION.SDK_INT > 13) return new V14CustomNotification(); else - return new V3CustomNotification(); + throw new RuntimeException(); } } 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 d82b658bc3..73e6f83bec 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,6 +27,7 @@ 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 @@ -48,8 +49,9 @@ public class DownloadNotification implements IDownloaderClient { private IDownloaderClient mClientProxy; final ICustomNotification mCustomNotification; - private Notification mNotification; - private Notification mCurrentNotification; + // 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 CharSequence mLabel; private String mCurrentText; private PendingIntent mContentIntent; @@ -132,17 +134,14 @@ public class DownloadNotification implements IDownloaderClient { } mCurrentText = mContext.getString(stringDownloadID); mCurrentTitle = mLabel.toString(); - mCurrentNotification.tickerText = mLabel + ": " + mCurrentText; - mCurrentNotification.icon = iconResource; - mCurrentNotification.setLatestEventInfo(mContext, mCurrentTitle, mCurrentText, - mContentIntent); - if (ongoingEvent) { - mCurrentNotification.flags |= Notification.FLAG_ONGOING_EVENT; - } else { - mCurrentNotification.flags &= ~Notification.FLAG_ONGOING_EVENT; - mCurrentNotification.flags |= Notification.FLAG_AUTO_CANCEL; - } - mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification); + mCurrentNotificationBuilder.setTicker(mLabel + ": " + mCurrentText); + mCurrentNotificationBuilder.setSmallIcon(iconResource); + mCurrentNotificationBuilder.setContentTitle(mCurrentTitle); + mCurrentNotificationBuilder.setContentText(mCurrentText); + mCurrentNotificationBuilder.setContentIntent(mContentIntent); + mCurrentNotificationBuilder.setOngoing(ongoingEvent); + mCurrentNotificationBuilder.setAutoCancel(!ongoingEvent); + mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotificationBuilder.build()); } } @@ -154,10 +153,12 @@ public class DownloadNotification implements IDownloaderClient { } if (progress.mOverallTotal <= 0) { // we just show the text - mNotification.tickerText = mCurrentTitle; - mNotification.icon = android.R.drawable.stat_sys_download; - mNotification.setLatestEventInfo(mContext, mLabel, mCurrentText, mContentIntent); - mCurrentNotification = mNotification; + mNotificationBuilder.setTicker(mCurrentTitle); + mNotificationBuilder.setSmallIcon(android.R.drawable.stat_sys_download); + mNotificationBuilder.setContentTitle(mCurrentTitle); + mNotificationBuilder.setContentText(mCurrentText); + mNotificationBuilder.setContentIntent(mContentIntent); + mCurrentNotificationBuilder = mNotificationBuilder; } else { mCustomNotification.setCurrentBytes(progress.mOverallProgress); mCustomNotification.setTotalBytes(progress.mOverallTotal); @@ -166,9 +167,9 @@ public class DownloadNotification implements IDownloaderClient { mCustomNotification.setTicker(mLabel + ": " + mCurrentText); mCustomNotification.setTitle(mLabel); mCustomNotification.setTimeRemaining(progress.mTimeRemaining); - mCurrentNotification = mCustomNotification.updateNotification(mContext); + mCurrentNotificationBuilder = mCustomNotification.updateNotification(mContext); } - mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification); + mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotificationBuilder.build()); } public interface ICustomNotification { @@ -186,7 +187,7 @@ public class DownloadNotification implements IDownloaderClient { void setTimeRemaining(long timeRemaining); - Notification updateNotification(Context c); + NotificationCompat.Builder updateNotification(Context c); } /** @@ -219,8 +220,8 @@ public class DownloadNotification implements IDownloaderClient { mContext.getSystemService(Context.NOTIFICATION_SERVICE); mCustomNotification = CustomNotificationFactory .createCustomNotification(); - mNotification = new Notification(); - mCurrentNotification = mNotification; + mNotificationBuilder = new NotificationCompat.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 2e049a4d47..390bde96e9 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,6 +22,7 @@ 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 { @@ -53,13 +54,14 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi mCurrentKB = currentBytes; } - void setProgress(Notification.Builder builder) { + void setProgress(NotificationCompat.Builder builder) { } @Override - public Notification updateNotification(Context c) { - Notification.Builder builder = new Notification.Builder(c); + 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); builder.setContentTitle(mTitle); if (mTotalKB > 0 && -1 != mCurrentKB) { builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false); @@ -80,7 +82,7 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi builder.setContentIntent(mPendingIntent); builder.setOnlyAlertOnce(true); - return builder.getNotification(); + return builder; } @Override diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java deleted file mode 100644 index 94e21de7ca..0000000000 --- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.vending.expansion.downloader.impl; - -import com.godot.game.R; -import com.google.android.vending.expansion.downloader.Helpers; - -import android.app.Notification; -import android.app.PendingIntent; -import android.content.Context; -import android.graphics.BitmapFactory; -import android.view.View; -import android.widget.RemoteViews; - -public class V3CustomNotification implements DownloadNotification.ICustomNotification { - - CharSequence mTitle; - CharSequence mTicker; - int mIcon; - long mTotalBytes = -1; - long mCurrentBytes = -1; - long mTimeRemaining; - PendingIntent mPendingIntent; - Notification mNotification = new Notification(); - - @Override - public void setIcon(int icon) { - mIcon = icon; - } - - @Override - public void setTitle(CharSequence title) { - mTitle = title; - } - - @Override - public void setTotalBytes(long totalBytes) { - mTotalBytes = totalBytes; - } - - @Override - public void setCurrentBytes(long currentBytes) { - mCurrentBytes = currentBytes; - } - - @Override - public Notification updateNotification(Context c) { - Notification n = mNotification; - - n.icon = mIcon; - - n.flags |= Notification.FLAG_ONGOING_EVENT; - - if (android.os.Build.VERSION.SDK_INT > 10) { - n.flags |= Notification.FLAG_ONLY_ALERT_ONCE; // only matters for - // Honeycomb - } - - // Build the RemoteView object - RemoteViews expandedView = new RemoteViews( - c.getPackageName(), - R.layout.status_bar_ongoing_event_progress_bar); - - expandedView.setTextViewText(R.id.title, mTitle); - // look at strings - expandedView.setViewVisibility(R.id.description, View.VISIBLE); - expandedView.setTextViewText(R.id.description, - Helpers.getDownloadProgressString(mCurrentBytes, mTotalBytes)); - expandedView.setViewVisibility(R.id.progress_bar_frame, View.VISIBLE); - expandedView.setProgressBar(R.id.progress_bar, - (int) (mTotalBytes >> 8), - (int) (mCurrentBytes >> 8), - mTotalBytes <= 0); - expandedView.setViewVisibility(R.id.time_remaining, View.VISIBLE); - expandedView.setTextViewText( - R.id.time_remaining, - c.getString(R.string.time_remaining_notification, - Helpers.getTimeRemaining(mTimeRemaining))); - expandedView.setTextViewText(R.id.progress_text, - Helpers.getDownloadProgressPercent(mCurrentBytes, mTotalBytes)); - expandedView.setImageViewResource(R.id.appIcon, mIcon); - n.contentView = expandedView; - n.contentIntent = mPendingIntent; - return n; - } - - @Override - public void setPendingIntent(PendingIntent contentIntent) { - mPendingIntent = contentIntent; - } - - @Override - public void setTicker(CharSequence ticker) { - mTicker = ticker; - } - - @Override - public void setTimeRemaining(long timeRemaining) { - mTimeRemaining = timeRemaining; - } - -} diff --git a/platform/android/java/src/org/godotengine/godot/Dictionary.java b/platform/android/java/src/org/godotengine/godot/Dictionary.java index 34051c4bb8..e003c245bb 100644 --- a/platform/android/java/src/org/godotengine/godot/Dictionary.java +++ b/platform/android/java/src/org/godotengine/godot/Dictionary.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 1f208f8fb6..73d54b6afa 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -206,6 +206,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC private SensorManager mSensorManager; private Sensor mAccelerometer; + private Sensor mMagnetometer; public FrameLayout layout; public RelativeLayout adLayout; @@ -374,6 +375,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); + mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); + mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME); result_callback = null; @@ -464,7 +467,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC // Build the full path to the app's expansion files try { - expansion_pack_path = Environment.getExternalStorageDirectory().toString() + "/Android/obb/"+this.getPackageName(); + expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext()); expansion_pack_path+="/"+"main."+getPackageManager().getPackageInfo(getPackageName(), 0).versionCode+"."+this.getPackageName()+".obb"; } catch (Exception e) { e.printStackTrace(); @@ -588,6 +591,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC mView.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); + mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_NORMAL); GodotLib.focusin(); if(use_immersive && Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+ Window window = getWindow(); @@ -646,7 +650,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC float x = adjustedValues[0]; float y = adjustedValues[1]; float z = adjustedValues[2]; - GodotLib.accelerometer(x,y,z); + + int typeOfSensor = event.sensor.getType(); + if (typeOfSensor == event.sensor.TYPE_ACCELEROMETER) { + GodotLib.accelerometer(x,y,z); + } + if (typeOfSensor == event.sensor.TYPE_MAGNETIC_FIELD) { + GodotLib.magnetometer(x,y,z); + } } @Override public final void onAccuracyChanged(Sensor sensor, int accuracy) { diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java index b602f4757c..ea6c070fae 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GodotDownloaderAlarmReceiver.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot; import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java index 6735d387f3..4ea3f13021 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GodotDownloaderService.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot; import android.content.Context; diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java index 7c5ac33c85..df181ae1bb 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java @@ -51,6 +51,7 @@ public class GodotLib { public static native void step(); public static native void touch(int what,int pointer,int howmany, int[] arr); public static native void accelerometer(float x, float y, float z); + public static native void magnetometer(float x, float y, float z); public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed); public static native void joybutton(int p_device, int p_but, boolean p_pressed); public static native void joyaxis(int p_device, int p_axis, float p_value); diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java index 6bec49410d..fde752acc9 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java +++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GodotPaymentV3.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot; import org.godotengine.godot.Dictionary; diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java index c8ffa74ecd..aa92eeae0f 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GodotEditText.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.input; import android.content.Context; import android.util.AttributeSet; diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java index 64d8826b44..13c8c8b3ec 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GodotTextInputWrapper.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.input; import android.content.Context; import android.text.Editable; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java index 61ccb97161..16b669fbe8 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* ConsumeTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import com.android.vending.billing.IInAppBillingService; diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java index 293e903284..175d401c87 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* GenericConsumeTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import com.android.vending.billing.IInAppBillingService; diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java index d120551e4a..e63230c4f8 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* HandlePurchaseTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java index 5f3d931593..0635385f53 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* PaymentsCache.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import android.content.Context; 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 effb58aa35..eb33b37ecc 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* PaymentsManager.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import java.util.ArrayList; diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java index 8b048d8065..9e92d8b5a5 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* PurchaseTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java index 7bb5131b49..2dc7dcf6b1 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* ReleaseAllConsumablesTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import java.util.ArrayList; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java index 2fcf7483b4..f3532f311f 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* ValidateTask.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java index 2fb81cef8c..ef7793c1e6 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java +++ b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* Crypt.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.utils; import java.security.MessageDigest; diff --git a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java index 2db88fcc9b..f2b0e8786e 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java +++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* CustomSSLSocketFactory.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.utils; import java.io.IOException; import java.net.Socket; @@ -51,4 +79,4 @@ public class CustomSSLSocketFactory extends SSLSocketFactory { public Socket createSocket() throws IOException { return sslContext.getSocketFactory().createSocket(); } -}
\ No newline at end of file +} diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java index 14346702cc..5687b3c1e1 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java +++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* HttpRequester.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.utils; import java.io.BufferedReader; diff --git a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java index 36753e368c..d66dfe9531 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java +++ b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* RequestParams.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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.godot.utils; import java.util.ArrayList; diff --git a/platform/android/java_bind.cpp b/platform/android/java_bind.cpp deleted file mode 100644 index 33ecfcffb6..0000000000 --- a/platform/android/java_bind.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "java_bind.h" - -JavaBind::JavaBind() -{ -} diff --git a/platform/android/java_bind.h b/platform/android/java_bind.h deleted file mode 100644 index ca6b4650d3..0000000000 --- a/platform/android/java_bind.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef JAVA_BIND_H -#define JAVA_BIND_H - -class JavaBind -{ -public: - JavaBind(); -}; - -#endif // JAVA_BIND_H diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index 283ea81152..4fda13fec0 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* java_class_wrapper.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ #include "java_class_wrapper.h" #include "thread_jandroid.h" diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index d5d8bd5be8..012e7854fe 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* java_class_wrapper.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/*************************************************************************/ #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index b5beb8fa2c..1ea7cd7ebb 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -650,6 +650,7 @@ static bool resized_reload=false; static bool quit_request=false; static Size2 new_size; static Vector3 accelerometer; +static Vector3 magnetometer; static HashMap<String,JNISingleton*> jni_singletons; static jobject godot_io; @@ -1088,6 +1089,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo os_android->process_accelerometer(accelerometer); + os_android->process_magnetometer(magnetometer); + if (os_android->main_loop_iterate()==true) { jclass cls = env->FindClass("org/godotengine/godot/Godot"); @@ -1488,6 +1491,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv } +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z) { + + input_mutex->lock(); + magnetometer=Vector3(x,y,z); + input_mutex->unlock(); + +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj){ if (!suspend_mutex) diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h index 1d65d21251..f7916efe2c 100644 --- a/platform/android/java_glue.h +++ b/platform/android/java_glue.h @@ -49,6 +49,7 @@ extern "C" { JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv * env, jobject obj, jint p_device, jboolean p_connected, jstring p_name); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z); + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * env, jobject obj, jstring name,jobject p_object); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 2ef28333be..4e6dfb2db2 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -609,6 +609,11 @@ void OS_Android::process_accelerometer(const Vector3& p_accelerometer) { input->set_accelerometer(p_accelerometer); } +void OS_Android::process_magnetometer(const Vector3& p_magnetometer) { + + input->set_magnetometer(p_magnetometer); +} + bool OS_Android::has_touchscreen_ui_hint() const { return true; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index ec1f4119b4..843b3c4788 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -239,6 +239,7 @@ public: void process_accelerometer(const Vector3& p_accelerometer); + void process_magnetometer(const Vector3& p_magnetometer); void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points); void process_joy_event(JoystickEvent p_event); void process_event(InputEvent p_event); |