1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00
Commit Graph

186 Commits

Author SHA1 Message Date
Po Lu
e41349dd93 Update Android port
* doc/emacs/android.texi (Android File System): Describe how to
access real files named /assets or /contents if so required.
* java/org/gnu/emacs/EmacsService.java (validAuthority):
* src/android.c (android_init_emacs_service):
* src/android.h: New function.
* src/androidvfs.c (android_saf_valid_authority_p): New
function.  Wrap the Java function.
(android_saf_root_stat, android_saf_root_access): Don't return
success if no authority by vp->authority's name exists.
(android_saf_tree_from_name): Check validity of string data
before giving it to JNI.
2023-08-01 21:06:06 +08:00
Po Lu
9cf166db63 Initialize Android API level earlier
* java/org/gnu/emacs/EmacsNative.java (EmacsNative):
* java/org/gnu/emacs/EmacsNoninteractive.java (main):
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsThread.java (run):
* src/android.c (initEmacs, setEmacsParams): Set
`android_api_level' within setEmacsParams, not in initEmacs.
* src/androidvfs.c: Pacify compiler warnings.
2023-07-31 14:18:12 +08:00
Po Lu
5a8130ab96 Implement cross-directory SAF rename operations
* java/org/gnu/emacs/EmacsService.java (renameDocument): Don't
catch UnsupportedOperationException; handle ENOSYS in
android_saf_rename_document instead.
(moveDocument): New function.
* lisp/subr.el (y-or-n-p): Always change the text conversion
style.
* src/android.c (android_init_emacs_service)
(android_exception_check_4): New function.
* src/android.h: Update Java function table.
* src/androidvfs.c (android_saf_rename_document): Handle ENOSYS
here by setting errno to EXDEV.
(android_saf_move_document): New function.
(android_document_id_from_name): Take const `dir_name'.
(android_saf_tree_rename): Use delete-move-rename to implement
cross-directory renames.
2023-07-31 10:50:12 +08:00
Po Lu
37f68e8696 Partially implement rename operations on SAF files
* java/org/gnu/emacs/EmacsSafThread.java
(postInvalidateCacheDir):
* java/org/gnu/emacs/EmacsService.java (renameDocument): New
functions.
* src/android.c (android_init_emacs_service):
* src/android.h (struct android_emacs_service): Link to new JNI
function.
* src/androidvfs.c (android_saf_rename_document): New function.
(android_saf_tree_rename): Implement in terms of that function
if possible.
2023-07-30 13:39:27 +08:00
Po Lu
9c5e9bb9be Correct directory permissions reported for VFS files
* java/org/gnu/emacs/EmacsSafThread.java (statDocument1):
* src/androidvfs.c (android_afs_stat, android_content_stat)
(android_saf_root_stat): Report search permissions for files.
2023-07-29 20:53:21 +08:00
Po Lu
4bf8b0a2e9 Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (postInvalidateCache):
New argument cacheName.  Remove that file from the cache.
(accessDocument1): Consult the storage cache as well.
* java/org/gnu/emacs/EmacsService.java (deleteDocument): New
argument NAME.

* src/android.c (android_init_emacs_service): Add new argument.
* src/androidvfs.c (android_saf_delete_document)
(android_saf_tree_rmdir, android_saf_file_unlink): Pass name of
file being deleted to `deleteDocument'.
2023-07-29 15:57:44 +08:00
Po Lu
27fe17f0fc Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry):
(getCacheEntry):
(CacheEntry):
(documentIdFromName1): Fix earlier change.
2023-07-29 12:49:36 +08:00
Po Lu
d3e1e18873 Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry)
(getCacheEntry, CacheEntry): Use `uptimeMillis' as the basis for
cache expiration.
2023-07-29 11:29:25 +08:00
Po Lu
47f97b5ae4 Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (EmacsSafThread, getCache)
(pruneCache1, pruneCache, cacheChild, cacheDirectoryFromCursor)
(documentIdFromName1, openDocumentDirectory1): Implement the
cache referred to by the commentary.
* java/org/gnu/emacs/EmacsService.java (deleteDocument):
Invalidate the cache upon document removal.
* src/androidvfs.c (android_saf_exception_check)
(android_document_id_from_name): Correctly preserve or set errno
in error cases.
2023-07-29 11:24:07 +08:00
Po Lu
25ef0c3a89 Fix SAF query
* java/org/gnu/emacs/EmacsSafThread.java (documentIdFromName1):
Fix query argument placeholder string.
2023-07-28 16:43:40 +08:00
Po Lu
0709e03f88 Allow quitting from Android content provider operations
* doc/emacs/android.texi (Android Document Providers): Say that
quitting is now possible.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
functions `safSyncAndReadInput', `safync' and `safPostRequest'.
* java/org/gnu/emacs/EmacsSafThread.java: New file.  Move
cancel-able SAF operations here.
* java/org/gnu/emacs/EmacsService.java (EmacsService): Allow
quitting from most SAF operations.
* src/androidvfs.c (android_saf_exception_check): Return EINTR
if OperationCanceledException is received.
(android_saf_stat, android_saf_access)
(android_document_id_from_name, android_saf_tree_opendir_1)
(android_saf_file_open): Don't allow reentrant calls from async
input handlers.
(NATIVE_NAME): Implement new synchronization primitives for JNI.
(android_vfs_init): Initialize new class.

* src/dired.c (open_directory): Handle EINTR from opendir.
* src/sysdep.c: Describe which operations may return EINTR on
Android.
2023-07-28 15:19:37 +08:00
Po Lu
03cf3bbb5c Update Android port
* java/org/gnu/emacs/EmacsDirectoryEntry.java
(EmacsDirectoryEntry): Make class final.
* java/org/gnu/emacs/EmacsService.java (accessDocument)
(openDocumentDirectory, openDocument, createDocument): Throw
access and IO error exceptions instead of catching them.
(createDirectory, deleteDocument): New functions.
* src/android.c (android_init_emacs_service): Add new functions.
* src/android.h (struct android_emacs_service): Likewise.
* src/androidvfs.c (android_saf_exception_check): New function.
Translate between Java exceptions and errno values.
(android_saf_stat, android_saf_access, android_saf_delete_document)
(struct android_saf_tree_vnode, android_document_id_from_name)
(android_saf_tree_name, android_saf_tree_rmdir)
(android_saf_tree_opendir_1, android_saf_tree_opendir)
(android_saf_file_open, android_saf_file_unlink)
(android_saf_new_open, android_saf_new_mkdir): Implement missing
VFS operations and derive errno values from the type of any
exceptions thrown.
(android_vfs_init): Initialize exception classes.
(android_mkdir, android_fstat): Remove trailing whitespace.
2023-07-28 12:21:47 +08:00
Po Lu
de0e0939f0 Update Android port
* doc/emacs/android.texi (Android Document Providers): Improve
wording of paragraph clarifying limits on subprocesses.
* java/org/gnu/emacs/EmacsService.java (getDocumentTrees): Use
Java standard US-ASCII coding standard instead of the
undocumented ``ASCII'' alias.
(decodeFileName): Remove unused function.
(documentIdFromName):
* src/android.c (android_init_emacs_service): Take a String for
NAME instead of a byte array.
* src/androidvfs.c (android_verify_jni_string): New function.
(android_document_id_from_name): Verify that STRING is a valid
Modified UTF-8 string.
2023-07-27 21:59:58 +08:00
Po Lu
24af8af62c Avoid crashes in some edge cases
* java/org/gnu/emacs/EmacsActivity.java (onActivityResult):
Avoid crashes in some edge cases.
2023-07-27 20:32:16 +08:00
Po Lu
65b58251b1 Update Android port
* configure.ac (ANDROID_STUBIFY): Add androidvfs.o when building
libemacs.so.
* doc/emacs/android.texi (Android): Add `Android Document Providers'.
(Android Startup): Update the location of the content identifier
directory.
(Android File System): Describe access to document provider
directories.
(Android Document Providers): New node.
* doc/emacs/emacs.texi (Top): Update the menu for the Android
appendix.
* java/Makefile.in (filename, install_temp/assets/build_info): Make
directory-tree depend on build_info.
* java/org/gnu/emacs/EmacsActivity.java (onActivityResult): New
function.  When a document tree is accepted, persist access to it.
* java/org/gnu/emacs/EmacsDirectoryEntry.java (EmacsDirectoryEntry):
New struct.
* java/org/gnu/emacs/EmacsOpenActivity.java (checkReadableOrCopy): Use
EmacsService.buildContentName.
* java/org/gnu/emacs/EmacsService.java (getEmacsView, openContentUri)
(checkContentUri): Remove excessive debug logging.
(buildContentName, getDocumentAuthorities, requestDirectoryAccess)
(getDocumentTrees, decodeFileName, documentIdFromName, getTreeUri)
(statDocument, accessDocument, openDocumentDirectory, readDirectoryEntry)
(openDocument, createDocument): New functions.

* lib-src/asset-directory-tool.c: Improve commentary by illustrating
the difference between directory and ordinary files.

* src/android.c (ANDROID_THROW, enum android_fd_table_entry_flags)
(struct android_emacs_service, android_extract_long)
(android_scan_directory_tree, android_is_directory)
(android_get_asset_name, android_url_encode, android_content_name_p)
(android_get_content_name, android_check_content_access, android_fstat)
(android_fstatat, android_file_access_p, android_hack_asset_fd_fallback)
(android_detect_ashmem, android_hack_asset_fd, android_close_on_exec)
(android_open, android_close, android_fclose, android_create_lib_link)
(android_faccessat, struct android_dir, android_opendir, android_dirfd)
(android_readdir, android_closedir, android_lookup_asset_directory_fd)
(android_exception_check_3, android_get_current_api_level)
(android_open_asset, android_close_asset, android_asset_read_quit)
(android_asset_read, android_asset_lseek, android_asset_fstat): Move
content and asset related functions to androidvfs.c.
(android_init_emacs_service): Obtain handles for new JNI functions.
(initEmacsParams): Initialize the VFS layer.
(android_request_directory_access): New function.
(android_display_toast): Remove unused function.

* src/android.h (android_get_current_api_level): Assume that
this function never returns less than __ANDROID_API__.
(struct android_emacs_service): Move `struct
android_emacs_service' here.

* src/androidfns.c (Fandroid_request_directory_access): New
interactive function.
(syms_of_androidfns): Register new subr.

* src/androidvfs.c (struct android_vdir, struct android_vops)
(struct android_vnode, struct android_special_vnode)
(enum android_vnode_type, struct android_cursor_class)
(struct emacs_directory_entry_class)
(struct android_parcel_file_descriptor_class)
(android_init_cursor_class, android_init_entry_class)
(android_init_fd_class, android_vfs_canonicalize_name)
(struct android_unix_vnode, struct android_unix_vdir, unix_vfs_ops)
(android_unix_name, android_unix_vnode, android_unix_open)
(android_unix_close, android_unix_unlink, android_unix_symlink)
(android_unix_rmdir, android_unix_rename, android_unix_stat)
(android_unix_access, android_unix_mkdir, android_unix_readdir)
(android_unix_closedir, android_unix_dirfd, android_unix_opendir)
(android_extract_long, android_scan_directory_tree)
(android_is_directory, android_init_assets)
(android_hack_asset_fd_fallback, android_detect_ashmem)
(android_hack_asset_fd, struct android_afs_vnode)
(struct android_afs_vdir, struct android_afs_open_fd, afs_vfs_ops)
(android_afs_name, android_afs_initial, android_close_on_exec)
(android_afs_open, android_afs_close, android_afs_unlink)
(android_afs_symlink, android_afs_rmdir, android_afs_rename)
(android_afs_stat, android_afs_access, android_afs_mkdir)
(android_afs_readdir, android_afs_closedir, android_afs_dirfd)
(android_afs_opendir, android_afs_get_directory_name)
(struct android_content_vdir, content_vfs_ops)
(content_directory_contents, android_content_name)
(android_content_open, android_content_close)
(android_content_unlink, android_content_symlink)
(android_content_rmdir, android_content_rename)
(android_content_stat, android_content_access)
(android_content_mkdir, android_content_readdir)
(android_content_closedir, android_content_dirfd)
(android_content_opendir, android_content_get_directory_name)
(android_content_initial, android_get_content_name)
(android_check_content_access, struct android_authority_vnode)
(authority_vfs_ops, android_authority_name, android_authority_open)
(android_authority_close, android_authority_unlink)
(android_authority_symlink, android_authority_rmdir)
(android_authority_rename, android_authority_stat)
(android_authority_access, android_authority_mkdir)
(android_authority_opendir, android_authority_initial)
(struct android_saf_root_vnode, struct android_saf_root_vdir)
(saf_root_vfs_ops, android_saf_root_name, android_saf_root_open)
(android_saf_root_close, android_saf_root_unlink)
(android_saf_root_symlink, android_saf_root_rmdir)
(android_saf_root_rename, android_saf_root_stat)
(android_saf_root_access, android_saf_root_mkdir)
(android_saf_root_readdir, android_saf_root_closedir)
(android_saf_root_dirfd, android_saf_root_opendir)
(android_saf_root_initial, android_saf_root_get_directory)
(android_saf_stat, android_saf_access)
(struct android_saf_tree_vnode, struct android_saf_tree_vdir)
(saf_tree_vfs_ops, android_document_id_from_name)
(android_saf_tree_name, android_saf_tree_open)
(android_saf_tree_close, android_saf_tree_unlink)
(android_saf_tree_symlink, android_saf_tree_rmdir)
(android_saf_tree_rename, android_saf_tree_stat)
(android_saf_tree_access, android_saf_tree_mkdir)
(android_saf_tree_opendir_1, android_saf_tree_readdir)
(android_saf_tree_closedir, android_saf_tree_dirfd)
(android_saf_tree_opendir, android_saf_tree_from_name)
(android_saf_tree_get_directory, android_saf_file_vnode)
(saf_file_vfs_ops, android_saf_file_name, android_saf_file_open)
(android_saf_file_unlink, android_saf_file_rmdir)
(android_saf_file_opendir, android_close_parcel_fd)
(android_saf_new_vnode, android_saf_new_name, android_saf_new_open)
(android_saf_new_unlink, android_saf_new_symlink)
(android_saf_new_rmdir, android_saf_new_rename)
(android_saf_new_stat, android_saf_new_access)
(android_saf_new_mkdir, android_saf_new_opendir, root_vfs_ops)
(special_vnodes, android_root_name, android_name_file)
(android_vfs_init, android_open, android_unlink, android_symlink)
(android_rmdir, android_mkdir, android_renameat_noreplace)
(android_rename, android_fstat, android_fstatat_1, android_fstatat)
(android_faccessat, android_fdopen, android_close, android_fclose)
(android_open_asset, android_close_asset, android_asset_read_quit)
(android_asset_read, android_asset_lseek, android_asset_fstat)
(android_opendir, android_dirfd, android_readdir)
(android_closedir): Move file system emulation routines here.
Introduce a new ``VFS'' layer for translating between
Emacs-specific file names and the various disparate interfaces
for accessing files on Android.

* src/callproc.c (delete_temp_file):
* src/charset.c (load_charset_map_from_file):
* src/dired.c:
* src/emacs.c (Fkill_emacs):
* src/fileio.c (check_mutable_filename, Fcopy_file)
(Fmake_directory_internal, Fdelete_directory_internal)
(Fdelete_file, Frename_file, Fadd_name_to_file)
(Fmake_symbolic_link, file_accessible_directory_p, Fset_file_modes)
(Fset_file_times, write_region):
* src/filelock.c (get_boot_time, rename_lock_file)
(create_lock_file, current_lock_owner, unlock_file):
* src/image.c (slurp_file, png_load_body, jpeg_load_body):
* src/keyboard.c (Fopen_dribble_file):
* src/lisp.h:
* src/lread.c (Fload):
* src/process.c (handle_child_signal):
* src/sysdep.c (init_standard_fds, emacs_fopen, emacs_fdopen)
(emacs_unlink, emacs_symlink, emacs_rmdir, emacs_mkdir)
(emacs_renameat_noreplace, emacs_rename):
* src/term.c (Fresume_tty, init_tty): Use and add new wrappers
for fopen, fdopen, unlink, symlink, rmdir, mkdir,
renameat_norepalce and rename.
2023-07-27 17:13:39 +08:00
Po Lu
7e8904e796 Use context menu header titles on Android
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
New field `title'.
(addSubmenu): New arg TITLE.  Set that field.
(expandTo): Set MENU's header title if it's a context menu.
* src/androidmenu.c (android_init_emacs_context_menu): Adjust
signature of `createContextMenu'.
(android_menu_show): Use TITLE instead of pane titles if there's
only one pane.
2023-07-20 11:21:25 +08:00
Po Lu
5ff31bf36c Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Describe
treatment of canceled touch sequences during touch event
translation.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update JNI
prototypes.
* java/org/gnu/emacs/EmacsWindow.java (motionEvent): Set
cancelation flag in events sent where appropriate.
* lisp/touch-screen.el (touch-screen-handle-point-update):
Improve treatment of horizontal scrolling near window edges.
(touch-screen-handle-touch): Don't handle point up if the touch
sequence has been canceled.
* src/android.c (sendTouchDown, sendTouchUp, sendTouchMove): New
argument `flags'.
* src/androidgui.h (enum android_touch_event_flags): New enum.
(struct android_touch_event): New field `flags'.
* src/androidterm.c (handle_one_android_event): Report
cancelation in TOUCHSCREEN_END_EVENTs.
* src/keyboard.c (make_lispy_event): Fix botched merge.
2023-07-18 10:12:40 +08:00
Po Lu
8335c76e88 Update Android port
* java/org/gnu/emacs/EmacsService.java (displayToast):
* src/android.c (android_init_emacs_service): Remove unused
function.
* lisp/touch-screen.el (touch-screen-handle-point-up): Correctly
compute posn point.
(touch-screen-translate-touch): Update doc string.
(function-key-map): Define touch screen translation functions
within the internal border.
2023-07-16 20:10:18 +08:00
Po Lu
e9a39fd898 Update Android port
* doc/emacs/android.texi (Android): Add new node to menu.
(Android Environment): Add footnote pointing to new node.
(Android Software): New node.
* doc/emacs/emacs.texi (Top): Add new node to menu.
* java/AndroidManifest.xml.in (manifest): Fix location of
sharedUserId property.
* java/INSTALL: Improve documentation of shared user ID
support.
2023-07-15 09:53:22 +08:00
Po Lu
11c8a2fa87 Make --with-shared-user-id work
* configure.ac (ANDROID_SHARED_USER_NAME): New variable.
Substitute it.
* java/AndroidManifest.xml.in: Set `sharedUserLabel' if a shared
user ID is enabled.
* java/res/values/strings.xml (shared_user_name): New string
resource.
2023-07-14 20:30:30 +08:00
Po Lu
4c390f14f4 Clean up Android debug code
* java/org/gnu/emacs/EmacsInputConnection.java
(getSurroundingText): Don't print debug information if DEBUG_IC
is off.
2023-07-14 08:51:07 +08:00
Po Lu
ae9f1a075c Improve workaround for partial texture updates on Android
* java/AndroidManifest.xml.in:
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Don't
change hardware acceleration state.
* java/org/gnu/emacs/EmacsNative.java (notifyPixelsChanged): New
function.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
New field `bitmapChanged'.
(copyToFrontBuffer): Signal that the bitmap has changed.
(onDraw): If the bitmap has changed, increment the generation
ID.
* src/android.c (JNICALL): Implement new function.
2023-07-13 18:17:59 +08:00
Po Lu
140755f2cf Disable hardware acceleration on Android
It serves no purpose and causes tearing.  Uploading the bitmap
to the GPU takes about as long as it does to incrementally
update the surface in software.

* java/AndroidManifest.xml.in: Disable hardware acceleration.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): Make
lastClosedMenu static.
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Enable
hardware acceleration within alert dialogs.
* java/org/gnu/emacs/EmacsSurfaceView.java (onDraw): Describe
why hardware acceleration is disabled.
* java/org/gnu/emacs/EmacsWindow.java (run): Remove redundant
call.
2023-07-13 12:05:50 +08:00
Po Lu
c8c2bec5f8 Update Android port
* java/org/gnu/emacs/EmacsWindow.java (whatButtonWasIt): Handle
back and forward buttons along with styluses.
* src/doc.c (close_file_unwind_android_fd): New function.
(get_doc_string, Fsnarf_documentation): Don't create a temporary
fd if it can be avoided.
2023-07-12 09:45:58 +08:00
Po Lu
fcf53bf9f5 Fix doc file generation on Android
* .gitignore: Ignore cross/etc/DOC.
* configure.ac: Make the directory `cross/etc'.
* cross/Makefile.in (CLEAN_SUBDIRS): Clean files inside `etc' as
well.
* java/Makefile.in (install_temp): Copy cross/etc/DOC to the
package if it is available.
* src/Makefile.in (SOME_MACHINE_OBJECTS): Add androidselect.c,
sfntfont-android.c and sfntfont.c.
(libemacs.so): Depend on $(etc)/DOC.
2023-07-11 16:47:13 +08:00
Po Lu
24ae08c113 Update Android port
* java/org/gnu/emacs/EmacsView.java (onGenericMotionEvent): Call
onGenericMotionEvent.
* java/org/gnu/emacs/EmacsWindow.java (Coordinate): New fields
`button' and `id'.
(<init>): Add new arguments to the construtor.
(whatButtonWasIt): Return 0 if the button state has not changed.
(buttonForEvent): New function.
(figureChange): Return the Coordinate object associated to
EVENT.  Determine whether or not EVENT was accompanied by a
change to the button state, and ascertain which button that was.
(motionEvent): New function.
(onGenericMotionEvent, onTouchEvent): Factor out touch and mouse
event delivery to motionEvent.
2023-07-11 10:22:03 +08:00
Po Lu
cf2dde4261 Update Android port
* java/org/gnu/emacs/EmacsService.java (browseUrl): New argument
SEND.  Choose from a list of applications that want to share the
URL if true.
* lisp/net/browse-url.el (browse-url-android-share): New user
option.
(browse-url-default-android-browser): Respect said user option.
* src/android.c (android_init_emacs_service)
(android_browse_url): Expose new option.
* src/android.h: Update prototypes.
* src/androidselect.c (Fandroid_browse_url): Likewise.
2023-07-10 13:31:57 +08:00
Po Lu
ed5ade097e Update Android port
* java/org/gnu/emacs/EmacsWindow.java (eventModifiers)
(motionEventModifiers): New functions.
(onKeyDown, onKeyUp, onFocusChanged, onSomeKindOfMotionEvent):
Don't record the previous modifier mask; instead, always use the
modifier state specified in the event.
* src/androidterm.c (handle_one_android_event): Don't dispatch
button release events when a popup is active.
2023-07-09 13:13:53 +08:00
Po Lu
97f926b82d Update Android port
* java/org/gnu/emacs/EmacsService.java (onStartCommand): Fix
typo in notification message.
* java/org/gnu/emacs/EmacsWindow.java (onFocusChanged): Reset
the recorded modifier state upon a change to the window focus.
2023-07-09 12:50:15 +08:00
Po Lu
8afb5644fd ; * java/org/gnu/emacs/EmacsService.java (onCreate): Fix typo. 2023-07-09 10:06:18 +08:00
Po Lu
105c876a60 Update Android port
* java/org/gnu/emacs/EmacsDrawPoint.java (perform): Don't fill
an extra pixel.
* java/org/gnu/emacs/EmacsService.java (onCreate): Make sure
scaledDensity is always at least 160 dpi.
2023-07-09 10:05:08 +08:00
Po Lu
a36207574a Fix EmacsDrawLine again
* java/org/gnu/emacs/EmacsDrawLine.java (perform): Symmetrically
adjust coordinates to cover the last pixel.  Then, fill the left
most pixel of the line.
2023-07-08 21:49:21 +08:00
Po Lu
c843f3e23b Update Android port
* java/org/gnu/emacs/EmacsService.java (DEBUG_IC)
(DEBUG_THREADS): Improve commentary.
* src/androidterm.c (handle_one_android_event): Signal
completion of IME events that have lost their frames.
(requestCursorUpdates): Don't set an edit counter as this event
won't be passed to the text conversion machinery.
2023-07-08 10:15:38 +08:00
Po Lu
e40dca8361 Update Android port
* java/org/gnu/emacs/EmacsSurfaceView.java (copyToFrontBuffer):
Use fallback bit blit function on Android 7.0 as well, as
crashes have been observed in drawBitmap.
2023-07-07 14:22:38 +08:00
Po Lu
75db451170 Update Android port
* java/org/gnu/emacs/EmacsNative.java (scaledDensity): Announce
new argument `scaledDensity'.
* java/org/gnu/emacs/EmacsNoninteractive.java (main): Specify
new argument.
* java/org/gnu/emacs/EmacsService.java (onCreate): Compute an
adjusted DPI for the font size based on the ratio between
density and scaledDensity.
(run): Specify that adjusted density.
* src/android.c (setEmacsParams): Set
`android_scaled_pixel_density'.
* src/android.h: (android_scaled_pixel_density: New variable.
* src/androidterm.c (android_term_init): Set `font_resolution'.
* src/androidterm.h (struct android_display_info): New field.
* src/font.c (font_pixel_size, font_find_for_lface)
(font_open_for_lface, Ffont_face_attributes, Fopen_font): Use
FRAME_RES instead of FRAME_RES_Y.
* src/frame.h (FRAME_RES): New macro.  Use this to convert
between font point and pixel sizes as opposed to FRAME_RES_Y.
* src/w32font.c (fill_in_logfont):
* src/xfaces.c (Fx_family_fonts, set_lface_from_font): Use
FRAME_RES instead of FRAME_RES_Y.  (bug#64444)
2023-07-06 09:35:27 +08:00
Po Lu
08f90dc005 Fix bug#64445
* doc/emacs/android.texi (Android Environment): Document that
Emacs also receives READ_EXTERNAL_STORAGE by default on old
versions of Android.
* java/AndroidManifest.xml.in: Request READ_EXTERNAL_STORAGE.
(bug#64445)
2023-07-05 20:16:14 +08:00
Po Lu
257e49ff0d Fix crash between Android 4.0 and Android 5.1
* java/org/gnu/emacs/EmacsService.java (detectMouse): Don't use
function that is not present on Android 4.0.
2023-07-05 14:57:15 +08:00
Po Lu
a5ee9a69ae Update Android port
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity):
(hasChar): Clean up dead stores.
2023-06-23 11:54:56 +08:00
Po Lu
405d14402f Update Android port
* java/org/gnu/emacs/EmacsView.java (EmacsView, dimensionsLock):
New field.
(<init>): Create new lock object.
(handleDirtyBitmap, onLayout, onAttachedToWindow): Make sure
measuredWidth and measuredHeight are extracted and set
atomically.  Send Expose upon layout changes if the view has
grown.
2023-06-19 15:26:07 +08:00
Po Lu
797c30b7ab Initialize signal mask earlier
* java/org/gnu/emacs/EmacsService.java (onCreate, run): Don't
initialize signal mask here.
* java/org/gnu/emacs/EmacsApplication.java (onCreate): Do it
here instead.
* src/android.c (JNICALL): Restore previous signal masks.
2023-06-17 12:07:40 +08:00
Po Lu
fa821ed186 ; * java/README: More documentation. 2023-06-17 11:24:54 +08:00
Po Lu
377a3ebbb5 Update Android port
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsApplication.java (findDumpFile):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(addSubmenu, display):
* java/org/gnu/emacs/EmacsDocumentsProvider.java
(getNotificationUri, queryChildDocuments, deleteDocument):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog)
(checkReadableOrCopy):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java
(EmacsSdk7FontDriver):
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyUp):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Remove various unused arguments
and variables, dead stores, and make minor cleanups and
performance improvements.
* src/androidmenu.c (FIND_METHOD_STATIC, android_menu_show):
Adjust accordingly.
2023-06-16 12:59:44 +08:00
Po Lu
363e293cc9 Update Android port
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection, beginBatchEdit, reset, endBatchEdit):
Keep track of the number of batch edits and return an
appropriate value.
(takeSnapshot): Implement function.
* java/org/gnu/emacs/EmacsNative.java (takeSnapshot): New
function.
* java/org/gnu/emacs/EmacsService.java (resetIC): Improve
debugging output.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call `reset' to clear the UI side batch edit count.
* src/androidterm.c (struct
android_get_surrounding_text_context): New fields
`conversion_start' and `conversion_end'.
(android_get_surrounding_text): Return the conversion region.
(android_get_surrounding_text_internal, NATIVE_NAME): Factor out
`getSurroundingText'.
(takeSnapshot): New function.
2023-06-15 12:36:50 +08:00
Po Lu
90ae3cc387 Improve IM synchronization on Android
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): Reimplement as an InputConnection, not
BaseInputConnection.
* src/androidterm.c (performEditorAction): Sync prior to sending
keyboard events.
2023-06-14 15:37:47 +08:00
Po Lu
1cd514c297 Improve appearance of custom dialog buttons on Android
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Resolve
dialog button style and use it instead.
2023-06-12 20:09:09 +08:00
Po Lu
3b08bb1318 Fix deadlocks
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(showOnScreenKeyboard, hideOnScreenKeyboard): Don't synchronize.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(toggleOnScreenKeyboard): Revert to calling IMM functions from
the main thread.
* src/android.c (struct android_event_container)
(android_pselect_nfds, android_pselect_readfds)
(android_pselect_writefds, android_pselect_exceptfds)
(android_pselect_timeout): Don't make volatile.
(android_wait_event): Run queries if necessary.
2023-06-12 14:19:01 +08:00
Po Lu
24f25fc2f8 Update Android port
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
Document member variables.
(onDraw): Use separate Paint object on the UI thread.
* src/textconv.c (really_commit_text, really_set_composing_text)
(really_delete_surrounding_text): Run modification hooks when
deleting text.
2023-06-11 14:35:13 +08:00
Po Lu
5abc977bbb Avoid extraneous calls to the UI thread
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(showOnScreenKeyboard, hideOnScreenKeyboard)
(onCheckIsTextEditor): Make synchronized.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(toggleOnScreenKeyboard): Don't post to the main thread.
2023-06-11 08:52:10 +08:00
Po Lu
c321eea5af Block profiling signals in the Android UI thread
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function `setupSystemThread'.
* java/org/gnu/emacs/EmacsService.java (onCreate): Block all
signals except for SIGBUS and SIGSEGV in the UI thread.
* src/android.c (setupSystemThread): New function.
2023-06-09 14:03:50 +08:00
Po Lu
7f073df533 Fix crash starting Emacs to open file
* java/org/gnu/emacs/EmacsThread.java (run): Correct check
against extraStartupArgument when an initial file is specified.
2023-06-09 09:27:04 +08:00