Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0c5dbab authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

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
parent ca3f2772
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);
}
+1 −1
Original line number Diff line number Diff line
@@ -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

+2 −2
Original line number Diff line number Diff line
@@ -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);
}