Pass JNIEnv explicitly into AInputQueue_fromJava
Instead of assuming a JNIEnv*, the method should have the env passed into it, which is the standard practice for native APIs. Bug: 210727635 Test: atest InputQueueTest Change-Id: Iae5fc5bd39c758c530185694751d6d79715ce31b
This commit is contained in:
parent
ca3f277231
commit
d0c5dbabd5
@ -269,8 +269,7 @@ int register_android_view_InputQueue(JNIEnv* env)
|
||||
return RegisterMethodsOrDie(env, kInputQueuePathName, g_methods, NELEM(g_methods));
|
||||
}
|
||||
|
||||
AInputQueue* android_view_InputQueue_getNativePtr(jobject inputQueue) {
|
||||
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||
AInputQueue* android_view_InputQueue_getNativePtr(JNIEnv* env, jobject inputQueue) {
|
||||
jlong ptr = env->CallLongMethod(inputQueue, gInputQueueClassInfo.getNativePtr);
|
||||
return reinterpret_cast<AInputQueue*>(ptr);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
Vector<key_value_pair_t<InputEvent*, bool> > mFinishedEvents;
|
||||
};
|
||||
|
||||
extern AInputQueue* android_view_InputQueue_getNativePtr(jobject inputQueue);
|
||||
extern AInputQueue* android_view_InputQueue_getNativePtr(JNIEnv* env, jobject inputQueue);
|
||||
|
||||
} // namespace android
|
||||
|
||||
|
@ -330,6 +330,6 @@ void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled
|
||||
iq->finishEvent(e, handled != 0);
|
||||
}
|
||||
|
||||
AInputQueue* AInputQueue_fromJava(jobject inputQueue) {
|
||||
return android::android_view_InputQueue_getNativePtr(inputQueue);
|
||||
AInputQueue* AInputQueue_fromJava(JNIEnv* env, jobject inputQueue) {
|
||||
return android::android_view_InputQueue_getNativePtr(env, inputQueue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user