From f8680e6d01b64ea8745b8c0aa335e6a4b54d8958 Mon Sep 17 00:00:00 2001 From: Arpit Singh Date: Wed, 17 Jan 2024 15:30:16 +0000 Subject: Add NDK API to obtain Java InputEvent from Native AInputEvent This CL adds an NDK API to obtain a copy of native AInputEvent as Java InputEvent. Test: atest MotionEventTest KeyEventTest Bug: 298948992 Change-Id: If7b14867813f7b07bd628ebd6da7e3be4c3bb89e --- include/android/input.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/android/input.h') diff --git a/include/android/input.h b/include/android/input.h index 16d86af44c..b5c1e5c354 100644 --- a/include/android/input.h +++ b/include/android/input.h @@ -1490,6 +1490,14 @@ int32_t AMotionEvent_getClassification(const AInputEvent* motion_event) */ const AInputEvent* AMotionEvent_fromJava(JNIEnv* env, jobject motionEvent) __INTRODUCED_IN(31); +/** + * Creates a java android.view.InputEvent object that is a copy of the specified native + * {@link AInputEvent}. Returns null on error + * + * Available since API level 35. + */ +jobject AInputEvent_toJava(JNIEnv* env, const AInputEvent* aInputEvent) __INTRODUCED_IN(35); + struct AInputQueue; /** * Input queue -- cgit v1.2.3-59-g8ed1b