Attempt to solve Android ANR issues - found this -

https://developer.nvidia.com/content/nativeactivity-input-crashes-and-anrs-simple-fix-dangerous-bug
This commit is contained in:
twinaphex 2013-07-29 15:13:02 +02:00
parent c7d3c9e955
commit 32ca64e3a3

View File

@ -1585,20 +1585,21 @@ static void android_input_poll(void *data)
// Read all pending events. // Read all pending events.
while (AInputQueue_hasEvents(android_app->inputQueue)) while (AInputQueue_hasEvents(android_app->inputQueue))
{ {
if (AInputQueue_getEvent(android_app->inputQueue, &event) >= 0) int processed = 0;
while (AInputQueue_getEvent(android_app->inputQueue, &event) >= 0)
{ {
bool long_msg_enable = false; bool long_msg_enable = false;
int32_t handled = 1; int32_t handled = 1;
int action = 0; int action = 0;
char msg[128]; char msg[128];
int source, id, keycode, type_event, state_id; int source, id, keycode, type_event, state_id;
//int predispatched; int predispatched;
msg[0] = 0; msg[0] = 0;
//predispatched =AInputQueue_preDispatchEvent(android_app->inputQueue,event); predispatched =AInputQueue_preDispatchEvent(android_app->inputQueue,event);
//if (predispatched) if (predispatched)
//continue; continue;
source = AInputEvent_getSource(event); source = AInputEvent_getSource(event);
id = AInputEvent_getDeviceId(event); id = AInputEvent_getDeviceId(event);
@ -1747,7 +1748,10 @@ static void android_input_poll(void *data)
msg_queue_push(g_extern.msg_queue, msg, 0, long_msg_enable ? 180 : 30); msg_queue_push(g_extern.msg_queue, msg, 0, long_msg_enable ? 180 : 30);
AInputQueue_finishEvent(android_app->inputQueue, event, handled); AInputQueue_finishEvent(android_app->inputQueue, event, handled);
processed = 1;
} }
if (processed == 0)
RARCH_WARN("Failure reading next input event: %s\n", strerror(errno));
} }
} }
else if (ident == LOOPER_ID_MAIN) else if (ident == LOOPER_ID_MAIN)