xrt: Add xrt_android header with info about Android lifecycle callbacks

Co-authored-By: Jarvis Huang <quic_jarvhuan@quicinc.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/1655>
This commit is contained in:
Rylie Pavlik 2021-03-16 17:26:32 -05:00
parent 8cf94c20a9
commit 78717c2c38
2 changed files with 53 additions and 0 deletions

View file

@ -1 +1,2 @@
- Move `xrt_instance_info` members to nested `xrt_application_info` struct, and add a parallel `xrt_platform_info`.
- Add `xrt/xrt_android.h` header.

View file

@ -0,0 +1,52 @@
// Copyright 2021-2024, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Header holding Android-specific details.
* @author Rylie Pavlik <rylie.pavlik@collabora.com>
* @ingroup xrt_iface
*/
#pragma once
#include "xrt/xrt_config_os.h"
#include "xrt/xrt_compiler.h"
#include "xrt/xrt_results.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _JavaVM;
struct xrt_instance_android;
struct xrt_instance_info;
/*!
* Distinguishes the possible Android lifecycle events from each other.
*
* Used as a bitmask when registering for callbacks.
*/
enum xrt_android_lifecycle_event
{
XRT_ANDROID_LIVECYCLE_EVENT_ON_CREATE = 1 << 0,
XRT_ANDROID_LIVECYCLE_EVENT_ON_DESTROY = 1 << 1,
XRT_ANDROID_LIVECYCLE_EVENT_ON_PAUSE = 1 << 2,
XRT_ANDROID_LIVECYCLE_EVENT_ON_RESUME = 1 << 3,
XRT_ANDROID_LIVECYCLE_EVENT_ON_START = 1 << 4,
XRT_ANDROID_LIVECYCLE_EVENT_ON_STOP = 1 << 5,
};
/*!
* A callback type for a handler of Android lifecycle events.
*
* Return true to be removed from the callback list.
*/
typedef bool (*xrt_android_lifecycle_event_handler_t)(struct xrt_instance_android *xinst_android,
enum xrt_android_lifecycle_event event,
void *userdata);
#ifdef __cplusplus
}
#endif