summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sal/Package_inc.mk1
-rw-r--r--sal/android/android_native_app_glue.c15
-rw-r--r--sal/android/lo-bootstrap.c3
-rw-r--r--sal/inc/osl/detail/android.h (renamed from sal/android/android_native_app_glue.h)7
4 files changed, 20 insertions, 6 deletions
diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk
index 7a5a77c320a8..d0520efcd757 100644
--- a/sal/Package_inc.mk
+++ b/sal/Package_inc.mk
@@ -64,6 +64,7 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/thread.hxx,osl/thread.hxx))
$(eval $(call gb_Package_add_file,sal_inc,inc/osl/time.h,osl/time.h))
$(eval $(call gb_Package_add_file,sal_inc,inc/osl/util.h,osl/util.h))
$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/file.h,osl/detail/file.h))
+$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android.h,osl/detail/android.h))
$(eval $(call gb_Package_add_file,sal_inc,inc/rtl/allocator.hxx,rtl/allocator.hxx))
$(eval $(call gb_Package_add_file,sal_inc,inc/rtl/alloc.h,rtl/alloc.h))
$(eval $(call gb_Package_add_file,sal_inc,inc/rtl/bootstrap.h,rtl/bootstrap.h))
diff --git a/sal/android/android_native_app_glue.c b/sal/android/android_native_app_glue.c
index 440f3db7513e..efd7a4b8c38e 100644
--- a/sal/android/android_native_app_glue.c
+++ b/sal/android/android_native_app_glue.c
@@ -22,7 +22,7 @@
#include <unistd.h>
#include <sys/resource.h>
-#include "android_native_app_glue.h"
+#include "osl/detail/android.h"
#include <android/log.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__))
@@ -236,9 +236,14 @@ static void* android_app_entry(void* param) {
// --------------------------------------------------------------------
static struct android_app* android_app_create(ANativeActivity* activity,
- void* savedState, size_t savedStateSize) {
+ void* savedState, size_t savedStateSize)
+{
struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app));
memset(android_app, 0, sizeof(struct android_app));
+
+ // get this across to VCL.
+ global_android_app = android_app;
+
android_app->activity = activity;
pthread_mutex_init(&android_app->mutex, NULL);
@@ -414,9 +419,13 @@ static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue)
android_app_set_input((struct android_app*)activity->instance, NULL);
}
+__attribute__ ((visibility("default"))) struct android_app *global_android_app = NULL;
+
__attribute__ ((visibility("default"))) void ANativeActivity_onCreate(ANativeActivity* activity,
- void* savedState, size_t savedStateSize) {
+ void* savedState, size_t savedStateSize)
+{
LOGI("Creating: %p\n", activity);
+
activity->callbacks->onDestroy = onDestroy;
activity->callbacks->onStart = onStart;
activity->callbacks->onResume = onResume;
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index d28c8e999a1b..bd9049432081 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1135,7 +1135,8 @@ lo_apk_lstat(const char *path,
}
name_size = strlen(pn);
- while (count--) {
+ while (count--)
+ {
if (letoh16(entry->filename_size) >= name_size &&
!memcmp(entry->data, pn, name_size) &&
(letoh16(entry->filename_size) == name_size || entry->data[name_size] == '/'))
diff --git a/sal/android/android_native_app_glue.h b/sal/inc/osl/detail/android.h
index 1b8c1f10725d..beb5b1d348a3 100644
--- a/sal/android/android_native_app_glue.h
+++ b/sal/inc/osl/detail/android.h
@@ -30,6 +30,11 @@
extern "C" {
#endif
+/*
+ * Global activity to be hooked by upper layers.
+ */
+extern struct android_app *global_android_app;
+
/**
* The native activity interface provided by <android/native_activity.h>
* is based on a set of application-provided callbacks that will be called
@@ -81,8 +86,6 @@ extern "C" {
* full usage example. Also look at the JavaDoc of NativeActivity.
*/
-struct android_app;
-
/**
* Data associated with an ALooper fd that will be returned as the "outData"
* when that source has data ready.