Monado OpenXR Runtime
android_lifecycle_callbacks.cpp File Reference

Implementation of a callback collection for Android lifecycle events. More...

#include "android_lifecycle_callbacks.h"
#include "android_load_class.hpp"
#include "org.freedesktop.monado.auxiliary.hpp"
#include "xrt/xrt_config_android.h"
#include "xrt/xrt_android.h"
#include "util/u_logging.h"
#include "util/u_generic_callbacks.hpp"
#include "wrap/android.app.h"
#include <memory>
Include dependency graph for android_lifecycle_callbacks.cpp:

Data Structures

class  android_lifecycle_callbacks
 An object handling a collection of callbacks for the Android lifecycle. More...
 

Macros

#define CATCH_CLAUSES(ACTION, RET)
 

Functions

int android_lifecycle_callbacks_invoke (struct android_lifecycle_callbacks *alc, enum xrt_android_lifecycle_event event)
 
static void on_activity_created (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 JNI functions. More...
 
static void on_activity_started (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
static void on_activity_resumed (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
static void on_activity_paused (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
static void on_activity_stopped (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
static void on_activity_save_instance_state (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
static void on_activity_destroyed (JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
 
int android_lifecycle_callbacks_register_callback (struct android_lifecycle_callbacks *alc, xrt_android_lifecycle_event_handler_t callback, enum xrt_android_lifecycle_event event_mask, void *userdata)
 
int android_lifecycle_callbacks_remove_callback (struct android_lifecycle_callbacks *alc, xrt_android_lifecycle_event_handler_t callback, enum xrt_android_lifecycle_event event_mask, void *userdata)
 
struct android_lifecycle_callbacksandroid_lifecycle_callbacks_create (struct xrt_instance_android *xinst_android)
 
void android_lifecycle_callbacks_destroy (struct android_lifecycle_callbacks **ptr_callbacks)
 

Variables

static JNINativeMethod methods []
 

Detailed Description

Implementation of a callback collection for Android lifecycle events.

Author
Rylie Pavlik rylie.nosp@m..pav.nosp@m.lik@c.nosp@m.olla.nosp@m.bora..nosp@m.com

Macro Definition Documentation

◆ CATCH_CLAUSES

#define CATCH_CLAUSES (   ACTION,
  RET 
)
Value:
catch (std::exception const &e) \
{ \
U_LOG_E("Exception while " ACTION "! %s", e.what()); \
return RET; \
} \
catch (...) \
{ \
U_LOG_E("Unknown exception while " ACTION "!"); \
return RET; \
}

Function Documentation

◆ on_activity_created()

static void on_activity_created ( JNIEnv *  env,
jobject  thiz,
jlong  native_callback_ptr,
jobject  activity 
)
static

JNI functions.

Variable Documentation

◆ methods

JNINativeMethod methods[]
static
Initial value:
= {
{"nativeOnActivityCreated", "(JLandroid/app/Activity;)V", (void *)&on_activity_created},
{"nativeOnActivityStarted", "(JLandroid/app/Activity;)V", (void *)&on_activity_started},
{"nativeOnActivityResumed", "(JLandroid/app/Activity;)V", (void *)&on_activity_resumed},
{"nativeOnActivityPaused", "(JLandroid/app/Activity;)V", (void *)&on_activity_paused},
{"nativeOnActivityStopped", "(JLandroid/app/Activity;)V", (void *)&on_activity_stopped},
{"nativeOnActivitySaveInstanceState", "(JLandroid/app/Activity;)V", (void *)&on_activity_save_instance_state},
{"nativeOnActivityDestroyed", "(JLandroid/app/Activity;)V", (void *)&on_activity_destroyed},
}
static void on_activity_created(JNIEnv *env, jobject thiz, jlong native_callback_ptr, jobject activity)
JNI functions.
Definition: android_lifecycle_callbacks.cpp:45