Replace epoll() with poll() and rename PollLoop to Looper.

As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).

Removed the dependence on specific constants from sys/poll.h such as
POLLIN.  Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports.  That should help make any future
under-the-hood implementation changes easier.

Fixed a couple of compiler warnings along the way.

Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
This commit is contained in:
Jeff Brown
2010-09-13 23:17:30 -07:00
parent c891d2b352
commit 4fe6c3e51b
27 changed files with 1308 additions and 1202 deletions

View File

@@ -21,7 +21,7 @@
#include <android/sensor.h>
#include <utils/RefBase.h>
#include <utils/PollLoop.h>
#include <utils/Looper.h>
#include <utils/Timers.h>
#include <gui/Sensor.h>
@@ -60,12 +60,12 @@ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type
}
ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
ALooper* looper, int ident, ALooper_callbackFunc* callback, void* data)
ALooper* looper, int ident, ALooper_callbackFunc callback, void* data)
{
sp<SensorEventQueue> queue =
static_cast<SensorManager*>(manager)->createEventQueue();
if (queue != 0) {
ALooper_addFd(looper, queue->getFd(), ident, POLLIN, callback, data);
ALooper_addFd(looper, queue->getFd(), ident, ALOOPER_EVENT_INPUT, callback, data);
queue->looper = looper;
queue->incStrong(manager);
}