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

Commit ac384071 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add java-to-native converters for input events."

parents 91c4daa4 1aaa2126
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#include <sys/types.h>
#include <android/keycodes.h>
#include <android/looper.h>
#include <jni.h>

#if !defined(__INTRODUCED_IN)
#define __INTRODUCED_IN(__api_level) /* nothing */
@@ -931,6 +932,15 @@ int32_t AInputEvent_getDeviceId(const AInputEvent* event);
/** Get the input event source. */
int32_t AInputEvent_getSource(const AInputEvent* event);

/**
 * Releases interface objects created by {@link AKeyEvent_fromJava()}
 * and {@link AMotionEvent_fromJava()}.
 * After returning, the specified AInputEvent* object becomes invalid and should no longer be used.
 * The underlying Java object remains valid and does not change its state.
 */

void AInputEvent_release(const AInputEvent* event);

/*** Accessors for key events only. ***/

/** Get the key event action. */
@@ -977,6 +987,15 @@ int64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
 */
int64_t AKeyEvent_getEventTime(const AInputEvent* key_event);

/**
 * Creates a native AInputEvent* object associated with the specified Java android.view.KeyEvent.
 * The result may be used with generic and KeyEvent-specific AInputEvent_* functions.
 * The object returned by this function must be disposed using {@link AInputEvent_release()}.
 * User must guarantee that lifetime for object referenced by keyEvent is prolongated
 * up to release of returned AInputEvent*.
 */
const AInputEvent* AKeyEvent_fromJava(JNIEnv* env, jobject keyEvent);

/*** Accessors for motion events only. ***/

/** Get the combined motion event action code and pointer index. */
@@ -1292,6 +1311,14 @@ float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, siz
float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
        int32_t axis, size_t pointer_index, size_t history_index);

/**
 * Creates a native AInputEvent* object associated with the specified Java android.view.MotionEvent.
 * The result may be used with generic and MotionEvent-specific AInputEvent_* functions.
 * The object returned by this function must be disposed using {@link AInputEvent_release()}.
 * User must guarantee that object referenced by motionEvent won't be recycled and
 * its lifetime is prolongated up to release of returned AInputEvent*.
 */
const AInputEvent* AMotionEvent_fromJava(JNIEnv* env, jobject motionEvent);

struct AInputQueue;
/**