SDL: android+test: testcamera needs CAMERA permissions

From 88980aeb215f574c4c19bcaa2dca0785c8171c43 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Thu, 16 May 2024 16:43:53 +0200
Subject: [PATCH] android+test: testcamera needs CAMERA permissions

---
 src/sensor/android/SDL_androidsensor.c       | 4 +++-
 test/android/cmake/AndroidManifest.xml.cmake | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/sensor/android/SDL_androidsensor.c b/src/sensor/android/SDL_androidsensor.c
index eb46dd5e046a3..7720ccc255a2c 100644
--- a/src/sensor/android/SDL_androidsensor.c
+++ b/src/sensor/android/SDL_androidsensor.c
@@ -69,8 +69,10 @@ static int SDLCALL SDL_ANDROID_SensorThread(void *data)
 
     while (SDL_AtomicGet(&ctx->running)) {
         Uint64 timestamp = SDL_GetTicksNS();
+        int poll_result;
 
-        if (ALooper_pollAll(-1, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
+        poll_result = ALooper_pollOnce(-1, NULL, &events, (void **)&source);
+        if (poll_result == LOOPER_ID_USER) {
             SDL_LockSensors();
             for (i = 0; i < SDL_sensors_count; ++i) {
                 if (!SDL_sensors[i].event_queue) {
diff --git a/test/android/cmake/AndroidManifest.xml.cmake b/test/android/cmake/AndroidManifest.xml.cmake
index ae2ead0c23e3b..a9fc3d5688508 100644
--- a/test/android/cmake/AndroidManifest.xml.cmake
+++ b/test/android/cmake/AndroidManifest.xml.cmake
@@ -33,6 +33,10 @@
     <!-- Allow access to the microphone -->
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
 
+    <!-- Allow access to the camera -->
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-feature android:name="android.hardware.camera" />
+
     <application
         android:allowBackup="true"
         android:icon="@mipmap/sdl-test"