From: Po Lu Date: Mon, 20 Feb 2023 14:14:29 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=57c19f477fddb542fa40747aeb7060fa9756756f;p=emacs.git Update Android port * INSTALL.android: Explain where to get tree-sitter. * configure.ac: Add support for dynamic modules and tree-sitter. * doc/emacs/android.texi (Android Windowing): * java/org/gnu/emacs/EmacsSdk11Clipboard.java (EmacsSdk11Clipboard, ownsClipboard): Improve clipboard handling and documentation. --- diff --git a/INSTALL.android b/INSTALL.android index 24877d88aef..559058d321e 100644 --- a/INSTALL.android +++ b/INSTALL.android @@ -213,6 +213,8 @@ Android systems: (Please see the section GNUTLS near the end of this file.) libtiff - https://sourceforge.net/projects/android-ports-for-gnu-emacs (Extract and point ``--with-ndk-path'' to tiff-4.5.0-emacs.tar.gz.) + tree-sitter - https://sourceforge.net/projects/android-ports-for-gnu-emacs + (Please see the section TREE-SITTER near the end of this file.) We anticipate that most untested non-trivial ndk-build dependencies will need adjustments in Emacs to work, as the Emacs build system @@ -575,6 +577,16 @@ and add the resulting folders to ``--with-ndk-path''. Note that you should not try to build these packages separately using any `configure' script or Makefiles inside. +TREE-SITTER + +A copy of tree-sitter modified to build with the ndk-build system can +also find that URL. To build Emacs with tree-sitter, you must unpack +the following tar archive in that site: + + tree-sitter-0.20.7-emacs.tar.gz + +and add the resulting folder to ``--with-ndk-build''. + This file is part of GNU Emacs. diff --git a/configure.ac b/configure.ac index d4dad572fbe..ce74f492c82 100644 --- a/configure.ac +++ b/configure.ac @@ -1074,6 +1074,8 @@ package will likely install on older systems but crash on startup.]) passthrough="$passthrough --with-gnutls=$with_gnutls" passthrough="$passthrough --with-tiff=$with_tiff" passthrough="$passthrough --with-selinux=$with_selinux" + passthrough="$passthrough --with-modules=$with_modules" + passthrough="$passthrough --with-tree-sitter=$with_tree_sitter" AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \ ANDROID_SDK="$android_sdk" android_abi=$android_abi \ @@ -1146,6 +1148,8 @@ if test "$ANDROID" = "yes"; then with_gnutls=no with_tiff=no with_selinux=no + with_modules=no + with_tree_sitter=no fi with_rsvg=no @@ -1153,14 +1157,12 @@ if test "$ANDROID" = "yes"; then with_libsystemd=no with_cairo=no with_imagemagick=no - with_tree_sitter=no with_xft=no with_harfbuzz=no with_libotf=no with_gpm=no with_dbus=no with_gsettings=no - with_modules=no with_threads=no # zlib is available in android. diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 4feb3f0c3ef..d070199d325 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -461,8 +461,15 @@ On Android 2.3 and earlier, the function @code{gui-selection-owner-p} always returns @code{nil} for the clipboard selection. @item -On Android 3.0 and later, Emacs can only access clipboard data when -one of its frames has the input focus. +Between Android 3.0 and Android 9.0, Emacs is able to access the +clipboard whenever it wants, and @code{gui-selection-owner-p} always +returns accurate results. + +@item +Under Android 10.0 and later, Emacs can only access clipboard data +when one of its frames has the input focus, and +@code{gui-selection-owner-p} always returns @code{nil} for the +clipboard selection. @end itemize Since the Android system itself has no concept of a primary diff --git a/java/org/gnu/emacs/EmacsSdk11Clipboard.java b/java/org/gnu/emacs/EmacsSdk11Clipboard.java index 2df2015c9c1..ea35a463299 100644 --- a/java/org/gnu/emacs/EmacsSdk11Clipboard.java +++ b/java/org/gnu/emacs/EmacsSdk11Clipboard.java @@ -25,6 +25,8 @@ import android.content.ClipData; import android.util.Log; +import android.os.Build; + import java.io.UnsupportedEncodingException; /* This class implements EmacsClipboard for Android 3.0 and later @@ -43,7 +45,12 @@ public class EmacsSdk11Clipboard extends EmacsClipboard EmacsSdk11Clipboard () { manager = EmacsService.SERVICE.getClipboardManager (); - manager.addPrimaryClipChangedListener (this); + + /* The system forbids Emacs from reading clipboard data in the + background under Android 10 or later. */ + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) + manager.addPrimaryClipChangedListener (this); } @Override @@ -105,6 +112,9 @@ public class EmacsSdk11Clipboard extends EmacsClipboard public synchronized int ownsClipboard () { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) + return -1; + return ownsClipboard ? 1 : 0; }