You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
call onStart when starting an activity; uncomment handler for onWindowFocusChanged in NativeActivity
This commit is contained in:
@@ -355,7 +355,7 @@ Java_android_app_NativeActivity_unloadNativeCode(JNIEnv* env, jobject clazz, jlo
|
|||||||
{
|
{
|
||||||
printf("STUB - unloadNativeCode_native\n");
|
printf("STUB - unloadNativeCode_native\n");
|
||||||
/*if (handle != 0) {
|
/*if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
NativeCode_destroy(code);
|
NativeCode_destroy(code);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,6 @@ Java_android_app_NativeActivity_unloadNativeCode(JNIEnv* env, jobject clazz, jlo
|
|||||||
void
|
void
|
||||||
Java_android_app_NativeActivity_onStartNative(JNIEnv* env, jobject clazz, jlong handle)
|
Java_android_app_NativeActivity_onStartNative(JNIEnv* env, jobject clazz, jlong handle)
|
||||||
{
|
{
|
||||||
printf("STUB - onStart_native\n");
|
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onStart != NULL) {
|
if (code->callbacks.onStart != NULL) {
|
||||||
@@ -392,7 +391,7 @@ Java_android_app_NativeActivity_onSaveInstanceStateNative(JNIEnv* env, jobject c
|
|||||||
jbyteArray array = NULL;
|
jbyteArray array = NULL;
|
||||||
|
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onSaveInstanceState != NULL) {
|
if (code->callbacks.onSaveInstanceState != NULL) {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
jbyte* state = (jbyte*)code->callbacks.onSaveInstanceState(code, &len);
|
jbyte* state = (jbyte*)code->callbacks.onSaveInstanceState(code, &len);
|
||||||
@@ -416,7 +415,7 @@ Java_android_app_NativeActivity_onPauseNative(JNIEnv* env, jobject clazz, jlong
|
|||||||
{
|
{
|
||||||
printf("STUB - onPause_native\n");
|
printf("STUB - onPause_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onPause != NULL) {
|
if (code->callbacks.onPause != NULL) {
|
||||||
code->callbacks.onPause(code);
|
code->callbacks.onPause(code);
|
||||||
}
|
}
|
||||||
@@ -428,7 +427,7 @@ Java_android_app_NativeActivity_onStopNative(JNIEnv* env, jobject clazz, jlong h
|
|||||||
{
|
{
|
||||||
printf("STUB - onStop_native\n");
|
printf("STUB - onStop_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onStop != NULL) {
|
if (code->callbacks.onStop != NULL) {
|
||||||
code->callbacks.onStop(code);
|
code->callbacks.onStop(code);
|
||||||
}
|
}
|
||||||
@@ -440,7 +439,7 @@ Java_android_app_NativeActivity_onConfigurationChangedNative(JNIEnv* env, jobjec
|
|||||||
{
|
{
|
||||||
printf("STUB - onConfigurationChanged_native\n");
|
printf("STUB - onConfigurationChanged_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onConfigurationChanged != NULL) {
|
if (code->callbacks.onConfigurationChanged != NULL) {
|
||||||
code->callbacks.onConfigurationChanged(code);
|
code->callbacks.onConfigurationChanged(code);
|
||||||
}
|
}
|
||||||
@@ -452,7 +451,7 @@ Java_android_app_NativeActivity_onLowMemoryNative(JNIEnv* env, jobject clazz, jl
|
|||||||
{
|
{
|
||||||
printf("STUB - onLowMemory_native\n");
|
printf("STUB - onLowMemory_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onLowMemory != NULL) {
|
if (code->callbacks.onLowMemory != NULL) {
|
||||||
code->callbacks.onLowMemory(code);
|
code->callbacks.onLowMemory(code);
|
||||||
}
|
}
|
||||||
@@ -462,13 +461,12 @@ Java_android_app_NativeActivity_onLowMemoryNative(JNIEnv* env, jobject clazz, jl
|
|||||||
void
|
void
|
||||||
Java_android_app_NativeActivity_onWindowFocusChangedNative(JNIEnv* env, jobject clazz, jlong handle, jboolean focused)
|
Java_android_app_NativeActivity_onWindowFocusChangedNative(JNIEnv* env, jobject clazz, jlong handle, jboolean focused)
|
||||||
{
|
{
|
||||||
printf("STUB - onWindowFocusChanged_native\n");
|
if (handle != 0) {
|
||||||
/* if (handle != 0) {
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
NativeCode* code = (NativeCode*)handle;
|
|
||||||
if (code->callbacks.onWindowFocusChanged != NULL) {
|
if (code->callbacks.onWindowFocusChanged != NULL) {
|
||||||
code->callbacks.onWindowFocusChanged(code, focused ? 1 : 0);
|
code->callbacks.onWindowFocusChanged(code, focused ? 1 : 0);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -476,7 +474,7 @@ Java_android_app_NativeActivity_onSurfaceCreatedNative(JNIEnv* env, jobject claz
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceCreated_native\n");
|
printf("STUB - onSurfaceCreated_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
code->setSurface(surface);
|
code->setSurface(surface);
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowCreated != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowCreated != NULL) {
|
||||||
code->callbacks.onNativeWindowCreated(code,
|
code->callbacks.onNativeWindowCreated(code,
|
||||||
@@ -489,7 +487,6 @@ void
|
|||||||
Java_android_app_NativeActivity_onSurfaceChangedNative(JNIEnv* env, jobject clazz, jlong handle, jobject surface,
|
Java_android_app_NativeActivity_onSurfaceChangedNative(JNIEnv* env, jobject clazz, jlong handle, jobject surface,
|
||||||
jint format, jint width, jint height)
|
jint format, jint width, jint height)
|
||||||
{
|
{
|
||||||
printf("STUB - onSurfaceChanged_native\n");
|
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode *code = (struct NativeCode *)handle;
|
struct NativeCode *code = (struct NativeCode *)handle;
|
||||||
ANativeWindow *oldNativeWindow = code->nativeWindow;
|
ANativeWindow *oldNativeWindow = code->nativeWindow;
|
||||||
@@ -525,7 +522,7 @@ Java_android_app_NativeActivity_onSurfaceRedrawNeededNative(JNIEnv* env, jobject
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceRedrawNeeded_native\n");
|
printf("STUB - onSurfaceRedrawNeeded_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowRedrawNeeded != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowRedrawNeeded != NULL) {
|
||||||
code->callbacks.onNativeWindowRedrawNeeded(code, code->nativeWindow.get());
|
code->callbacks.onNativeWindowRedrawNeeded(code, code->nativeWindow.get());
|
||||||
}
|
}
|
||||||
@@ -537,7 +534,7 @@ Java_android_app_NativeActivity_onSurfaceDestroyedNative(JNIEnv* env, jobject cl
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceDestroyed_native\n");
|
printf("STUB - onSurfaceDestroyed_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowDestroyed != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowDestroyed != NULL) {
|
||||||
code->callbacks.onNativeWindowDestroyed(code,
|
code->callbacks.onNativeWindowDestroyed(code,
|
||||||
code->nativeWindow.get());
|
code->nativeWindow.get());
|
||||||
@@ -551,7 +548,7 @@ Java_android_app_NativeActivity_onInputQueueCreatedNative(JNIEnv* env, jobject c
|
|||||||
{
|
{
|
||||||
printf("STUB - onInputChannelCreated_native\n");
|
printf("STUB - onInputChannelCreated_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onInputQueueCreated != NULL) {
|
if (code->callbacks.onInputQueueCreated != NULL) {
|
||||||
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
||||||
code->callbacks.onInputQueueCreated(code, queue);
|
code->callbacks.onInputQueueCreated(code, queue);
|
||||||
@@ -564,7 +561,7 @@ Java_android_app_NativeActivity_onInputQueueDestroyedNative(JNIEnv* env, jobject
|
|||||||
{
|
{
|
||||||
printf("STUB - onInputChannelDestroyed_native\n");
|
printf("STUB - onInputChannelDestroyed_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onInputQueueDestroyed != NULL) {
|
if (code->callbacks.onInputQueueDestroyed != NULL) {
|
||||||
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
||||||
code->callbacks.onInputQueueDestroyed(code, queue);
|
code->callbacks.onInputQueueDestroyed(code, queue);
|
||||||
@@ -578,7 +575,7 @@ Java_android_app_NativeActivity_onContentRectChangedNative(JNIEnv* env, jobject
|
|||||||
{
|
{
|
||||||
printf("STUB - onContentRectChanged_native\n");
|
printf("STUB - onContentRectChanged_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
NativeCode* code = (NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)handle;
|
||||||
if (code->callbacks.onContentRectChanged != NULL) {
|
if (code->callbacks.onContentRectChanged != NULL) {
|
||||||
ARect rect;
|
ARect rect;
|
||||||
rect.left = x;
|
rect.left = x;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ void set_up_handle_cache(JNIEnv *env, char *apk_main_activity_class)
|
|||||||
if((*env)->ExceptionCheck(env))
|
if((*env)->ExceptionCheck(env))
|
||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
handle_cache.apk_main_activity.onCreate = _METHOD(handle_cache.apk_main_activity.class, "onCreate", "(Landroid/os/Bundle;)V");
|
handle_cache.apk_main_activity.onCreate = _METHOD(handle_cache.apk_main_activity.class, "onCreate", "(Landroid/os/Bundle;)V");
|
||||||
|
handle_cache.apk_main_activity.onStart = _METHOD(handle_cache.apk_main_activity.class, "onStart", "()V");
|
||||||
handle_cache.apk_main_activity.onWindowFocusChanged = _METHOD(handle_cache.apk_main_activity.class, "onWindowFocusChanged", "(Z)V");
|
handle_cache.apk_main_activity.onWindowFocusChanged = _METHOD(handle_cache.apk_main_activity.class, "onWindowFocusChanged", "(Z)V");
|
||||||
handle_cache.apk_main_activity.onResume = _METHOD(handle_cache.apk_main_activity.class, "onResume", "()V");
|
handle_cache.apk_main_activity.onResume = _METHOD(handle_cache.apk_main_activity.class, "onResume", "()V");
|
||||||
handle_cache.apk_main_activity.onDestroy = _METHOD(handle_cache.apk_main_activity.class, "onDestroy", "()V");
|
handle_cache.apk_main_activity.onDestroy = _METHOD(handle_cache.apk_main_activity.class, "onDestroy", "()V");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ struct handle_cache {
|
|||||||
jclass class;
|
jclass class;
|
||||||
jobject object;
|
jobject object;
|
||||||
jmethodID onCreate;
|
jmethodID onCreate;
|
||||||
|
jmethodID onStart;
|
||||||
jmethodID onResume;
|
jmethodID onResume;
|
||||||
jmethodID onWindowFocusChanged;
|
jmethodID onWindowFocusChanged;
|
||||||
jmethodID onDestroy;
|
jmethodID onDestroy;
|
||||||
|
|||||||
@@ -298,6 +298,10 @@ static void open(GtkApplication *app, GFile** files, gint nfiles, const gchar* h
|
|||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|
||||||
// TODO: some apps wait for this to actually do stuff
|
// TODO: some apps wait for this to actually do stuff
|
||||||
|
(*env)->CallVoidMethod(env, handle_cache.apk_main_activity.object, handle_cache.apk_main_activity.onStart);
|
||||||
|
if((*env)->ExceptionCheck(env))
|
||||||
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|
||||||
(*env)->CallVoidMethod(env, handle_cache.apk_main_activity.object, handle_cache.apk_main_activity.onResume);
|
(*env)->CallVoidMethod(env, handle_cache.apk_main_activity.object, handle_cache.apk_main_activity.onResume);
|
||||||
if((*env)->ExceptionCheck(env))
|
if((*env)->ExceptionCheck(env))
|
||||||
(*env)->ExceptionDescribe(env);
|
(*env)->ExceptionDescribe(env);
|
||||||
|
|||||||
Reference in New Issue
Block a user