The open source OpenXR runtime
0
fork

Configure Feed

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

targets: Add service-lib stub for Android

+79 -2
+9 -2
src/xrt/targets/CMakeLists.txt
··· 19 19 endif() 20 20 21 21 if(XRT_FEATURE_SERVICE) 22 - add_subdirectory(ctl) 23 - add_subdirectory(service) 22 + add_subdirectory(ctl) 23 + endif() 24 + 25 + if(XRT_FEATURE_SERVICE AND XRT_FEATURE_OPENXR) 26 + if(ANDROID) 27 + add_subdirectory(service-lib) 28 + else() 29 + add_subdirectory(service) 30 + endif() 24 31 endif()
+22
src/xrt/targets/service-lib/CMakeLists.txt
··· 1 + # Copyright 2020, Collabora, Ltd. 2 + # SPDX-License-Identifier: BSL-1.0 3 + 4 + 5 + add_library(monado-service MODULE 6 + lib.cpp 7 + ) 8 + 9 + target_link_libraries(monado-service PRIVATE 10 + aux_util 11 + st_prober 12 + ipc_server 13 + comp_main 14 + target_lists 15 + target_instance 16 + xrt-external-jni-wrap 17 + ) 18 + 19 + set_target_properties(monado-service 20 + PROPERTIES 21 + CXX_STANDARD 17 22 + CXX_STANDARD_REQUIRED ON)
+48
src/xrt/targets/service-lib/lib.cpp
··· 1 + // Copyright 2020, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Library exposing IPC server. 6 + * @author Ryan Pavlik <ryan.pavlik@collabora.com> 7 + * @ingroup ipc_android 8 + */ 9 + 10 + #include "target_lists.h" 11 + 12 + #include "jnipp.h" 13 + #include "jni.h" 14 + 15 + #include "wrap/android.os.h" 16 + #include "wrap/android.view.h" 17 + 18 + #include <android/native_window.h> 19 + #include <android/native_window_jni.h> 20 + 21 + using wrap::android::os::ParcelFileDescriptor; 22 + using wrap::android::view::Surface; 23 + 24 + extern "C" void 25 + Java_org_freedesktop_monado_ipc_MonadoImpl_nativeAddClient( 26 + JNIEnv *env, jobject thiz, jobject parcel_file_descriptor) 27 + { 28 + jni::init(env); 29 + //! @todo do something! 30 + // This may be the "entry point" of the native code, or we could already 31 + // have another client running, etc. 32 + 33 + ParcelFileDescriptor pfd(parcel_file_descriptor); 34 + jni::Object monadoImpl(thiz); 35 + } 36 + 37 + extern "C" void 38 + Java_org_freedesktop_monado_ipc_MonadoImpl_nativeAppSurface(JNIEnv *env, 39 + jobject thiz, 40 + jobject surface) 41 + { 42 + jni::init(env); 43 + Surface surf(surface); 44 + jni::Object monadoImpl(thiz); 45 + ANativeWindow *nativeWindow = ANativeWindow_fromSurface(env, surface); 46 + 47 + //! @todo do something! 48 + }