From 2bb10f4299f93f809bddb7683f6ba93277da6f28 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 22 Feb 2011 15:00:35 -0800 Subject: [PATCH] Fix poll options for NativeActivity's hasEvents NativeActivity created a pipe to wake up a Looper it's attached to, but it failed to set the right options for the read part of the pipe. This affects only the NativeActivity API call for AInputQueue_hasEvents Change-Id: I02e5dad4e700f4c724b3187a4b7e0df931dd1eed --- core/jni/android_app_NativeActivity.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 0430a819d02d3..56f2646e67ac7 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -150,12 +150,12 @@ int32_t AInputQueue::hasEvents() { pfd[0].events = POLLIN; pfd[0].revents = 0; pfd[1].fd = mDispatchKeyRead; - pfd[0].events = POLLIN; - pfd[0].revents = 0; + pfd[1].events = POLLIN; + pfd[1].revents = 0; int nfd = poll(pfd, 2, 0); if (nfd <= 0) return 0; - return (pfd[0].revents == POLLIN || pfd[1].revents == POLLIN) ? 1 : -1; + return ((pfd[0].revents & POLLIN) || (pfd[1].revents & POLLIN)) ? 1 : -1; } int32_t AInputQueue::getEvent(AInputEvent** outEvent) {