Add new native Looper API.
This allows us to avoid exposing the file descriptor of
the event queue; instead, you attach an event queue to
a looper. This will also should allow native apps to be
written without the need for a separate thread, by attaching
the event queue to the main thread's looper and scheduling
their own messages there.
Change-Id: I38489282635895ae2cbfacb88599c1b1cad9b239
diff --git a/native/include/android/input.h b/native/include/android/input.h
index 7617662..75be85a 100644
--- a/native/include/android/input.h
+++ b/native/include/android/input.h
@@ -42,6 +42,7 @@
#include <sys/types.h>
#include <android/keycodes.h>
+#include <android/looper.h>
#ifdef __cplusplus
extern "C" {
@@ -533,12 +534,15 @@
typedef struct AInputQueue AInputQueue;
/*
- * Return a file descriptor for the queue, which you
- * can use to determine if there are events available. This
- * is typically used with select() or poll() to multiplex
- * with other kinds of events.
+ * Add this input queue to a looper for processing.
*/
-int AInputQueue_getFd(AInputQueue* queue);
+void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
+ ALooper_callbackFunc callback, void* data);
+
+/*
+ * Remove the input queue from the looper it is currently attached to.
+ */
+void AInputQueue_detachLooper(AInputQueue* queue);
/*
* Returns true if there are one or more events available in the