mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-09 08:21:30 -07:00
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.
This commit is contained in:
parent
294335b230
commit
2451456695
8 changed files with 251 additions and 114 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue