* 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)
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
<uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@"
- android:targetSdkVersion="34"/>
+ android:targetSdkVersion="36"/>
<application android:name="org.gnu.emacs.EmacsApplication"
android:label="Emacs"
Replacing the paths in the command line above with:
- the path to the `android.jar' headers which come with the Android
- SDK. They must correspond to Android version 15 (API level 35).
+ SDK. They must correspond to Android version 16 (API level 36).
- the path to the C compiler in the Android NDK, for the kind of CPU
you are building Emacs to run on.
version of the build tools, but the version you opt for is not of
paramount significance: if your version does not work, configure will
protest, so install a newer one. We anticipate that most recent
-releases will work, such as those from the 34.0.x, and 35.0.x series.
+releases will work, such as those from the 35.0.x and 36.0.x series.
\f
BUILDING WITH OLD NDK VERSIONS
import android.widget.FrameLayout;
+import android.window.BackEvent;
+import android.window.OnBackAnimationCallback;
+import android.window.OnBackInvokedCallback;
+import android.window.OnBackInvokedDispatcher;
+
public class EmacsActivity extends Activity
implements EmacsWindowManager.WindowConsumer,
ViewTreeObserver.OnGlobalLayoutListener
return window;
}
+ private void
+ interceptBackGesture ()
+ {
+ OnBackInvokedDispatcher dispatcher;
+ int priority = OnBackInvokedDispatcher.PRIORITY_DEFAULT;
+ OnBackInvokedCallback callback;
+
+ dispatcher = getOnBackInvokedDispatcher ();
+ callback = new OnBackAnimationCallback () {
+ @Override
+ public void
+ onBackInvoked ()
+ {
+ View view = EmacsActivity.this.getCurrentFocus ();
+ EmacsWindow window;
+
+ if (view instanceof EmacsView)
+ {
+ window = ((EmacsView) view).window;
+ window.onBackInvoked ();
+ }
+ }
+
+ /* The three functions are overridden to prevent a misleading
+ back animation from being displayed, as Emacs intercepts all
+ back gestures and will not return to the home screen. */
+
+ @Override
+ public void
+ onBackCancelled ()
+ {
+
+ }
+
+ @Override
+ public void
+ onBackProgressed (BackEvent gestureEvent)
+ {
+
+ }
+
+ @Override
+ public void
+ onBackStarted (BackEvent gestureEvent)
+ {
+
+ }
+ };
+ dispatcher.registerOnBackInvokedCallback (priority, callback);
+ }
+
+\f
+
@Override
public void
onCreate (Bundle savedInstanceState)
if (Build.VERSION.SDK_INT >= 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);
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.
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);
+ }
+
\f
/* Mouse and touch event handling.
[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",