summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2024-09-04 17:24:34 +0800
committerPo Lu <luangruo@yahoo.com>2024-09-04 17:24:34 +0800
commit2847106f3b6174f25ab43551f96612209fe951c8 (patch)
tree48f3795535eb6324b692ab40b673c1b59e344ea1 /java
parentd277123f4bf855f0d055d283a42166f123fa1fde (diff)
Port to Android 35
* configure.ac: Temporary workaround for Gnulib bug. Verify that the provided android.jar corresponds to Android 35, or any later version. * cross/ndk-build/Makefile.in (NDK_BUILD_SO_LDFLAGS): New variable. * cross/ndk-build/ndk-resolve.mk (NDK_LOCAL_A_NAMES_$(LOCAL_MODULE)): Define to NDK_BUILD_SO_LDFLAGS by default to enable building binaries with support for 16 kb page sizes. * java/AndroidManifest.xml.in: Target SDK 35. * java/INSTALL (16KB PAGE SIZES): New section. Replace references to Android 34 with 35. * java/org/gnu/emacs/EmacsActivity.java (onCreate): Restore pre-SDK 35 inset-relative placement. * java/org/gnu/emacs/EmacsFillPolygon.java (perform): Suppress deprecation warnings, and document why. * m4/ndk-build.m4 (ndk_INIT, ndk_LATE): Check for and enable toolchain support for 16 KB page sizes, if available. (ndk_CONFIG_FILES): Export linker options so derived. * src/conf_post.h [__ANDROID_API__ < 35]: Include system time.h and redefine timezone_t to rpl_timezone_t, so that the Gnulib replacement may not conflict with the useless OS type.
Diffstat (limited to 'java')
-rw-r--r--java/AndroidManifest.xml.in2
-rw-r--r--java/INSTALL40
-rw-r--r--java/org/gnu/emacs/EmacsActivity.java6
-rw-r--r--java/org/gnu/emacs/EmacsFillPolygon.java13
4 files changed, 48 insertions, 13 deletions
diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index df00e497f8f..5c9714efab8 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -207,7 +207,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
<uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@"
- android:targetSdkVersion="34"/>
+ android:targetSdkVersion="35"/>
<application android:name="org.gnu.emacs.EmacsApplication"
android:label="Emacs"
diff --git a/java/INSTALL b/java/INSTALL
index 91916c6586c..fa13a4d107d 100644
--- a/java/INSTALL
+++ b/java/INSTALL
@@ -39,7 +39,7 @@ script like so:
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 14 (API level 34).
+ SDK. They must correspond to Android version 15 (API level 35).
- the path to the C compiler in the Android NDK, for the kind of CPU
you are building Emacs to run on.
@@ -48,8 +48,8 @@ Replacing the paths in the command line above with:
such as `aapt', `apksigner', and `d8'. These are used to build
the application package.
-Where the type of CPU can either be `armeabi', `armv7*', `i686',
-`x86_64', `mips', or `mips64'.
+Where the type of CPU can either be `aarch64', `armeabi', `armv7*',
+`i686', `x86_64', `mips', or `mips64'.
After the configuration process completes, you may run:
@@ -87,13 +87,13 @@ necessary for compiling Emacs.
It is imperative that Emacs is compiled using the headers for the
exact API level that it is written for. This is currently API level
-34, so the correct android.jar archive is located within a directory
-whose name begins with `android-34'. Minor revisions to the headers
+35, so the correct android.jar archive is located within a directory
+whose name begins with `android-35'. Minor revisions to the headers
are inconsequential towards the Emacs compilation process; if there is
-a directory named `android-34-extN' (where N represents a revision to
+a directory named `android-35-extN' (where N represents a revision to
the Android SDK), whether you provide `configure' with that
directory's android.jar or the android.jar contained within the
-directory named `android-34' is of no special importance.
+directory named `android-35' is of no special importance.
The ndk directory contains one subdirectory for each version of the
Android NDK installed. This directory in turn contains the C and C++
@@ -111,12 +111,13 @@ supplied by the NDK. The C compiler is then positioned within
`prebuilt/*/bin' inside that directory.
The build-tools directory holds subdirectories containing the utility
-programs used to convert class files output by the Java compiler to
-the DEX format employed by Android. There is one subdirectory for
-each version of the build tools, but the version you opt for is not of
+programs used to convert class files output by the Java compiler to the
+DEX format employed by Android. There is one subdirectory for each
+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 33.0.x and 34.0.x series.
+releases will work, such as those from the 33.0.x, 34.0.x, and 35.0.x
+series.
BUILDING WITH OLD NDK VERSIONS
@@ -190,6 +191,23 @@ toolchain. To work around this problem, add:
to ANDROID_CFLAGS.
+16 KB PAGE SIZES
+
+New Android devices might be configured with kernels that only support
+16 KB page sizes, rendering them liable not to run Emacs binaries, and
+those of other programs, that are not properly compiled for such an
+environment. Ideally, `configure' will automatically detect toolchain
+and compiler support for this configuration, and diagnose its absence by
+a warning message, but Emacs cannot diagnose the mismatch if the NDK
+toolchain supports 16 KB page sizes while the shared object implementing
+the C++ standard library does not, and Emacs binaries generated by such
+a combination will crash at startup on those devices.
+
+As such, you are advised to build Emacs with the NDK r27 or better, if
+producing binaries to run on aarch64 or x86_64 devices and Android 15 or
+future releases.
+
+
DEBUG AND RELEASE BUILDS
Android makes a distinction between ``debug'' and ``release'' builds
diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java
index 0c9e8312b90..6e8330e3092 100644
--- a/java/org/gnu/emacs/EmacsActivity.java
+++ b/java/org/gnu/emacs/EmacsActivity.java
@@ -271,6 +271,12 @@ public class EmacsActivity extends Activity
/* Set it as the content view. */
setContentView (layout);
+ /* Android 15 also realigns activity contents to originate beneath
+ system windows, e.g. the navigation bar, so request the original
+ behavior. */
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM)
+ layout.setFitsSystemWindows (true);
+
/* Maybe start the Emacs service if necessary. */
EmacsService.startEmacsService (this);
diff --git a/java/org/gnu/emacs/EmacsFillPolygon.java b/java/org/gnu/emacs/EmacsFillPolygon.java
index 6bc8333984a..d99fdd97782 100644
--- a/java/org/gnu/emacs/EmacsFillPolygon.java
+++ b/java/org/gnu/emacs/EmacsFillPolygon.java
@@ -26,8 +26,11 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.os.Build;
+
public final class EmacsFillPolygon
{
+ @SuppressWarnings ("deprecation") /* computeBounds (IZ) */
public static void
perform (EmacsDrawable drawable, EmacsGC gc, Point points[])
{
@@ -60,7 +63,15 @@ public final class EmacsFillPolygon
/* Compute the damage rectangle. */
rectF = new RectF (0, 0, 0, 0);
- path.computeBounds (rectF, true);
+
+ /* computeBounds (IZ) is deprecated but the incompetence of
+ Android's release management has caused its replacement to be
+ omitted from published header files. */
+
+ /* if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) */
+ path.computeBounds (rectF, true);
+ /* else
+ path.computeBounds (rectF); */
rect = new Rect ((int) Math.floor (rectF.left),
(int) Math.floor (rectF.top),