[Scummvm-git-logs] scummvm branch-2-7-0-android -> 2beeeb0fbc55759c0d2c37769592bb29d07b8d38

lephilousophe noreply at scummvm.org
Sat Mar 18 11:02:51 UTC 2023


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7d57ebcf18 ANDROID: Don't crash when fetchChildren failed in Java
b368e186be ANDROID: Allow to set same pause status from Java several times
2d704af6c2 ANDROID: Fix onDestroy cleanup
2beeeb0fbc ANDROID: Make sure ScummVMActivity is always run once


Commit: 7d57ebcf18e0606dc4524fada33dca2901d52670
    https://github.com/scummvm/scummvm/commit/7d57ebcf18e0606dc4524fada33dca2901d52670
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-18T12:00:36+01:00

Commit Message:
ANDROID: Don't crash when fetchChildren failed in Java

Changed paths:
    backends/fs/android/android-saf-fs.cpp


diff --git a/backends/fs/android/android-saf-fs.cpp b/backends/fs/android/android-saf-fs.cpp
index ea315d3ed5f..bd148519331 100644
--- a/backends/fs/android/android-saf-fs.cpp
+++ b/backends/fs/android/android-saf-fs.cpp
@@ -385,6 +385,11 @@ bool AndroidSAFFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode
 		return false;
 	}
 
+	if (!array) {
+		// Fetching children failed: a log error has already been produced in Java code
+		return false;
+	}
+
 	myList.clear();
 
 	jsize size = env->GetArrayLength(array);


Commit: b368e186be76039971511bd3360a6df6dbf1517e
    https://github.com/scummvm/scummvm/commit/b368e186be76039971511bd3360a6df6dbf1517e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-18T12:00:36+01:00

Commit Message:
ANDROID: Allow to set same pause status from Java several times

Changed paths:
    backends/platform/android/jni-android.cpp


diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index f87baaf0ca0..bc38d630c63 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -910,16 +910,18 @@ void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
 
 		if (value)
 			JNI::_pauseToken = g_engine->pauseEngine();
-		else
+		else if (JNI::_pauseToken.isActive())
 			JNI::_pauseToken.clear();
 	}
 
-	pause = value;
+	if (pause != value) {
+		pause = value;
 
-	if (!pause) {
-		// wake up all threads
-		for (uint i = 0; i < 3; ++i)
-			sem_post(&pause_sem);
+		if (!pause) {
+			// wake up all threads
+			for (uint i = 0; i < 3; ++i)
+				sem_post(&pause_sem);
+		}
 	}
 }
 


Commit: 2d704af6c22144f49a69b572368bcf6ee1b0375f
    https://github.com/scummvm/scummvm/commit/2d704af6c22144f49a69b572368bcf6ee1b0375f
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-18T12:00:36+01:00

Commit Message:
ANDROID: Fix onDestroy cleanup

onDestroy could never work before as it was sending a quit event to a
paused C++ code.
Make sure C++ code is unpaused.
In addition don't call finish in termination callback if finish was
responsibile of the termination. Else, finish events get queued in
Android and a new ScummVMActivity gets killed immediately.

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java


diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 56bf41b8aed..6c9561949ef 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -131,6 +131,11 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 //	boolean _isPaused = false;
 	private InputMethodManager _inputManager = null;
 
+	// Set to true in onDestroy
+	// This avoids that when C++ terminates we call finish() a second time
+	// This second finish causes termination when we are launched again
+	boolean _finishing = false;
+
 	private final int[][] TextInputKeyboardList =
 	{
 		{ 0, R.xml.qwerty },
@@ -854,6 +859,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 
 	@Override
 	public void onCreate(Bundle savedInstanceState) {
+//		Log.d(ScummVM.LOG_TAG, "onCreate");
+
 		super.onCreate(savedInstanceState);
 
 		safSyncObject = new Object();
@@ -932,8 +939,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		                                                        @Override
 		                                                        public void handle(int exitResult) {
 		                                                        	Log.d(ScummVM.LOG_TAG, "Via callback: ScummVM native terminated with code: " + exitResult);
-		                                                        	// call onDestroy()
-		                                                        	finish();
+		                                                        	// call onDestroy() only we we aren't already in it
+		                                                        	if (!_finishing) finish();
 		                                                        }
 		                                                    });
 
@@ -1048,9 +1055,13 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		super.onDestroy();
 
 		if (_events != null) {
+			_finishing = true;
+
 			_events.clearEventHandler();
 			_events.sendQuitEvent();
 
+			// Make sure the thread is actively polling for events
+			_scummvm.setPause(false);
 			try {
 				// 1s timeout
 				_scummvm_thread.join(1000);
@@ -1058,6 +1069,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 				Log.i(ScummVM.LOG_TAG, "Error while joining ScummVM thread", e);
 			}
 
+			_finishing = false;
 			_scummvm = null;
 		}
 


Commit: 2beeeb0fbc55759c0d2c37769592bb29d07b8d38
    https://github.com/scummvm/scummvm/commit/2beeeb0fbc55759c0d2c37769592bb29d07b8d38
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-18T12:00:36+01:00

Commit Message:
ANDROID: Make sure ScummVMActivity is always run once

We don't support having multiple instances of ScummVMActivity running at
the same time (because of the system singleton in C++).

Changed paths:
    dists/android/AndroidManifest.xml


diff --git a/dists/android/AndroidManifest.xml b/dists/android/AndroidManifest.xml
index 5f9a99af9ce..701758ffe31 100644
--- a/dists/android/AndroidManifest.xml
+++ b/dists/android/AndroidManifest.xml
@@ -61,6 +61,7 @@
 			android:exported="false"
 			android:banner="@drawable/leanback_icon"
 			android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
+			android:launchMode="singleInstance"
 			android:screenOrientation="landscape"
 			android:theme="@style/AppTheme"
 			android:windowSoftInputMode="adjustResize">




More information about the Scummvm-git-logs mailing list