commit f6a86d649255ffcd182bf9063c759c8297cef4dc Author: James Cherti Date: Fri May 22 12:47:49 2026 -0400 Fix wrong-type-argument errors in SMIE arithmetic operations * lisp/emacs-lisp/smie.el (smie-indent-virtual): Fall back to 'current-column' if a non-numeric symbol like 'noindent' is encountered and display a warninig. (smie-auto-fill, smie-config--guess-value): Check that the value returned by smie-indent-calculate is a number before using it in arithmetic operations. (Bug#81102) diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 33821b8be28..b7de55c580e 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1452,7 +1452,14 @@ This is used when we're not trying to indent point but just need to compute the column at which point should be indented in order to figure out the indentation of some other (further down) point." ;; Trust pre-existing indentation on other lines. - (if (smie-indent--bolp) (current-column) (smie-indent-calculate))) + (let ((col (if (smie-indent--bolp) + (current-column) + (smie-indent-calculate)))) + (if (numberp col) + col + (message "Warning: smie-indent-virtual at pos %s got: %S" + (point) col) + (current-column)))) (defun smie-indent-fixindent () ;; Obey the `fixindent' special comment. @@ -1865,11 +1872,12 @@ to which that point should be aligned, if we were to reindent it.") ;; here may not be accurate, but in practice it seems ;; to work well enough. (skip-chars-forward " \t") - (let* ((newcol (smie-indent-calculate)) - (newgain (- (current-column) newcol))) - (when (> newgain gain) - (setq gain newgain) - (setq bsf (point))))) + (let* ((newcol (smie-indent-calculate))) + (when (numberp newcol) + (let ((newgain (- (current-column) newcol))) + (when (> newgain gain) + (setq gain newgain) + (setq bsf (point))))))) (when (> gain 0) (goto-char bsf) (newline-and-indent) @@ -2091,7 +2099,8 @@ position corresponding to each rule." (goal (current-indentation)) (cur (smie-indent-calculate))) (cond - ((and (eq goal + ((and (numberp cur) + (eq goal (progn (setf (car rule) (- goal cur)) (smie-indent-calculate)))) (- goal cur))))) commit e8a22f83acf761b859fcaa3f54457919409d5fc8 Author: Po Lu Date: Fri Jul 3 14:01:35 2026 +0800 ; * java/org/gnu/emacs/EmacsFillPolygon.java: Remove deprecation directive. diff --git a/java/org/gnu/emacs/EmacsFillPolygon.java b/java/org/gnu/emacs/EmacsFillPolygon.java index a544107daa2..f2afcb62197 100644 --- a/java/org/gnu/emacs/EmacsFillPolygon.java +++ b/java/org/gnu/emacs/EmacsFillPolygon.java @@ -30,7 +30,6 @@ public final class EmacsFillPolygon { - @SuppressWarnings ("deprecation") /* computeBounds (IZ) */ public static void perform (EmacsDrawable drawable, EmacsGC gc, Point points[]) { @@ -67,7 +66,7 @@ public final class EmacsFillPolygon if (Build.VERSION.SDK_INT < Build.VERSION_CODES.BAKLAVA) path.computeBounds (rectF, true); else - path.computeBounds (rectF); + path.computeBounds (rectF); rect = new Rect ((int) Math.floor (rectF.left), (int) Math.floor (rectF.top), commit 44bff5182d190fd3e42bf8f85039cc1d19e50acd Author: Po Lu Date: Fri Jul 3 00:06:59 2026 +0800 ; * etc/NEWS: Clarify entry regarding Android 17. diff --git a/etc/NEWS b/etc/NEWS index f27ae108ccf..8d89b65a3a4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -234,11 +234,11 @@ method call returns with a D-Bus error; the error is passed as argument. +++ *** Emacs has been updated to target Android 17. -Emacs has been updated to require the SDK for Android 17 during -compilation, and to target that version of the operating system. A -corollary of this change is that on Android 17 and later systems, it +Emacs has been updated to require the SDK for Android 17 (API level 37) +during compilation, and to target that version of the operating system. +A corollary of this change is that on Android 17 and later systems, it must be granted permission to access nearby devices from Settings in -order to connect to hosts on local networks. +order to establish network connections to hosts on local networks. ---------------------------------------------------------------------- commit 6cfb38ca954c6e54188e4c7682fc8cc925f8aa7e Merge: 850cbdfa1be 220bd832e1d Author: Po Lu Date: Thu Jul 2 20:11:24 2026 +0800 Merge remote-tracking branch 'savannah/master' into master-android-1 commit 850cbdfa1be89f6ede45d304fb3792d1043ef2fa Author: Po Lu Date: Thu Jul 2 20:08:35 2026 +0800 Update to Android 17 * configure.ac (emacs_cv_android_x_or_later): Rename from `emacs_cv_android_w_or_later', and test for attributes of Android 17. * doc/emacs/android.texi (Android Environment): Document new permission `ACCESS_LOCAL_NETWORK'. * java/AndroidManifest.xml.in: Declare permission android.permission.ACCESS_LOCAL_NETWORK to re-enable Emacs to access local network devices. Update `targetSdkVersion' to 37. * java/INSTALL: Document new build-time requirements and compatibility with recent build-tools releases. * java/org/gnu/emacs/EmacsFillPolygon.java (perform): Use non-deprecated variant of `Path#computeBounds'. * src/android-asset.h (struct AAsset): : New field. (AAssetManager_open): Clear exceptions if no asset fd could be created. (android_asset_read_internal): Cast `buffer' to (jbyte *). Record number of bytes read from the InputStream. (AAsset_seek): Attempt to satisfy seek operations which do not modify the file pointer. diff --git a/configure.ac b/configure.ac index 8112f37e9ba..f19ba664aac 100644 --- a/configure.ac +++ b/configure.ac @@ -966,7 +966,7 @@ a valid path to android.jar. See config.log for more details.]) fi AC_CACHE_CHECK([whether android.jar is new enough], - [emacs_cv_android_w_or_later], + [emacs_cv_android_x_or_later], AS_IF([rm -f conftest.class cat << EOF > conftest.java @@ -974,7 +974,7 @@ import android.os.Build; class conftest { - private static int test = Build.VERSION_CODES.BAKLAVA; + private static int test = Build.VERSION_CODES.CINNAMON_BUN; } EOF @@ -985,7 +985,7 @@ EOF if test "$emacs_cv_android_w_or_later" = "no"; then AC_MSG_ERROR([Emacs must be built with an android.jar file produced for \ -Android 16 (BAKLAVA) or later.]) +Android 17 (CINNAMON_BUN) or later.]) fi dnl See if the Java compiler supports the `--release' option which diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index bc596d766ff..7fb68fe03ea 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -529,6 +529,8 @@ version of Android installed: @item @code{android.permission.ACCESS_LOCATION_EXTRA_COMMANDS} @item +@code{android.permission.ACCESS_LOCAL_NETWORK} +@item @code{android.permission.ACCESS_NETWORK_STATE} @item @code{android.permission.ACCESS_NOTIFICATION_POLICY} diff --git a/etc/NEWS b/etc/NEWS index 5db066a7466..f27ae108ccf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -231,6 +231,15 @@ method call returns with a D-Bus error; the error is passed as argument. * Changes in Emacs 32.1 on Non-Free Operating Systems ++++ +*** Emacs has been updated to target Android 17. + +Emacs has been updated to require the SDK for Android 17 during +compilation, and to target that version of the operating system. A +corollary of this change is that on Android 17 and later systems, it +must be granted permission to access nearby devices from Settings in +order to connect to hosts on local networks. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in index 10e121134e4..9ec1f181811 100644 --- a/java/AndroidManifest.xml.in +++ b/java/AndroidManifest.xml.in @@ -206,8 +206,12 @@ along with GNU Emacs. If not, see . --> + + + + + android:targetSdkVersion="37"/> env))->ExceptionClear (manager->env); + /* Pop the local frame and return name. */ name = (*(manager->env))->NewGlobalRef (manager->env, name); @@ -279,7 +287,7 @@ AAssetManager_open (AAssetManager *manager, const char *c_name, return NULL; } -static AAsset * +static void AAsset_close (AAsset *asset) { JNIEnv *env; @@ -341,8 +349,7 @@ android_asset_create_stream (AAsset *asset) return 1; } - asset->stream - = (*env)->NewGlobalRef (env, stream); + asset->stream = (*env)->NewGlobalRef (env, stream); if (!asset->stream) { @@ -415,7 +422,8 @@ android_asset_read_internal (AAsset *asset, int nbytes, char *buffer) /* Finally write out the amount that was read. */ bytes_read = MIN (bytes_read, nbytes); - (*env)->GetByteArrayRegion (env, stash, 0, bytes_read, buffer); + (*env)->GetByteArrayRegion (env, stash, 0, bytes_read, + (jbyte *) buffer); buffer += bytes_read; total += bytes_read; @@ -426,6 +434,7 @@ android_asset_read_internal (AAsset *asset, int nbytes, char *buffer) assert (nbytes >= 0); out: + asset->bytes_read += total; (*env)->ExceptionClear (env); (*env)->DeleteLocalRef (env, stash); return total; @@ -433,6 +442,7 @@ android_asset_read_internal (AAsset *asset, int nbytes, char *buffer) out_errno: /* Return an error indication if an exception arises while the file is being read. */ + asset->bytes_read += total; (*env)->ExceptionClear (env); (*env)->DeleteLocalRef (env, stash); errno = EIO; @@ -459,11 +469,9 @@ AAsset_getLength (AAsset *asset) static char * AAsset_getBuffer (AAsset *asset) { - long length; + long length = AAsset_getLength (asset); char *buffer; - length = AAsset_getLength (asset); - if (!length) return NULL; @@ -472,8 +480,7 @@ AAsset_getBuffer (AAsset *asset) if (!buffer) return NULL; - if (android_asset_read_internal (asset, length, buffer) - != length) + if (android_asset_read_internal (asset, length, buffer) != length) { free (buffer); return NULL; @@ -492,6 +499,29 @@ AAsset_read (AAsset *asset, void *buffer, size_t size) static off_t AAsset_seek (AAsset *asset, off_t offset, int whence) { + /* It is necessary to attempt to satisfy calls to `seek' to identify + the current offset or which do not actually move the file pointer, + in the interests of scenarios where, e.g., Finsert_file_contents is + called with BEG set to 0. */ + + switch (whence) + { + case SEEK_SET: + if (offset == asset->bytes_read) + return (off_t) asset->bytes_read; + + case SEEK_CUR: + if (offset == 0) + return (off_t) asset->bytes_read; + + case SEEK_END: + if (offset == 0 && (asset->bytes_read == asset->length)) + return (off_t) asset->bytes_read; + + default: + break; + } + /* Java InputStreams don't support seeking at all. */ errno = ESPIPE; return -1;