Skip to content

Commit 95306b7

Browse files
committed
cleanup Android sevice related code
1 parent 3d7e2fc commit 95306b7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/jni/application/python/start.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ JNIEXPORT void JNICALL JAVA_EXPORT_NAME(PythonService_nativeStart) ( JNIEnv* en
163163
setenv("PYTHON_SERVICE_ARGUMENT", arg, 1);
164164

165165
char *argv[] = { "service" };
166+
/* ANDROID_ARGUMENT points to service subdir,
167+
* so main() will run main.py from this dir
168+
*/
166169
main(1, argv);
167170
}
168171

src/src/org/renpy/android/PythonService.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {
3939
Log.v("python service", "service exists, do not start again");
4040
return START_NOT_STICKY;
4141
}
42+
4243
Bundle extras = intent.getExtras();
4344
androidPrivate = extras.getString("androidPrivate");
45+
// service code is located in service subdir
4446
androidArgument = extras.getString("androidArgument") + "/service";
4547
pythonHome = extras.getString("pythonHome");
4648
pythonPath = extras.getString("pythonPath");
@@ -73,6 +75,8 @@ public void onDestroy() {
7375

7476
@Override
7577
public void run(){
78+
79+
// libraries loading, the same way PythonActivity.run() do
7680
System.loadLibrary("sdl");
7781
System.loadLibrary("sdl_image");
7882
System.loadLibrary("sdl_ttf");
@@ -85,15 +89,15 @@ public void run(){
8589
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");
8690

8791
try {
88-
System.loadLibrary("sqlite3");
89-
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_sqlite3.so");
92+
System.loadLibrary("sqlite3");
93+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_sqlite3.so");
9094
} catch(UnsatisfiedLinkError e) {
9195
}
9296

9397
try {
94-
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imaging.so");
95-
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imagingft.so");
96-
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imagingmath.so");
98+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imaging.so");
99+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imagingft.so");
100+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_imagingmath.so");
97101
} catch(UnsatisfiedLinkError e) {
98102
}
99103

0 commit comments

Comments
 (0)