The open source OpenXR runtime
0
fork

Configure Feed

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

a/android: Use android_custom_surface constructor/destructor

+6 -4
+6 -4
src/xrt/auxiliary/android/android_custom_surface.cpp
··· 19 19 20 20 #include <android/native_window_jni.h> 21 21 22 - #include "jni.h" 23 22 24 23 using wrap::android::app::Activity; 25 24 using wrap::android::view::SurfaceHolder; ··· 27 26 28 27 struct android_custom_surface 29 28 { 29 + explicit android_custom_surface(jobject act); 30 30 ~android_custom_surface(); 31 31 Activity activity{}; 32 32 jni::Class monadoViewClass{}; ··· 34 34 jni::method_t waitGetSurfaceHolderMethod = nullptr; 35 35 jni::method_t markAsDiscardedMethod = nullptr; 36 36 }; 37 + 38 + 39 + android_custom_surface::android_custom_surface(jobject act) : activity(act) {} 37 40 38 41 android_custom_surface::~android_custom_surface() 39 42 { 43 + // Tell Java that native code is done with this. 40 44 if (!monadoView.isNull() && markAsDiscardedMethod != nullptr) { 41 45 try { 42 46 monadoView.call<void>(markAsDiscardedMethod); ··· 58 62 jni::method_t attachToActivity; 59 63 try { 60 64 std::unique_ptr<android_custom_surface> ret = 61 - std::make_unique<android_custom_surface>(); 62 - 63 - ret->activity = Activity((jobject)activity); 65 + std::make_unique<android_custom_surface>((jobject)activity); 64 66 auto info = getAppInfo(XRT_ANDROID_PACKAGE, (jobject)activity); 65 67 if (info.isNull()) { 66 68 U_LOG_E(