[Scummvm-git-logs] scummvm master -> 8295272cd2fb34ddb65e7440d17b7319f10d7310

lephilousophe noreply at scummvm.org
Thu Nov 6 07:47:18 UTC 2025


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

Summary:
8295272cd2 ANDROID: Fix long-press on back button handling on Android 14 and 15


Commit: 8295272cd2fb34ddb65e7440d17b7319f10d7310
    https://github.com/scummvm/scummvm/commit/8295272cd2fb34ddb65e7440d17b7319f10d7310
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-11-06T08:47:04+01:00

Commit Message:
ANDROID: Fix long-press on back button handling on Android 14 and 15

The onBack events in these versions are emulated from the OnBackInvokedCallback
So, enable the OnBackAnimationCallback handler as soon as it's available.
Use a stylable value for that and make it depend on API level 34+.

Changed paths:
  A dists/android/res/values-v34/predictive_back.xml
  A dists/android/res/values/predictive_back.xml
    backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
    dists/android/AndroidManifest.xml


diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
index 45df86e2363..cde5166adff 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
@@ -198,12 +198,12 @@ public class ScummVMEvents implements
 		_longPressTimeout = ViewConfiguration.getLongPressTimeout();
 
 		/*
-		 * Register our OnBackInvokedCallback starting with Baklava
-		 * Before, it's not enabled by default.
-		 * We don't want to get it too soon, because OnBackAnimationCallback (which we require to
-		 * handle the long press on back) is not available in Tiramisu when the feature was introduced.
+		 * Register our OnBackInvokedCallback starting with Upside Down Cake
+		 * OnBackAnimationCallback (which we require to handle the long press on back) is not
+		 * available in Tiramisu when the feature was introduced.
+		 * This is synchronized with the enableOnBackInvokedCallback attribute on the application.
 		 */
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
 			activity.getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
 				OnBackInvokedDispatcher.PRIORITY_DEFAULT, new OnBackInvoked());
 		}
diff --git a/dists/android/AndroidManifest.xml b/dists/android/AndroidManifest.xml
index 8b9c4124210..8c0cff19433 100644
--- a/dists/android/AndroidManifest.xml
+++ b/dists/android/AndroidManifest.xml
@@ -41,6 +41,7 @@
 		android:allowBackup="true"
 		android:appCategory="game"
 		android:description="@string/app_desc"
+		android:enableOnBackInvokedCallback="@bool/enableOnBackInvokedCallback"
 		android:icon="@mipmap/scummvm"
 		android:intentMatchingFlags="enforceIntentFilter"
 		android:label="@string/app_name${nameSuffix}"
diff --git a/dists/android/res/values-v34/predictive_back.xml b/dists/android/res/values-v34/predictive_back.xml
new file mode 100644
index 00000000000..30debb735ac
--- /dev/null
+++ b/dists/android/res/values-v34/predictive_back.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<bool name="enableOnBackInvokedCallback">true</bool>
+</resources>
diff --git a/dists/android/res/values/predictive_back.xml b/dists/android/res/values/predictive_back.xml
new file mode 100644
index 00000000000..4f1c4f75754
--- /dev/null
+++ b/dists/android/res/values/predictive_back.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<!--
+		Android 33 introduced the enableOnBackInvokedCallback with gesture based navigation.
+		Sadly the implementation is incomplete before Android 34 to detect long presses on the back
+		button.
+		So, only enable the attribute starting with Android 34 as Android 33 works well with false.
+		Note: in Android 33 with gesture navigation, the long "press" on back (aka slow back gesture)
+		cannot be detected.
+	-->
+	<bool name="enableOnBackInvokedCallback">false</bool>
+</resources>




More information about the Scummvm-git-logs mailing list