1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 08:11:05 -08:00

Update Android port

* java/debug.sh (is_root): Go back to using unix sockets; allow
adb to forward them correctly.
* java/org/gnu/emacs/EmacsInputConnection.java
(getExtractedText): Don't print text if NULL.
* java/org/gnu/emacs/EmacsService.java (EmacsService): New field
`imSyncInProgress'.
(updateIC): If an IM sync might be in progress, avoid deadlocks.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Set `imSyncInProgress' across synchronization point.
* src/android.c (android_check_query): Use __atomic_store_n.
(android_answer_query): New function.
(android_begin_query): Set `android_servicing_query' to 2.
Check once, and don't spin waiting for query to complete.
(android_end_query): Use __atomic_store_n.
(android_run_in_emacs_thread): Compare-and-exchange flag.  If
originally 1, fail.
* src/textconv.c (really_set_composing_text): Clear conversion
region if text is empty.
This commit is contained in:
Po Lu 2023-05-31 10:13:04 +08:00
parent 733a6776f9
commit 57903519eb
6 changed files with 126 additions and 22 deletions

View file

@ -104,6 +104,9 @@ public final class EmacsService extends Service
performing drawing calls. */
private static final boolean DEBUG_THREADS = false;
/* Whether or not onCreateInputMethod is calling getSelection. */
public static volatile boolean imSyncInProgress;
/* Return the directory leading to the directory in which native
library files are stored on behalf of CONTEXT. */
@ -636,16 +639,41 @@ public final class EmacsService extends Service
int newSelectionEnd, int composingRegionStart,
int composingRegionEnd)
{
boolean wasSynchronous;
if (DEBUG_IC)
Log.d (TAG, ("updateIC: " + window + " " + newSelectionStart
+ " " + newSelectionEnd + " "
+ composingRegionStart + " "
+ composingRegionEnd));
/* `updateSelection' holds an internal lock that is also taken
before `onCreateInputConnection' (in EmacsView.java) is called;
when that then asks the UI thread for the current selection, a
dead lock results. To remedy this, reply to any synchronous
queries now -- and prohibit more queries for the duration of
`updateSelection' -- if EmacsView may have been asking for the
value of the region. */
wasSynchronous = false;
if (EmacsService.imSyncInProgress)
{
/* `beginSynchronous' will answer any outstanding queries and
signal that one is now in progress, thereby preventing
`getSelection' from blocking. */
EmacsNative.beginSynchronous ();
wasSynchronous = true;
}
window.view.imManager.updateSelection (window.view,
newSelectionStart,
newSelectionEnd,
composingRegionStart,
composingRegionEnd);
if (wasSynchronous)
EmacsNative.endSynchronous ();
}
public void