diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index ceec7a97b98..77abdf0e180 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -207,7 +207,7 @@ along with GNU Emacs. If not, see . -->
+ android:targetSdkVersion="36"/>
= Build.VERSION_CODES.VANILLA_ICE_CREAM)
layout.setFitsSystemWindows (true);
+ /* Android 16 replaces KEYCODE_BACK with a callback registered at
+ the window level. */
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA)
+ interceptBackGesture ();
+
/* Maybe start the Emacs service if necessary. */
EmacsService.startEmacsService (this);
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 394b2c26414..fffa2cc5d49 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -58,6 +58,7 @@ import android.util.SparseArray;
import android.util.Log;
import android.os.Build;
+import android.os.SystemClock;
/* This defines a window, which is a handle. Windows represent a
rectangular subset of the screen with their own contents.
@@ -890,6 +891,20 @@ public final class EmacsWindow extends EmacsHandleObject
EmacsNative.sendWindowAction (this.handle, 0);
}
+ /* Dispatch a back gesture invocation as a KeyPress event. Lamentably
+ the platform does not appear to support reporting keyboard
+ modifiers with these events. */
+
+ public void
+ onBackInvoked ()
+ {
+ long time = SystemClock.uptimeMillis ();
+ EmacsNative.sendKeyPress (this.handle, time, 0,
+ KeyEvent.KEYCODE_BACK, 0);
+ EmacsNative.sendKeyRelease (this.handle, time, 0,
+ KeyEvent.KEYCODE_BACK, 0);
+ }
+
/* Mouse and touch event handling.
diff --git a/src/keyboard.c b/src/keyboard.c
index 5db11ad6379..8b2ebd215d2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5099,6 +5099,25 @@ static const char *const lispy_function_keys[] =
[285] = "browser-refresh",
[28] = "clear",
[300] = "XF86Forward",
+ [319] = "dictate",
+ [320] = "new",
+ [321] = "close",
+ [322] = "do-not-disturb",
+ [323] = "print",
+ [324] = "lock",
+ [325] = "fullscreen",
+ [326] = "f13",
+ [327] = "f14",
+ [328] = "f15",
+ [329] = "f16",
+ [330] = "f17",
+ [331] = "f18",
+ [332] = "f19",
+ [333] = "f20",
+ [334] = "f21",
+ [335] = "f22",
+ [336] = "f23",
+ [337] = "f24",
[4] = "XF86Back",
[61] = "tab",
[66] = "return",