Skip to content

Commit 7843579

Browse files
committed
Revert "Fixed bug #9792 - Android: build failure with ndk 27-beta1 due to use of deprecated ALooper_pollAll"
This reverts commit ee16d2f. @madebr's change was simpler and correct.
1 parent ee16d2f commit 7843579

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

src/sensor/android/SDL_androidsensor.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,30 +69,20 @@ static int SDLCALL SDL_ANDROID_SensorThread(void *data)
6969

7070
while (SDL_AtomicGet(&ctx->running)) {
7171
Uint64 timestamp = SDL_GetTicksNS();
72-
SDL_bool done = SDL_FALSE;
73-
74-
while (!done) {
75-
int result;
76-
77-
result = ALooper_pollOnce(-1, NULL, &events, (void **)&source);
78-
if (result == LOOPER_ID_USER) {
79-
SDL_LockSensors();
80-
for (i = 0; i < SDL_sensors_count; ++i) {
81-
if (!SDL_sensors[i].event_queue) {
82-
continue;
83-
}
84-
85-
SDL_zero(event);
86-
while (ASensorEventQueue_getEvents(SDL_sensors[i].event_queue, &event, 1) > 0) {
87-
SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor, timestamp, event.data, SDL_arraysize(event.data));
88-
}
72+
73+
if (ALooper_pollAll(-1, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
74+
SDL_LockSensors();
75+
for (i = 0; i < SDL_sensors_count; ++i) {
76+
if (!SDL_sensors[i].event_queue) {
77+
continue;
8978
}
90-
SDL_UnlockSensors();
91-
}
9279

93-
if (result < 0) {
94-
done = SDL_TRUE;
80+
SDL_zero(event);
81+
while (ASensorEventQueue_getEvents(SDL_sensors[i].event_queue, &event, 1) > 0) {
82+
SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor, timestamp, event.data, SDL_arraysize(event.data));
83+
}
9584
}
85+
SDL_UnlockSensors();
9686
}
9787
}
9888

0 commit comments

Comments
 (0)