diff options
| author | Po Lu <luangruo@yahoo.com> | 2024-05-01 11:45:53 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2024-05-01 11:46:31 +0800 |
| commit | 2451456695d0e03b89365cbbe64effb2f99af2d5 (patch) | |
| tree | b6bcd3e227454b436ab4ee0fad447d946b5179cf /java/org/gnu/emacs/EmacsOpenActivity.java | |
| parent | 294335b2304028cc97aca036bd37adf2f8e1c508 (diff) | |
Fix compatibility issues with Android clipboards
* java/org/gnu/emacs/EmacsClipboard.java (getClipboardData):
Return an AssetFileDescriptor.
* java/org/gnu/emacs/EmacsContextMenu.java (onMenuItemClick):
Typo corrections in commentary.
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Raise
minimum version on which to read file descriptors from
ParcelFileDescriptor objects to Honeycomb.
* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(getClipboardData): Return the asset file descriptor.
* java/org/gnu/emacs/EmacsSdk8Clipboard.java (getClipboardData):
Adjust return type to match.
* src/android.h (struct android_parcel_file_descriptor_class):
Move from androidselect.c.
* src/androidselect.c (fd_class): Export function.
(android_init_emacs_clipboard): Adjust signature of
getClipboardData.
(android_init_asset_file_descriptor, close_asset_fd)
(extract_fd_offsets): New functions.
(Fandroid_get_clipboard_data): Extract file descriptor and
offset from the AssetFileDescriptor here, rather than in
getClipboardData.
(init_androidselect): Call android_init_asset_file_descriptor.
* src/androidvfs.c (android_init_fd_class): Export and enable
calling this function more than once.
Diffstat (limited to 'java/org/gnu/emacs/EmacsOpenActivity.java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsOpenActivity.java | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java index 327a53bc417..cdc68aea2bf 100644 --- a/java/org/gnu/emacs/EmacsOpenActivity.java +++ b/java/org/gnu/emacs/EmacsOpenActivity.java @@ -19,29 +19,23 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ package org.gnu.emacs; -/* This class makes the Emacs server work reasonably on Android. +/* Opening external documents on Android. - There is no way to make the Unix socket publicly available on - Android. + This activity is registered as an application capable of opening text + files and files in several other formats that Emacs understands, and + assumes responsibility for deriving file names from the files + provided to `onCreate', potentially copying them to temporary + directories in the process, and invoking `emacsclient' with suitable + arguments to open the same. In this respect, it fills the role of + `etc/emacs.desktop' on XDG systems. - Instead, this activity tries to connect to the Emacs server, to - make it open files the system asks Emacs to open, and to emulate - some reasonable behavior when Emacs has not yet started. + It is also registered as a handler for mailto URIs, in which capacity + it constructs invocations of `emacsclient' so as to start + `message-mailto' with their contents and attachments, much like + `etc/emacs-mail.desktop'. - First, Emacs registers itself as an application that can open text - and image files. - - Then, when the user is asked to open a file and selects ``Emacs'' - as the application that will open the file, the system pops up a - window, this activity, and calls the `onCreate' function. - - `onCreate' then tries very to find the file name of the file that - was selected, and give it to emacsclient. - - If emacsclient successfully opens the file, then this activity - starts EmacsActivity (to bring it on to the screen); otherwise, it - displays the output of emacsclient or any error message that occurs - and exits. */ + As with all other activities, it is registered in the package + manifest file. */ import android.app.AlertDialog; import android.app.Activity; @@ -628,11 +622,12 @@ public final class EmacsOpenActivity extends Activity if (scheme.equals ("content") /* Retrieving the native file descriptor of a - ParcelFileDescriptor requires Honeycomb, and + ParcelFileDescriptor requires Honeycomb MR1, and proceeding without this capability is pointless on systems before KitKat, since Emacs doesn't support opening content files on those. */ - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) + && (Build.VERSION.SDK_INT + >= Build.VERSION_CODES.HONEYCOMB_MR1)) { /* This is one of the annoying Android ``content'' URIs. Most of the time, there is actually an |
