From: Po Lu Date: Wed, 11 Jun 2025 02:34:49 +0000 (+0800) Subject: Port to Android API 36 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a3e3e6c3c2a00a7eafccc2563c7d4ee795ae0abe;p=emacs.git Port to Android API 36 * java/AndroidManifest.xml.in: Update targetSdkVersion to 36. * java/INSTALL: Document revised compilation dependencies. * java/org/gnu/emacs/EmacsActivity.java (interceptBackGesture): New function. (onCreate): Invoke the same to register back gesture callbacks on Android 16 or better. * java/org/gnu/emacs/EmacsWindow.java (onBackInvoked): New function. * src/keyboard.c (lispy_function_keys): Amend with new symbols introduced in Android API 36. (cherry picked from commit 231c4f20ea17a406519d5797e8ea1afdd0111a7c) --- diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in index 711d34cff30..e141d80d6bd 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 6123ad33549..e0d0b743ad9 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 79092824603..d7f15aeb4e1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5055,6 +5055,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",