Merge "Initial checkin: optional permissions sample code" into jb-mr2-dev
diff --git a/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
index 814ce19..4e4b929 100644
--- a/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-3/arch-arm/symbols/libc.so.functions.txt
@@ -241,7 +241,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__sflags
diff --git a/ndk/platforms/android-3/include/elf.h b/ndk/platforms/android-3/include/elf.h
index 4bc17a6..cb8ffb7 100644
--- a/ndk/platforms/android-3/include/elf.h
+++ b/ndk/platforms/android-3/include/elf.h
@@ -52,6 +52,7 @@
AT_SECURE = 23
};
+#include <stdint.h>
#include <sys/exec_elf.h>
typedef struct {
diff --git a/ndk/platforms/android-3/include/errno.h b/ndk/platforms/android-3/include/errno.h
index e1b15c0..b97f6d2 100644
--- a/ndk/platforms/android-3/include/errno.h
+++ b/ndk/platforms/android-3/include/errno.h
@@ -40,16 +40,20 @@
#define ENOTSUP EOPNOTSUPP
#endif
-/* internal function that should *only* be called from system calls */
-/* use errno = xxxx instead in C code */
-extern int __set_errno(int error);
-
/* internal function returning the address of the thread-specific errno */
extern volatile int* __errno(void);
/* a macro expanding to the errno l-value */
#define errno (*__errno())
+/* internal function that should *only* be called from system calls */
+/* use errno = xxxx instead in C code */
+static __inline__ int __attribute__((deprecated))
+__set_errno(int n) {
+ errno = n;
+ return -1;
+}
+
__END_DECLS
#endif /* _ERRNO_H */
diff --git a/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
index 9608503..22616d4 100644
--- a/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-5/arch-arm/symbols/libc.so.functions.txt
@@ -273,7 +273,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__sflags
diff --git a/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
index 88dd1b7..917498f 100644
--- a/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-8/arch-arm/symbols/libc.so.functions.txt
@@ -284,7 +284,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__setresuid
diff --git a/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
index c1c4358..99eb2d4 100644
--- a/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-arm/symbols/libc.so.functions.txt
@@ -288,7 +288,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_tls
__setresuid
diff --git a/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
index 1c72ae9..b8a9554 100644
--- a/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-mips/symbols/libc.so.functions.txt
@@ -159,7 +159,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_thread_area
__set_tls
diff --git a/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt b/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
index 60772cc..2c7a608 100644
--- a/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
+++ b/ndk/platforms/android-9/arch-x86/symbols/libc.so.functions.txt
@@ -155,7 +155,6 @@
__rt_sigprocmask
__rt_sigtimedwait
__sclose
-__set_errno
__set_syscall_errno
__set_thread_area
__set_tls
diff --git a/ndk/sources/android/native_app_glue/android_native_app_glue.c b/ndk/sources/android/native_app_glue/android_native_app_glue.c
index 82fc030..0c526fa 100644
--- a/ndk/sources/android/native_app_glue/android_native_app_glue.c
+++ b/ndk/sources/android/native_app_glue/android_native_app_glue.c
@@ -186,15 +186,18 @@
static void process_input(struct android_app* app, struct android_poll_source* source) {
AInputEvent* event = NULL;
- if (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
+ int processed = 0;
+ while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
LOGV("New input event: type=%d\n", AInputEvent_getType(event));
if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
- return;
+ continue;
}
int32_t handled = 0;
if (app->onInputEvent != NULL) handled = app->onInputEvent(app, event);
AInputQueue_finishEvent(app->inputQueue, event, handled);
- } else {
+ processed = 1;
+ }
+ if (processed == 0) {
LOGE("Failure reading next input event: %s\n", strerror(errno));
}
}