Files
android_translation_layer/src/api-impl-jni/util.h

110 lines
2.3 KiB
C
Raw Normal View History

#ifndef _UTILS_H_
#define _UTILS_H_
#include <jni.h>
#include "defines.h"
struct handle_cache {
struct {
jclass class;
jmethodID onCreate;
jmethodID onStart;
jmethodID onResume;
jmethodID onWindowFocusChanged;
jmethodID onDestroy;
2023-08-11 18:09:17 +02:00
jmethodID onStop;
jmethodID onPause;
} apk_main_activity;
struct {
jclass class;
jmethodID getAttributeValue_string;
jmethodID getAttributeValue_int;
} attribute_set;
struct {
jclass class;
jmethodID add;
jmethodID remove;
jmethodID get;
jmethodID size;
jmethodID clear;
} array_list;
struct {
jclass class;
jmethodID getColor;
} paint;
struct {
jclass class;
jmethodID constructor;
} motion_event;
struct {
jclass class;
jmethodID constructor;
} canvas;
struct {
jclass class;
jmethodID onSurfaceCreated;
jmethodID onSurfaceChanged;
jmethodID onDrawFrame;
} renderer;
struct {
jclass class;
jmethodID onTouchEvent;
jmethodID wrap_EGLContextFactory_createContext;
jmethodID wrap_EGLConfigChooser_chooseConfig;
} gl_surface_view;
struct {
jclass class;
jmethodID onPeriodicNotification;
} audio_track_periodic_listener;
struct {
jclass class;
jmethodID onInputQueueCreated;
} input_queue_callback;
struct {
jclass class;
jmethodID surfaceCreated;
} surface_holder_callback;
struct {
jclass class;
jmethodID setLayoutParams;
jmethodID onDraw;
jmethodID onMeasure;
jmethodID onLayout;
jmethodID getMeasuredWidth;
jmethodID getMeasuredHeight;
jmethodID getSuggestedMinimumWidth;
jmethodID getSuggestedMinimumHeight;
jmethodID setMeasuredDimension;
2023-08-22 18:08:16 +02:00
jmethodID onGenericMotionEvent;
jmethodID computeScroll;
jmethodID getScrollX;
jmethodID getScrollY;
} view;
struct {
jclass class;
jmethodID extractFromAPK;
} asset_manager;
2023-08-12 13:09:33 +02:00
struct {
jclass class;
jmethodID get_package_name;
} context;
struct {
jclass class;
jmethodID get_app_icon_path;
} application;
};
extern struct handle_cache handle_cache;
2023-08-11 18:09:17 +02:00
JNIEnv * get_jni_env(void);
const char * attribute_set_get_string(JNIEnv *env, jobject attrs, char *attribute, char *schema);
int attribute_set_get_int(JNIEnv *env, jobject attrs, char *attribute, char *schema, int default_value);
void set_up_handle_cache(JNIEnv *env);
void extract_from_apk(const char *path, const char *target);
void prepare_main_looper(JNIEnv* env);
#endif