Merge "Give access to the native InputQueue to all native applications."
This commit is contained in:
@@ -39,6 +39,7 @@ namespace android {
|
||||
|
||||
static struct {
|
||||
jmethodID finishInputEvent;
|
||||
jmethodID getNativePtr;
|
||||
} gInputQueueClassInfo;
|
||||
|
||||
enum {
|
||||
@@ -263,8 +264,15 @@ int register_android_view_InputQueue(JNIEnv* env)
|
||||
jclass clazz = FindClassOrDie(env, kInputQueuePathName);
|
||||
gInputQueueClassInfo.finishInputEvent = GetMethodIDOrDie(env, clazz, "finishInputEvent",
|
||||
"(JZ)V");
|
||||
gInputQueueClassInfo.getNativePtr = GetMethodIDOrDie(env, clazz, "getNativePtr", "()J");
|
||||
|
||||
return RegisterMethodsOrDie(env, kInputQueuePathName, g_methods, NELEM(g_methods));
|
||||
}
|
||||
|
||||
AInputQueue* android_view_InputQueue_getNativePtr(jobject inputQueue) {
|
||||
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||
jlong ptr = env->CallLongMethod(inputQueue, gInputQueueClassInfo.getNativePtr);
|
||||
return reinterpret_cast<AInputQueue*>(ptr);
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -80,6 +80,8 @@ private:
|
||||
Vector<key_value_pair_t<InputEvent*, bool> > mFinishedEvents;
|
||||
};
|
||||
|
||||
extern AInputQueue* android_view_InputQueue_getNativePtr(jobject inputQueue);
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif
|
||||
|
||||
@@ -329,3 +329,7 @@ void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled
|
||||
InputEvent* e = static_cast<InputEvent*>(event);
|
||||
iq->finishEvent(e, handled != 0);
|
||||
}
|
||||
|
||||
AInputQueue* AInputQueue_fromJava(jobject inputQueue) {
|
||||
return android::android_view_InputQueue_getNativePtr(inputQueue);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ LIBANDROID {
|
||||
AInputQueue_attachLooper;
|
||||
AInputQueue_detachLooper;
|
||||
AInputQueue_finishEvent;
|
||||
AInputQueue_fromJava; # introduced=Tiramisu
|
||||
AInputQueue_getEvent;
|
||||
AInputQueue_hasEvents;
|
||||
AInputQueue_preDispatchEvent;
|
||||
|
||||
Reference in New Issue
Block a user