The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+53
+1
doc/changes/xrt/mr.1655.md
··· 1 1 - Move `xrt_instance_info` members to nested `xrt_application_info` struct, and add a parallel `xrt_platform_info`. 2 + - Add `xrt/xrt_android.h` header.
+52
src/xrt/include/xrt/xrt_android.h
··· 1 + // Copyright 2021-2024, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Header holding Android-specific details. 6 + * @author Rylie Pavlik <rylie.pavlik@collabora.com> 7 + * @ingroup xrt_iface 8 + */ 9 + 10 + #pragma once 11 + 12 + #include "xrt/xrt_config_os.h" 13 + #include "xrt/xrt_compiler.h" 14 + #include "xrt/xrt_results.h" 15 + 16 + #include <stdbool.h> 17 + 18 + #ifdef __cplusplus 19 + extern "C" { 20 + #endif 21 + 22 + struct _JavaVM; 23 + struct xrt_instance_android; 24 + struct xrt_instance_info; 25 + 26 + /*! 27 + * Distinguishes the possible Android lifecycle events from each other. 28 + * 29 + * Used as a bitmask when registering for callbacks. 30 + */ 31 + enum xrt_android_lifecycle_event 32 + { 33 + XRT_ANDROID_LIVECYCLE_EVENT_ON_CREATE = 1 << 0, 34 + XRT_ANDROID_LIVECYCLE_EVENT_ON_DESTROY = 1 << 1, 35 + XRT_ANDROID_LIVECYCLE_EVENT_ON_PAUSE = 1 << 2, 36 + XRT_ANDROID_LIVECYCLE_EVENT_ON_RESUME = 1 << 3, 37 + XRT_ANDROID_LIVECYCLE_EVENT_ON_START = 1 << 4, 38 + XRT_ANDROID_LIVECYCLE_EVENT_ON_STOP = 1 << 5, 39 + }; 40 + 41 + /*! 42 + * A callback type for a handler of Android lifecycle events. 43 + * 44 + * Return true to be removed from the callback list. 45 + */ 46 + typedef bool (*xrt_android_lifecycle_event_handler_t)(struct xrt_instance_android *xinst_android, 47 + enum xrt_android_lifecycle_event event, 48 + void *userdata); 49 + 50 + #ifdef __cplusplus 51 + } 52 + #endif