summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-12-12 23:12:55 -0800
committerBrian Carlstrom <bdc@google.com>2013-12-18 17:56:35 -0800
commit82b007d7572dceb0981b269338bd1ac6c40496c5 (patch)
tree0adfd7d709e3fd4252f3f96c7ef72a9fae1f11d4 /native
parent7f8c70a1a48df91ee5541b03dc380c08ab6ebf42 (diff)
downloadframeworks_base-82b007d7572dceb0981b269338bd1ac6c40496c5.zip
frameworks_base-82b007d7572dceb0981b269338bd1ac6c40496c5.tar.gz
frameworks_base-82b007d7572dceb0981b269338bd1ac6c40496c5.tar.bz2
Track Looper decoupling from ALooper
Change-Id: I54f4d36f105e60eaaa453ae60f591d634c681fd7
Diffstat (limited to 'native')
-rw-r--r--native/android/input.cpp2
-rw-r--r--native/android/looper.cpp22
2 files changed, 16 insertions, 8 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index e9d08b4..fc52138 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -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);
}
diff --git a/native/android/looper.cpp b/native/android/looper.cpp
index 455e950..24cb234 100644
--- a/native/android/looper.cpp
+++ b/native/android/looper.cpp
@@ -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);
}