Merge "Track Looper decoupling from ALooper"
This commit is contained in:
@@ -87,7 +87,7 @@ status_t NativeDisplayEventReceiver::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
int rc = mMessageQueue->getLooper()->addFd(mReceiver.getFd(), 0, ALOOPER_EVENT_INPUT,
|
||||
int rc = mMessageQueue->getLooper()->addFd(mReceiver.getFd(), 0, Looper::EVENT_INPUT,
|
||||
this, NULL);
|
||||
if (rc < 0) {
|
||||
return UNKNOWN_ERROR;
|
||||
@@ -125,13 +125,13 @@ status_t NativeDisplayEventReceiver::scheduleVsync() {
|
||||
}
|
||||
|
||||
int NativeDisplayEventReceiver::handleEvent(int receiveFd, int events, void* data) {
|
||||
if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) {
|
||||
if (events & (Looper::EVENT_ERROR | Looper::EVENT_HANGUP)) {
|
||||
ALOGE("Display event receiver pipe was closed or an error occurred. "
|
||||
"events=0x%x", events);
|
||||
return 0; // remove the callback
|
||||
}
|
||||
|
||||
if (!(events & ALOOPER_EVENT_INPUT)) {
|
||||
if (!(events & Looper::EVENT_INPUT)) {
|
||||
ALOGW("Received spurious callback for unhandled poll event. "
|
||||
"events=0x%x", events);
|
||||
return 1; // keep the callback
|
||||
|
||||
@@ -273,7 +273,7 @@ float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
|
||||
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
|
||||
int ident, ALooper_callbackFunc callback, void* data) {
|
||||
InputQueue* iq = static_cast<InputQueue*>(queue);
|
||||
Looper* l = static_cast<Looper*>(looper);
|
||||
Looper* l = reinterpret_cast<Looper*>(looper);
|
||||
iq->attachLooper(l, ident, callback, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,20 +25,28 @@ using android::Looper;
|
||||
using android::sp;
|
||||
using android::IPCThreadState;
|
||||
|
||||
static inline Looper* ALooper_to_Looper(ALooper* alooper) {
|
||||
return reinterpret_cast<Looper*>(alooper);
|
||||
}
|
||||
|
||||
static inline ALooper* Looper_to_ALooper(Looper* looper) {
|
||||
return reinterpret_cast<ALooper*>(looper);
|
||||
}
|
||||
|
||||
ALooper* ALooper_forThread() {
|
||||
return Looper::getForThread().get();
|
||||
return Looper_to_ALooper(Looper::getForThread().get());
|
||||
}
|
||||
|
||||
ALooper* ALooper_prepare(int opts) {
|
||||
return Looper::prepare(opts).get();
|
||||
return Looper_to_ALooper(Looper::prepare(opts).get());
|
||||
}
|
||||
|
||||
void ALooper_acquire(ALooper* looper) {
|
||||
static_cast<Looper*>(looper)->incStrong((void*)ALooper_acquire);
|
||||
ALooper_to_Looper(looper)->incStrong((void*)ALooper_acquire);
|
||||
}
|
||||
|
||||
void ALooper_release(ALooper* looper) {
|
||||
static_cast<Looper*>(looper)->decStrong((void*)ALooper_acquire);
|
||||
ALooper_to_Looper(looper)->decStrong((void*)ALooper_acquire);
|
||||
}
|
||||
|
||||
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData) {
|
||||
@@ -64,14 +72,14 @@ int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outDat
|
||||
}
|
||||
|
||||
void ALooper_wake(ALooper* looper) {
|
||||
static_cast<Looper*>(looper)->wake();
|
||||
ALooper_to_Looper(looper)->wake();
|
||||
}
|
||||
|
||||
int ALooper_addFd(ALooper* looper, int fd, int ident, int events,
|
||||
ALooper_callbackFunc callback, void* data) {
|
||||
return static_cast<Looper*>(looper)->addFd(fd, ident, events, callback, data);
|
||||
return ALooper_to_Looper(looper)->addFd(fd, ident, events, callback, data);
|
||||
}
|
||||
|
||||
int ALooper_removeFd(ALooper* looper, int fd) {
|
||||
return static_cast<Looper*>(looper)->removeFd(fd);
|
||||
return ALooper_to_Looper(looper)->removeFd(fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user