Monado OpenXR Runtime
android_instance_base Struct Reference

A basic implementation of the xrt_instance_android interface, a platform-specific "aspect" of xrt_instance. More...

#include <android/android_instance_base.h>

Collaboration diagram for android_instance_base:

Public Member Functions

xrt_result_t android_instance_base_init (struct android_instance_base *aib, struct xrt_instance *xinst, const struct xrt_instance_info *ii)
 Initialize resources owned by android_instance_base and sets the xrt_instance::android_instance pointer. More...
 
void android_instance_base_cleanup (struct android_instance_base *aib, struct xrt_instance *xinst)
 Release resources owned by android_instance_base and unsets the aspect pointer. More...
 

Data Fields

struct xrt_instance_android base
 
struct _JavaVM * vm
 
void * context
 
struct android_lifecycle_callbackslifecycle_callbacks
 

Detailed Description

A basic implementation of the xrt_instance_android interface, a platform-specific "aspect" of xrt_instance.

Store nested in your xrt_instance implementation (by value, not separately allocated), and call android_instance_base_init in your instance creation and android_instance_base_cleanup in instance destruction.

Member Function Documentation

◆ android_instance_base_cleanup()

void android_instance_base_cleanup ( struct android_instance_base aib,
struct xrt_instance xinst 
)

Release resources owned by android_instance_base and unsets the aspect pointer.

  • but does not free aib itself, since it is intended to be held by value.
Parameters
aibThe object to de-initialize.
xinstThe xrt_instance to update.

References xrt_instance::android_instance, and android_lifecycle_callbacks::android_lifecycle_callbacks_destroy().

◆ android_instance_base_init()

xrt_result_t android_instance_base_init ( struct android_instance_base aib,
struct xrt_instance xinst,
const struct xrt_instance_info ii 
)

Initialize resources owned by android_instance_base and sets the xrt_instance::android_instance pointer.

Parameters
aibThe object to initialize.
xinstThe xrt_instance to update.
vmThe JavaVM pointer.
activityThe activity jobject, cast to a void pointer.
Returns
XRT_SUCCESS on success, XRT_ERROR_ALLOCATION if we could not allocate our required objects, and XRT_ERROR_ANDROID if something goes very wrong with Java/JNI that should be impossible and likely indicates a logic error in the code.

The documentation for this struct was generated from the following file: