summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/audio_driver_opensl.cpp3
-rw-r--r--platform/android/audio_driver_opensl.h3
-rw-r--r--platform/android/detect.py9
-rw-r--r--platform/android/export/export.cpp9
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java8
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java1
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java2
-rw-r--r--platform/android/os_android.cpp6
-rw-r--r--platform/android/os_android.h3
12 files changed, 29 insertions, 23 deletions
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 3d80e76707..b9f1f1eab0 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -78,9 +78,9 @@ Error AudioDriverAndroid::init() {
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
JNIEnv *env = ThreadAndroid::get_env();
- int mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
+ int mix_rate = GLOBAL_DEF_RST("audio/mix_rate", 44100);
- int latency = GLOBAL_DEF("audio/output_latency", 25);
+ int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index e6bd3ff253..fd834193dd 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -42,7 +42,8 @@ void AudioDriverOpenSL::_buffer_callback(
/* SLuint32 eventFlags,
const void * pBuffer,
SLuint32 bufferSize,
- SLuint32 dataUsed*/) {
+ SLuint32 dataUsed*/
+) {
bool mix = true;
diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h
index 2022bad02a..88cb122414 100644
--- a/platform/android/audio_driver_opensl.h
+++ b/platform/android/audio_driver_opensl.h
@@ -74,7 +74,8 @@ class AudioDriverOpenSL : public AudioDriver {
/* SLuint32 eventFlags,
const void * pBuffer,
SLuint32 bufferSize,
- SLuint32 dataUsed*/);
+ SLuint32 dataUsed*/
+ );
static void _buffer_callbacks(
SLAndroidSimpleBufferQueueItf queueItf,
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 971368db17..ada36e2814 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -139,8 +139,13 @@ def configure(env):
## Build type
if (env["target"].startswith("release")):
- env.Append(LINKFLAGS=['-O2'])
- env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(LINKFLAGS=['-O2'])
+ env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
+ else: #optimize for size
+ env.Append(CPPFLAGS=['-Os', '-DNDEBUG'])
+ env.Append(LINKFLAGS=['-Os'])
+
if (can_vectorize):
env.Append(CPPFLAGS=['-ftree-vectorize'])
if (env["target"] == "release_debug"):
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index c3ff157f99..c562a47b00 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -228,7 +228,7 @@ class EditorExportAndroid : public EditorExportPlatform {
};
Vector<Device> devices;
- bool devices_changed;
+ volatile bool devices_changed;
Mutex *device_lock;
Thread *device_thread;
volatile bool quit_request;
@@ -1154,7 +1154,10 @@ public:
virtual bool poll_devices() {
bool dc = devices_changed;
- devices_changed = false;
+ if (dc) {
+ // don't clear unless we're reporting true, to avoid race
+ devices_changed = false;
+ }
return dc;
}
@@ -1857,9 +1860,9 @@ public:
run_icon->create_from_image(img);
device_lock = Mutex::create();
- device_thread = Thread::create(_device_poll_thread, this);
devices_changed = true;
quit_request = false;
+ device_thread = Thread::create(_device_poll_thread, this);
}
~EditorExportAndroid() {
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 8a2d789dc5..ef798fc790 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -297,7 +297,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
runOnUiThread(new Runnable() {
@Override
public void run() {
- view.setKeepScreenOn("True".equals(GodotLib.getGlobal("display/driver/keep_screen_on")));
+ view.setKeepScreenOn("True".equals(GodotLib.getGlobal("display/window/energy_saving/keep_screen_on")));
}
});
}
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 afe5f81b6d..5d94e77cd7 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
@@ -66,7 +66,6 @@ abstract public class ConsumeTask {
}
final String token = _token;
new AsyncTask<String, String, String>() {
-
@Override
protected String doInBackground(String... params) {
try {
@@ -89,7 +88,6 @@ abstract public class ConsumeTask {
error(param);
}
}
-
}
.execute();
}
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 b7bf2362cc..d4c7380424 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -113,7 +113,6 @@ public class PaymentsManager {
public void requestPurchase(final String sku, String transactionId) {
new PurchaseTask(mService, Godot.getInstance()) {
-
@Override
protected void error(String message) {
godotPaymentV3.callbackFail(message);
@@ -128,7 +127,6 @@ public class PaymentsManager {
protected void alreadyOwned() {
godotPaymentV3.callbackAlreadyOwned(sku);
}
-
}
.purchase(sku, transactionId);
}
@@ -139,7 +137,6 @@ public class PaymentsManager {
public void consumeUnconsumedPurchases() {
new ReleaseAllConsumablesTask(mService, activity) {
-
@Override
protected void success(String sku, String receipt, String signature, String token) {
godotPaymentV3.callbackSuccessProductMassConsumed(receipt, signature, sku);
@@ -208,14 +205,12 @@ public class PaymentsManager {
public void processPurchaseResponse(int resultCode, Intent data) {
new HandlePurchaseTask(activity) {
-
@Override
protected void success(final String sku, final String signature, final String ticket) {
godotPaymentV3.callbackSuccess(ticket, signature, sku);
if (auto_consume) {
new ConsumeTask(mService, activity) {
-
@Override
protected void success(String ticket) {
}
@@ -245,12 +240,10 @@ public class PaymentsManager {
public void validatePurchase(String purchaseToken, final String sku) {
new ValidateTask(activity, godotPaymentV3) {
-
@Override
protected void success() {
new ConsumeTask(mService, activity) {
-
@Override
protected void success(String ticket) {
godotPaymentV3.callbackSuccess(ticket, null, sku);
@@ -283,7 +276,6 @@ public class PaymentsManager {
public void consume(final String sku) {
new ConsumeTask(mService, activity) {
-
@Override
protected void success(String ticket) {
godotPaymentV3.callbackSuccessProductMassConsumed(ticket, "", sku);
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 e00e37f9d1..eccc6f671b 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
@@ -88,7 +88,6 @@ abstract public class ReleaseAllConsumablesTask {
String signature = mySignatures.get(i);
//Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
new GenericConsumeTask(context, mService, sku, receipt, signature, token) {
-
@Override
public void onSuccess(String sku, String receipt, String signature, String token) {
ReleaseAllConsumablesTask.this.success(sku, receipt, signature, token);
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 1eb9d001e0..0626e50bb1 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
@@ -63,7 +63,6 @@ abstract public class ValidateTask {
public void validatePurchase(final String sku) {
new AsyncTask<String, String, String>() {
-
private ProgressDialog dialog;
@Override
@@ -113,7 +112,6 @@ abstract public class ValidateTask {
error(e.getMessage());
}
}
-
}
.execute();
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 9188f09f21..cc512263bc 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -124,6 +124,10 @@ void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
gl_extensions = p_gl_extensions;
}
+int OS_Android::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
bool use_gl3 = get_gl_version_code_func() >= 0x00030000;
@@ -136,9 +140,11 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
if (use_gl2) {
RasterizerGLES2::register_config();
RasterizerGLES2::make_current();
+ video_driver_index = VIDEO_DRIVER_GLES2;
} else {
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
+ video_driver_index = VIDEO_DRIVER_GLES3;
}
visual_server = memnew(VisualServerRaster);
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index ac901d4832..c4220906a3 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -137,6 +137,7 @@ private:
AlertFunc alert_func;
//power_android *power_manager;
+ int video_driver_index;
public:
// functions used by main to initialize/deintialize the OS
@@ -146,6 +147,8 @@ public:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);