Skip to content

Commit 0038d72

Browse files
zworkbrtibbles
authored andcommitted
Return main status through JNI entry points
This is currently unused, but without passing back the status the Java classes have no way of knowing whether the native code succeeded or not.
1 parent 8b52ec5 commit 0038d72

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pythonforandroid/bootstraps/common/build/jni/application/src/start.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ int main(int argc, char *argv[]) {
348348
return ret;
349349
}
350350

351-
JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
351+
JNIEXPORT int JNICALL Java_org_kivy_android_PythonService_nativeStart(
352352
JNIEnv *env,
353353
jobject thiz,
354354
jstring j_android_private,
@@ -388,7 +388,7 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
388388
/* ANDROID_ARGUMENT points to service subdir,
389389
* so main() will run main.py from this dir
390390
*/
391-
main(1, argv);
391+
return main(1, argv);
392392
}
393393

394394
#if defined(BOOTSTRAP_NAME_WEBVIEW) || defined(BOOTSTRAP_NAME_SERVICEONLY)
@@ -411,7 +411,7 @@ void Java_org_kivy_android_PythonActivity_nativeSetenv(
411411
}
412412

413413

414-
void Java_org_kivy_android_PythonActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
414+
int Java_org_kivy_android_PythonActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
415415
{
416416
/* This nativeInit follows SDL2 */
417417

@@ -427,7 +427,7 @@ void Java_org_kivy_android_PythonActivity_nativeInit(JNIEnv* env, jclass cls, jo
427427
argv[1] = NULL;
428428
/* status = SDL_main(1, argv); */
429429

430-
main(1, argv);
430+
return main(1, argv);
431431

432432
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
433433
/* exit(status); */

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void run(){
201201
}
202202

203203
// Native part
204-
public static native void nativeStart(
204+
public static native int nativeStart(
205205
String androidPrivate, String androidArgument,
206206
String serviceEntrypoint, String pythonName,
207207
String pythonHome, String pythonPath,

0 commit comments

Comments
 (0)