diff options
| author | Po Lu | 2023-02-20 22:14:29 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-20 22:14:29 +0800 |
| commit | 57c19f477fddb542fa40747aeb7060fa9756756f (patch) | |
| tree | ef338aa1f2cbceffb5be82f04aa22ed92c7535e2 | |
| parent | fecd0a9fed2f392dc0c5f852b705758681ef5266 (diff) | |
| download | emacs-57c19f477fddb542fa40747aeb7060fa9756756f.tar.gz emacs-57c19f477fddb542fa40747aeb7060fa9756756f.zip | |
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.
| -rw-r--r-- | INSTALL.android | 12 | ||||
| -rw-r--r-- | configure.ac | 6 | ||||
| -rw-r--r-- | doc/emacs/android.texi | 11 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSdk11Clipboard.java | 12 |
4 files changed, 36 insertions, 5 deletions
diff --git a/INSTALL.android b/INSTALL.android index 24877d88aef..559058d321e 100644 --- a/INSTALL.android +++ b/INSTALL.android | |||
| @@ -213,6 +213,8 @@ Android systems: | |||
| 213 | (Please see the section GNUTLS near the end of this file.) | 213 | (Please see the section GNUTLS near the end of this file.) |
| 214 | libtiff - https://sourceforge.net/projects/android-ports-for-gnu-emacs | 214 | libtiff - https://sourceforge.net/projects/android-ports-for-gnu-emacs |
| 215 | (Extract and point ``--with-ndk-path'' to tiff-4.5.0-emacs.tar.gz.) | 215 | (Extract and point ``--with-ndk-path'' to tiff-4.5.0-emacs.tar.gz.) |
| 216 | tree-sitter - https://sourceforge.net/projects/android-ports-for-gnu-emacs | ||
| 217 | (Please see the section TREE-SITTER near the end of this file.) | ||
| 216 | 218 | ||
| 217 | We anticipate that most untested non-trivial ndk-build dependencies | 219 | We anticipate that most untested non-trivial ndk-build dependencies |
| 218 | will need adjustments in Emacs to work, as the Emacs build system | 220 | 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 | |||
| 575 | should not try to build these packages separately using any | 577 | should not try to build these packages separately using any |
| 576 | `configure' script or Makefiles inside. | 578 | `configure' script or Makefiles inside. |
| 577 | 579 | ||
| 580 | TREE-SITTER | ||
| 581 | |||
| 582 | A copy of tree-sitter modified to build with the ndk-build system can | ||
| 583 | also find that URL. To build Emacs with tree-sitter, you must unpack | ||
| 584 | the following tar archive in that site: | ||
| 585 | |||
| 586 | tree-sitter-0.20.7-emacs.tar.gz | ||
| 587 | |||
| 588 | and add the resulting folder to ``--with-ndk-build''. | ||
| 589 | |||
| 578 | 590 | ||
| 579 | 591 | ||
| 580 | This file is part of GNU Emacs. | 592 | 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.]) | |||
| 1074 | passthrough="$passthrough --with-gnutls=$with_gnutls" | 1074 | passthrough="$passthrough --with-gnutls=$with_gnutls" |
| 1075 | passthrough="$passthrough --with-tiff=$with_tiff" | 1075 | passthrough="$passthrough --with-tiff=$with_tiff" |
| 1076 | passthrough="$passthrough --with-selinux=$with_selinux" | 1076 | passthrough="$passthrough --with-selinux=$with_selinux" |
| 1077 | passthrough="$passthrough --with-modules=$with_modules" | ||
| 1078 | passthrough="$passthrough --with-tree-sitter=$with_tree_sitter" | ||
| 1077 | 1079 | ||
| 1078 | AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \ | 1080 | AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \ |
| 1079 | ANDROID_SDK="$android_sdk" android_abi=$android_abi \ | 1081 | ANDROID_SDK="$android_sdk" android_abi=$android_abi \ |
| @@ -1146,6 +1148,8 @@ if test "$ANDROID" = "yes"; then | |||
| 1146 | with_gnutls=no | 1148 | with_gnutls=no |
| 1147 | with_tiff=no | 1149 | with_tiff=no |
| 1148 | with_selinux=no | 1150 | with_selinux=no |
| 1151 | with_modules=no | ||
| 1152 | with_tree_sitter=no | ||
| 1149 | fi | 1153 | fi |
| 1150 | 1154 | ||
| 1151 | with_rsvg=no | 1155 | with_rsvg=no |
| @@ -1153,14 +1157,12 @@ if test "$ANDROID" = "yes"; then | |||
| 1153 | with_libsystemd=no | 1157 | with_libsystemd=no |
| 1154 | with_cairo=no | 1158 | with_cairo=no |
| 1155 | with_imagemagick=no | 1159 | with_imagemagick=no |
| 1156 | with_tree_sitter=no | ||
| 1157 | with_xft=no | 1160 | with_xft=no |
| 1158 | with_harfbuzz=no | 1161 | with_harfbuzz=no |
| 1159 | with_libotf=no | 1162 | with_libotf=no |
| 1160 | with_gpm=no | 1163 | with_gpm=no |
| 1161 | with_dbus=no | 1164 | with_dbus=no |
| 1162 | with_gsettings=no | 1165 | with_gsettings=no |
| 1163 | with_modules=no | ||
| 1164 | with_threads=no | 1166 | with_threads=no |
| 1165 | 1167 | ||
| 1166 | # zlib is available in android. | 1168 | # 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} | |||
| 461 | always returns @code{nil} for the clipboard selection. | 461 | always returns @code{nil} for the clipboard selection. |
| 462 | 462 | ||
| 463 | @item | 463 | @item |
| 464 | On Android 3.0 and later, Emacs can only access clipboard data when | 464 | Between Android 3.0 and Android 9.0, Emacs is able to access the |
| 465 | one of its frames has the input focus. | 465 | clipboard whenever it wants, and @code{gui-selection-owner-p} always |
| 466 | returns accurate results. | ||
| 467 | |||
| 468 | @item | ||
| 469 | Under Android 10.0 and later, Emacs can only access clipboard data | ||
| 470 | when one of its frames has the input focus, and | ||
| 471 | @code{gui-selection-owner-p} always returns @code{nil} for the | ||
| 472 | clipboard selection. | ||
| 466 | @end itemize | 473 | @end itemize |
| 467 | 474 | ||
| 468 | Since the Android system itself has no concept of a primary | 475 | 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; | |||
| 25 | 25 | ||
| 26 | import android.util.Log; | 26 | import android.util.Log; |
| 27 | 27 | ||
| 28 | import android.os.Build; | ||
| 29 | |||
| 28 | import java.io.UnsupportedEncodingException; | 30 | import java.io.UnsupportedEncodingException; |
| 29 | 31 | ||
| 30 | /* This class implements EmacsClipboard for Android 3.0 and later | 32 | /* This class implements EmacsClipboard for Android 3.0 and later |
| @@ -43,7 +45,12 @@ public class EmacsSdk11Clipboard extends EmacsClipboard | |||
| 43 | EmacsSdk11Clipboard () | 45 | EmacsSdk11Clipboard () |
| 44 | { | 46 | { |
| 45 | manager = EmacsService.SERVICE.getClipboardManager (); | 47 | manager = EmacsService.SERVICE.getClipboardManager (); |
| 46 | manager.addPrimaryClipChangedListener (this); | 48 | |
| 49 | /* The system forbids Emacs from reading clipboard data in the | ||
| 50 | background under Android 10 or later. */ | ||
| 51 | |||
| 52 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) | ||
| 53 | manager.addPrimaryClipChangedListener (this); | ||
| 47 | } | 54 | } |
| 48 | 55 | ||
| 49 | @Override | 56 | @Override |
| @@ -105,6 +112,9 @@ public class EmacsSdk11Clipboard extends EmacsClipboard | |||
| 105 | public synchronized int | 112 | public synchronized int |
| 106 | ownsClipboard () | 113 | ownsClipboard () |
| 107 | { | 114 | { |
| 115 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) | ||
| 116 | return -1; | ||
| 117 | |||
| 108 | return ownsClipboard ? 1 : 0; | 118 | return ownsClipboard ? 1 : 0; |
| 109 | } | 119 | } |
| 110 | 120 | ||