SDL: Revert "Fixed bug #9792 - Android: build failure with ndk 27-beta1 due to use of deprecated ALooper_pollAll"

From 78435793589cc1336d1dac7bc5f45776c8af945e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 16 May 2024 07:52:32 -0700
Subject: [PATCH] Revert "Fixed bug #9792 - Android: build failure with ndk
 27-beta1 due to use of deprecated ALooper_pollAll"

This reverts commit ee16d2f7052b4e7cdcb9fb0d05d7d76bb7e62fc9.

@madebr's change was simpler and correct.
---
 src/sensor/android/SDL_androidsensor.c | 32 +++++++++-----------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/sensor/android/SDL_androidsensor.c b/src/sensor/android/SDL_androidsensor.c
index fea4fe815e3a9..eb46dd5e046a3 100644
--- a/src/sensor/android/SDL_androidsensor.c
+++ b/src/sensor/android/SDL_androidsensor.c
@@ -69,30 +69,20 @@ static int SDLCALL SDL_ANDROID_SensorThread(void *data)
 
     while (SDL_AtomicGet(&ctx->running)) {
         Uint64 timestamp = SDL_GetTicksNS();
-        SDL_bool done = SDL_FALSE;
-
-        while (!done) {
-            int result;
-
-            result = ALooper_pollOnce(-1, NULL, &events, (void **)&source);
-            if (result == LOOPER_ID_USER) {
-                SDL_LockSensors();
-                for (i = 0; i < SDL_sensors_count; ++i) {
-                    if (!SDL_sensors[i].event_queue) {
-                        continue;
-                    }
-
-                    SDL_zero(event);
-                    while (ASensorEventQueue_getEvents(SDL_sensors[i].event_queue, &event, 1) > 0) {
-                        SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor, timestamp, event.data, SDL_arraysize(event.data));
-                    }
+
+        if (ALooper_pollAll(-1, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
+            SDL_LockSensors();
+            for (i = 0; i < SDL_sensors_count; ++i) {
+                if (!SDL_sensors[i].event_queue) {
+                    continue;
                 }
-                SDL_UnlockSensors();
-            }
 
-            if (result < 0) {
-                done = SDL_TRUE;
+                SDL_zero(event);
+                while (ASensorEventQueue_getEvents(SDL_sensors[i].event_queue, &event, 1) > 0) {
+                    SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor, timestamp, event.data, SDL_arraysize(event.data));
+                }
             }
+            SDL_UnlockSensors();
         }
     }