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.
This commit is contained in:
Po Lu 2023-02-20 22:14:29 +08:00
parent fecd0a9fed
commit 57c19f477f
4 changed files with 36 additions and 5 deletions

View file

@ -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.

View file

@ -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.

View file

@ -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

View file

@ -25,6 +25,8 @@
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;
}