KhronosGroup / OpenXR-Tutorials

OpenXR Tutorials
https://www.openxr-tutorial.com/
Apache License 2.0
76 stars 15 forks source link

Use of ALooper_pollOnce has been Deprecated in later Android releases #133

Closed Neil-Clifford-FB closed 2 weeks ago

Neil-Clifford-FB commented 2 months ago

as per: https://developer.android.com/ndk/reference/group/looper#:~:text=Calls%20to%20ALooper_pollAll%20should%20be,if%20they%20also%20indicate%20ALOOPER_POLL_WAKE.

The example code as part of the tutorial still makes use of ALooper_pollAll and needs to be replace with ALooper_pollOnce

e.g.

--- a/packages/apps/samples/OpenXRTutorial/src/cpp/main.cpp
+++ b/packages/apps/samples/OpenXRTutorial/src/cpp/main.cpp
@@ -787,7 +787,7 @@ class OpenXRTutorial {
       const int timeoutMilliseconds =
           (!androidAppState.resumed && !m_sessionRunning && androidApp->destroyRequested == 0) ? -1
                                                                                                : 0;
-      if (ALooper_pollAll(timeoutMilliseconds, nullptr, &events, (void**)&source) >= 0) {
+      if (ALooper_pollOnce(timeoutMilliseconds, nullptr, &events, (void**)&source) == ALOOPER_POLL_CALLBACK) {
         if (source != nullptr) {
           source->process(androidApp, source);
         }
rpavlik-bot commented 3 weeks ago

An issue (number 2374) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2374 ), to facilitate working group processes.

This GitHub issue will continue to be the main site of discussion.