summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-09-07 18:52:06 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-07 18:52:06 -0700
commit347262622b86410ff8a4ff3530ab3688b6a20b21 (patch)
treef596d33ff54ab5169a7c52e19319b63d0e200e63 /native
parent7dea769319701f4e883fc448507967b806b9b245 (diff)
parenta1205f07a6f0c745e8f42f16fe38c06af04143c7 (diff)
downloadframeworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.zip
frameworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.tar.gz
frameworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.tar.bz2
am a1205f07: am 2d3739d4: Merge "Modify native ALooper to take an explicit ident." into gingerbread
Merge commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7' * commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7': Modify native ALooper to take an explicit ident.
Diffstat (limited to 'native')
-rw-r--r--native/android/input.cpp4
-rw-r--r--native/android/looper.cpp4
-rw-r--r--native/android/sensor.cpp4
-rw-r--r--native/include/android/input.h4
-rw-r--r--native/include/android/looper.h16
-rw-r--r--native/include/android/sensor.h2
6 files changed, 18 insertions, 16 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 379960a..c79f913 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -246,8 +246,8 @@ float AMotionEvent_getHistoricalOrientation(AInputEvent* motion_event, size_t po
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
- ALooper_callbackFunc* callback, void* data) {
- queue->attachLooper(looper, callback, data);
+ int ident, ALooper_callbackFunc* callback, void* data) {
+ queue->attachLooper(looper, ident, callback, data);
}
void AInputQueue_detachLooper(AInputQueue* queue) {
diff --git a/native/android/looper.cpp b/native/android/looper.cpp
index 1564c47..0aeed77 100644
--- a/native/android/looper.cpp
+++ b/native/android/looper.cpp
@@ -72,9 +72,9 @@ void ALooper_release(ALooper* looper) {
static_cast<PollLoop*>(looper)->decStrong((void*)ALooper_acquire);
}
-void ALooper_addFd(ALooper* looper, int fd, int events,
+void ALooper_addFd(ALooper* looper, int fd, int ident, int events,
ALooper_callbackFunc* callback, void* data) {
- static_cast<PollLoop*>(looper)->setLooperCallback(fd, events, callback, data);
+ static_cast<PollLoop*>(looper)->setLooperCallback(fd, ident, events, callback, data);
}
int32_t ALooper_removeFd(ALooper* looper, int fd) {
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index db534e0..cf7635d 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -60,12 +60,12 @@ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type
}
ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
- ALooper* looper, 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(), POLLIN, callback, data);
+ ALooper_addFd(looper, queue->getFd(), ident, POLLIN, callback, data);
queue->looper = looper;
queue->incStrong(manager);
}
diff --git a/native/include/android/input.h b/native/include/android/input.h
index 418f609..5b62da4 100644
--- a/native/include/android/input.h
+++ b/native/include/android/input.h
@@ -623,10 +623,10 @@ typedef struct AInputQueue AInputQueue;
/*
* Add this input queue to a looper for processing. See
- * ALooper_addFd() for information on the callback and data params.
+ * ALooper_addFd() for information on the ident, callback, and data params.
*/
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
- ALooper_callbackFunc* callback, void* data);
+ int ident, ALooper_callbackFunc* callback, void* data);
/*
* Remove the input queue from the looper it is currently attached to.
diff --git a/native/include/android/looper.h b/native/include/android/looper.h
index 2917216..287bcd5 100644
--- a/native/include/android/looper.h
+++ b/native/include/android/looper.h
@@ -111,7 +111,7 @@ enum {
*
* Returns ALOPER_POLL_ERROR if an error occurred.
*
- * Returns a value >= 0 containing a file descriptor if it has data
+ * Returns a value >= 0 containing an identifier if its file descriptor has data
* and it has no callback function (requiring the caller here to handle it).
* In this (and only this) case outEvents and outData will contain the poll
* events and data associated with the fd.
@@ -145,10 +145,12 @@ void ALooper_release(ALooper* looper);
* descriptor was previously added, it is replaced.
*
* "fd" is the file descriptor to be added.
+ * "ident" is an identifier for this event, which is returned from
+ * ALooper_pollOnce(). Must be >= 0, or ALOOPER_POLL_CALLBACK if
+ * providing a non-NULL callback.
* "events" are the poll events to wake up on. Typically this is POLLIN.
* "callback" is the function to call when there is an event on the file
* descriptor.
- * "id" is an identifier to associated with this file descriptor, or 0.
* "data" is a private data pointer to supply to the callback.
*
* There are two main uses of this function:
@@ -156,13 +158,13 @@ void ALooper_release(ALooper* looper);
* (1) If "callback" is non-NULL, then
* this function will be called when there is data on the file descriptor. It
* should execute any events it has pending, appropriately reading from the
- * file descriptor.
+ * file descriptor. The 'ident' is ignored in this case.
*
- * (2) If "callback" is NULL, the fd will be returned by ALooper_pollOnce
- * when it has data available, requiring the caller to take care of processing
- * it.
+ * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce
+ * when its file descriptor has data available, requiring the caller to take
+ * care of processing it.
*/
-void ALooper_addFd(ALooper* looper, int fd, int events,
+void ALooper_addFd(ALooper* looper, int fd, int ident, int events,
ALooper_callbackFunc* callback, void* data);
/**
diff --git a/native/include/android/sensor.h b/native/include/android/sensor.h
index b4ce024..a102d43 100644
--- a/native/include/android/sensor.h
+++ b/native/include/android/sensor.h
@@ -166,7 +166,7 @@ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type
* Creates a new sensor event queue and associate it with a looper.
*/
ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
- ALooper* looper, ALooper_callbackFunc* callback, void* data);
+ ALooper* looper, int ident, ALooper_callbackFunc* callback, void* data);
/*
* Destroys the event queue and free all resources associated to it.