aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-25 21:52:11 +0800
committerPo Lu2023-02-25 21:52:11 +0800
commit8fa86cc7cd708fae8657b4e977711132999054bc (patch)
tree5b4b5984bb8ed5914fb7e34aba124e01852b7e56 /src
parent80f26cc3988bf06e876ee9ed4b05a4400bf626b7 (diff)
downloademacs-8fa86cc7cd708fae8657b4e977711132999054bc.tar.gz
emacs-8fa86cc7cd708fae8657b4e977711132999054bc.zip
Update Android port
* java/debug.sh (is_root): Fix tee detection again for old systems which don't return exit codes from adb shell. * src/android.c (android_run_select_thread, NATIVE_NAME, JNICALL): * src/android.h (NATIVE_NAME): * src/androidterm.c (JNICALL, NATIVE_NAME): Apply stack alignment to all JNICALL functions.
Diffstat (limited to 'src')
-rw-r--r--src/android.c97
-rw-r--r--src/android.h16
-rw-r--r--src/androidterm.c30
3 files changed, 127 insertions, 16 deletions
diff --git a/src/android.c b/src/android.c
index 50871c94987..99c612f13df 100644
--- a/src/android.c
+++ b/src/android.c
@@ -224,9 +224,13 @@ static struct android_emacs_window window_class;
224 stored in unsigned long to be consistent with X. */ 224 stored in unsigned long to be consistent with X. */
225unsigned int event_serial; 225unsigned int event_serial;
226 226
227#ifdef __i386__
228
227/* Unused pointer used to control compiler optimizations. */ 229/* Unused pointer used to control compiler optimizations. */
228void *unused_pointer; 230void *unused_pointer;
229 231
232#endif /* __i386__ */
233
230 234
231 235
232/* Event handling functions. Events are stored on a (circular) queue 236/* Event handling functions. Events are stored on a (circular) queue
@@ -295,10 +299,13 @@ static int select_pipe[2];
295static void * 299static void *
296android_run_select_thread (void *data) 300android_run_select_thread (void *data)
297{ 301{
302 /* Apparently this is required too. */
303 JNI_STACK_ALIGNMENT_PROLOGUE;
304
298 int rc; 305 int rc;
299#if __ANDROID_API__ < 16 306#if __ANDROID_API__ < 16
300 int nfds; 307 int nfds;
301 fd_set readfds; 308 fd_set readfds, writefds;
302 char byte; 309 char byte;
303#else 310#else
304 sigset_t signals, waitset; 311 sigset_t signals, waitset;
@@ -325,23 +332,29 @@ android_run_select_thread (void *data)
325 332
326 pthread_mutex_lock (&event_queue.select_mutex); 333 pthread_mutex_lock (&event_queue.select_mutex);
327 nfds = android_pselect_nfds; 334 nfds = android_pselect_nfds;
328 readfds = *android_pselect_readfds; 335
336 if (android_pselect_readfds)
337 readfds = *android_pselect_readfds;
338 else
339 FD_ZERO (&readfds);
329 340
330 if (nfds < select_pipe[0] + 1) 341 if (nfds < select_pipe[0] + 1)
331 nfds = select_pipe[0] + 1; 342 nfds = select_pipe[0] + 1;
332 FD_SET (select_pipe[0], &readfds); 343 FD_SET (select_pipe[0], &readfds);
333 344
334 rc = pselect (nfds, &readfds, 345 rc = pselect (nfds, &readfds, &writefds,
335 android_pselect_writefds,
336 android_pselect_exceptfds, 346 android_pselect_exceptfds,
337 android_pselect_timeout, 347 android_pselect_timeout,
338 NULL); 348 NULL);
339 349
340 /* Subtract 1 from rc if writefds contains the select pipe. */ 350 /* Subtract 1 from rc if writefds contains the select pipe. */
341 if (FD_ISSET (select_pipe[0], 351 if (FD_ISSET (select_pipe[0], &writefds))
342 android_pselect_writefds))
343 rc -= 1; 352 rc -= 1;
344 353
354 /* Save the writefds back again. */
355 if (android_pselect_writefds)
356 *android_pselect_writefds = writefds;
357
345 android_pselect_rc = rc; 358 android_pselect_rc = rc;
346 pthread_mutex_unlock (&event_queue.select_mutex); 359 pthread_mutex_unlock (&event_queue.select_mutex);
347 360
@@ -1641,12 +1654,16 @@ android_proc_name (int fd, char *buffer, size_t size)
1641JNIEXPORT jint JNICALL 1654JNIEXPORT jint JNICALL
1642NATIVE_NAME (dup) (JNIEnv *env, jobject object, jint fd) 1655NATIVE_NAME (dup) (JNIEnv *env, jobject object, jint fd)
1643{ 1656{
1657 JNI_STACK_ALIGNMENT_PROLOGUE;
1658
1644 return dup (fd); 1659 return dup (fd);
1645} 1660}
1646 1661
1647JNIEXPORT jstring JNICALL 1662JNIEXPORT jstring JNICALL
1648NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object) 1663NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object)
1649{ 1664{
1665 JNI_STACK_ALIGNMENT_PROLOGUE;
1666
1650 char buffer[sizeof fingerprint * 2 + 1]; 1667 char buffer[sizeof fingerprint * 2 + 1];
1651 1668
1652 memset (buffer, 0, sizeof buffer); 1669 memset (buffer, 0, sizeof buffer);
@@ -1666,6 +1683,8 @@ NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object,
1666 jobject class_path, 1683 jobject class_path,
1667 jobject emacs_service_object) 1684 jobject emacs_service_object)
1668{ 1685{
1686 JNI_STACK_ALIGNMENT_PROLOGUE;
1687
1669 int pipefd[2]; 1688 int pipefd[2];
1670 pthread_t thread; 1689 pthread_t thread;
1671 const char *java_string; 1690 const char *java_string;
@@ -1864,6 +1883,8 @@ NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object,
1864JNIEXPORT jobject JNICALL 1883JNIEXPORT jobject JNICALL
1865NATIVE_NAME (getProcName) (JNIEnv *env, jobject object, jint fd) 1884NATIVE_NAME (getProcName) (JNIEnv *env, jobject object, jint fd)
1866{ 1885{
1886 JNI_STACK_ALIGNMENT_PROLOGUE;
1887
1867 char buffer[PATH_MAX + 1]; 1888 char buffer[PATH_MAX + 1];
1868 size_t length; 1889 size_t length;
1869 jbyteArray array; 1890 jbyteArray array;
@@ -2090,22 +2111,20 @@ JNIEXPORT void JNICALL
2090NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv, 2111NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
2091 jobject dump_file_object, jint api_level) 2112 jobject dump_file_object, jint api_level)
2092{ 2113{
2093 char **c_argv;
2094 jsize nelements, i;
2095 jobject argument;
2096 const char *c_argument;
2097 char *dump_file;
2098
2099 /* android_emacs_init is not main, so GCC is not nice enough to add 2114 /* android_emacs_init is not main, so GCC is not nice enough to add
2100 the stack alignment prologue. 2115 the stack alignment prologue.
2101 2116
2102 Unfortunately for us, dalvik on Android 4.0.x calls native code 2117 Unfortunately for us, dalvik on Android 4.0.x calls native code
2103 with a 4 byte aligned stack. */ 2118 with a 4 byte aligned stack, so this prologue must be inserted
2119 before each function exported via JNI. */
2104 2120
2105 __attribute__ ((aligned (32))) char buffer[32]; 2121 JNI_STACK_ALIGNMENT_PROLOGUE;
2106 2122
2107 /* Trick GCC into not optimizing this variable away. */ 2123 char **c_argv;
2108 unused_pointer = buffer; 2124 jsize nelements, i;
2125 jobject argument;
2126 const char *c_argument;
2127 char *dump_file;
2109 2128
2110 /* Set the Android API level. */ 2129 /* Set the Android API level. */
2111 android_api_level = api_level; 2130 android_api_level = api_level;
@@ -2183,12 +2202,16 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
2183JNIEXPORT void JNICALL 2202JNIEXPORT void JNICALL
2184NATIVE_NAME (emacsAbort) (JNIEnv *env, jobject object) 2203NATIVE_NAME (emacsAbort) (JNIEnv *env, jobject object)
2185{ 2204{
2205 JNI_STACK_ALIGNMENT_PROLOGUE;
2206
2186 emacs_abort (); 2207 emacs_abort ();
2187} 2208}
2188 2209
2189JNIEXPORT void JNICALL 2210JNIEXPORT void JNICALL
2190NATIVE_NAME (quit) (JNIEnv *env, jobject object) 2211NATIVE_NAME (quit) (JNIEnv *env, jobject object)
2191{ 2212{
2213 JNI_STACK_ALIGNMENT_PROLOGUE;
2214
2192 Vquit_flag = Qt; 2215 Vquit_flag = Qt;
2193} 2216}
2194 2217
@@ -2198,6 +2221,8 @@ NATIVE_NAME (sendConfigureNotify) (JNIEnv *env, jobject object,
2198 jint x, jint y, jint width, 2221 jint x, jint y, jint width,
2199 jint height) 2222 jint height)
2200{ 2223{
2224 JNI_STACK_ALIGNMENT_PROLOGUE;
2225
2201 union android_event event; 2226 union android_event event;
2202 2227
2203 event.xconfigure.type = ANDROID_CONFIGURE_NOTIFY; 2228 event.xconfigure.type = ANDROID_CONFIGURE_NOTIFY;
@@ -2219,6 +2244,8 @@ NATIVE_NAME (sendKeyPress) (JNIEnv *env, jobject object,
2219 jint state, jint keycode, 2244 jint state, jint keycode,
2220 jint unicode_char) 2245 jint unicode_char)
2221{ 2246{
2247 JNI_STACK_ALIGNMENT_PROLOGUE;
2248
2222 union android_event event; 2249 union android_event event;
2223 2250
2224 event.xkey.type = ANDROID_KEY_PRESS; 2251 event.xkey.type = ANDROID_KEY_PRESS;
@@ -2239,6 +2266,8 @@ NATIVE_NAME (sendKeyRelease) (JNIEnv *env, jobject object,
2239 jint state, jint keycode, 2266 jint state, jint keycode,
2240 jint unicode_char) 2267 jint unicode_char)
2241{ 2268{
2269 JNI_STACK_ALIGNMENT_PROLOGUE;
2270
2242 union android_event event; 2271 union android_event event;
2243 2272
2244 event.xkey.type = ANDROID_KEY_RELEASE; 2273 event.xkey.type = ANDROID_KEY_RELEASE;
@@ -2257,6 +2286,8 @@ JNIEXPORT jlong JNICALL
2257NATIVE_NAME (sendFocusIn) (JNIEnv *env, jobject object, 2286NATIVE_NAME (sendFocusIn) (JNIEnv *env, jobject object,
2258 jshort window, jlong time) 2287 jshort window, jlong time)
2259{ 2288{
2289 JNI_STACK_ALIGNMENT_PROLOGUE;
2290
2260 union android_event event; 2291 union android_event event;
2261 2292
2262 event.xfocus.type = ANDROID_FOCUS_IN; 2293 event.xfocus.type = ANDROID_FOCUS_IN;
@@ -2272,6 +2303,8 @@ JNIEXPORT jlong JNICALL
2272NATIVE_NAME (sendFocusOut) (JNIEnv *env, jobject object, 2303NATIVE_NAME (sendFocusOut) (JNIEnv *env, jobject object,
2273 jshort window, jlong time) 2304 jshort window, jlong time)
2274{ 2305{
2306 JNI_STACK_ALIGNMENT_PROLOGUE;
2307
2275 union android_event event; 2308 union android_event event;
2276 2309
2277 event.xfocus.type = ANDROID_FOCUS_OUT; 2310 event.xfocus.type = ANDROID_FOCUS_OUT;
@@ -2287,6 +2320,8 @@ JNIEXPORT jlong JNICALL
2287NATIVE_NAME (sendWindowAction) (JNIEnv *env, jobject object, 2320NATIVE_NAME (sendWindowAction) (JNIEnv *env, jobject object,
2288 jshort window, jint action) 2321 jshort window, jint action)
2289{ 2322{
2323 JNI_STACK_ALIGNMENT_PROLOGUE;
2324
2290 union android_event event; 2325 union android_event event;
2291 2326
2292 event.xaction.type = ANDROID_WINDOW_ACTION; 2327 event.xaction.type = ANDROID_WINDOW_ACTION;
@@ -2303,6 +2338,8 @@ NATIVE_NAME (sendEnterNotify) (JNIEnv *env, jobject object,
2303 jshort window, jint x, jint y, 2338 jshort window, jint x, jint y,
2304 jlong time) 2339 jlong time)
2305{ 2340{
2341 JNI_STACK_ALIGNMENT_PROLOGUE;
2342
2306 union android_event event; 2343 union android_event event;
2307 2344
2308 event.xcrossing.type = ANDROID_ENTER_NOTIFY; 2345 event.xcrossing.type = ANDROID_ENTER_NOTIFY;
@@ -2321,6 +2358,8 @@ NATIVE_NAME (sendLeaveNotify) (JNIEnv *env, jobject object,
2321 jshort window, jint x, jint y, 2358 jshort window, jint x, jint y,
2322 jlong time) 2359 jlong time)
2323{ 2360{
2361 JNI_STACK_ALIGNMENT_PROLOGUE;
2362
2324 union android_event event; 2363 union android_event event;
2325 2364
2326 event.xcrossing.type = ANDROID_LEAVE_NOTIFY; 2365 event.xcrossing.type = ANDROID_LEAVE_NOTIFY;
@@ -2339,6 +2378,8 @@ NATIVE_NAME (sendMotionNotify) (JNIEnv *env, jobject object,
2339 jshort window, jint x, jint y, 2378 jshort window, jint x, jint y,
2340 jlong time) 2379 jlong time)
2341{ 2380{
2381 JNI_STACK_ALIGNMENT_PROLOGUE;
2382
2342 union android_event event; 2383 union android_event event;
2343 2384
2344 event.xmotion.type = ANDROID_MOTION_NOTIFY; 2385 event.xmotion.type = ANDROID_MOTION_NOTIFY;
@@ -2358,6 +2399,8 @@ NATIVE_NAME (sendButtonPress) (JNIEnv *env, jobject object,
2358 jlong time, jint state, 2399 jlong time, jint state,
2359 jint button) 2400 jint button)
2360{ 2401{
2402 JNI_STACK_ALIGNMENT_PROLOGUE;
2403
2361 union android_event event; 2404 union android_event event;
2362 2405
2363 event.xbutton.type = ANDROID_BUTTON_PRESS; 2406 event.xbutton.type = ANDROID_BUTTON_PRESS;
@@ -2379,6 +2422,8 @@ NATIVE_NAME (sendButtonRelease) (JNIEnv *env, jobject object,
2379 jlong time, jint state, 2422 jlong time, jint state,
2380 jint button) 2423 jint button)
2381{ 2424{
2425 JNI_STACK_ALIGNMENT_PROLOGUE;
2426
2382 union android_event event; 2427 union android_event event;
2383 2428
2384 event.xbutton.type = ANDROID_BUTTON_RELEASE; 2429 event.xbutton.type = ANDROID_BUTTON_RELEASE;
@@ -2399,6 +2444,8 @@ NATIVE_NAME (sendTouchDown) (JNIEnv *env, jobject object,
2399 jshort window, jint x, jint y, 2444 jshort window, jint x, jint y,
2400 jlong time, jint pointer_id) 2445 jlong time, jint pointer_id)
2401{ 2446{
2447 JNI_STACK_ALIGNMENT_PROLOGUE;
2448
2402 union android_event event; 2449 union android_event event;
2403 2450
2404 event.touch.type = ANDROID_TOUCH_DOWN; 2451 event.touch.type = ANDROID_TOUCH_DOWN;
@@ -2418,6 +2465,8 @@ NATIVE_NAME (sendTouchUp) (JNIEnv *env, jobject object,
2418 jshort window, jint x, jint y, 2465 jshort window, jint x, jint y,
2419 jlong time, jint pointer_id) 2466 jlong time, jint pointer_id)
2420{ 2467{
2468 JNI_STACK_ALIGNMENT_PROLOGUE;
2469
2421 union android_event event; 2470 union android_event event;
2422 2471
2423 event.touch.type = ANDROID_TOUCH_UP; 2472 event.touch.type = ANDROID_TOUCH_UP;
@@ -2437,6 +2486,8 @@ NATIVE_NAME (sendTouchMove) (JNIEnv *env, jobject object,
2437 jshort window, jint x, jint y, 2486 jshort window, jint x, jint y,
2438 jlong time, jint pointer_id) 2487 jlong time, jint pointer_id)
2439{ 2488{
2489 JNI_STACK_ALIGNMENT_PROLOGUE;
2490
2440 union android_event event; 2491 union android_event event;
2441 2492
2442 event.touch.type = ANDROID_TOUCH_MOVE; 2493 event.touch.type = ANDROID_TOUCH_MOVE;
@@ -2457,6 +2508,8 @@ NATIVE_NAME (sendWheel) (JNIEnv *env, jobject object,
2457 jlong time, jint state, 2508 jlong time, jint state,
2458 jfloat x_delta, jfloat y_delta) 2509 jfloat x_delta, jfloat y_delta)
2459{ 2510{
2511 JNI_STACK_ALIGNMENT_PROLOGUE;
2512
2460 union android_event event; 2513 union android_event event;
2461 2514
2462 event.wheel.type = ANDROID_WHEEL; 2515 event.wheel.type = ANDROID_WHEEL;
@@ -2477,6 +2530,8 @@ JNIEXPORT jlong JNICALL
2477NATIVE_NAME (sendIconified) (JNIEnv *env, jobject object, 2530NATIVE_NAME (sendIconified) (JNIEnv *env, jobject object,
2478 jshort window) 2531 jshort window)
2479{ 2532{
2533 JNI_STACK_ALIGNMENT_PROLOGUE;
2534
2480 union android_event event; 2535 union android_event event;
2481 2536
2482 event.iconified.type = ANDROID_ICONIFIED; 2537 event.iconified.type = ANDROID_ICONIFIED;
@@ -2491,6 +2546,8 @@ JNIEXPORT jlong JNICALL
2491NATIVE_NAME (sendDeiconified) (JNIEnv *env, jobject object, 2546NATIVE_NAME (sendDeiconified) (JNIEnv *env, jobject object,
2492 jshort window) 2547 jshort window)
2493{ 2548{
2549 JNI_STACK_ALIGNMENT_PROLOGUE;
2550
2494 union android_event event; 2551 union android_event event;
2495 2552
2496 event.iconified.type = ANDROID_DEICONIFIED; 2553 event.iconified.type = ANDROID_DEICONIFIED;
@@ -2505,6 +2562,8 @@ JNIEXPORT jlong JNICALL
2505NATIVE_NAME (sendContextMenu) (JNIEnv *env, jobject object, 2562NATIVE_NAME (sendContextMenu) (JNIEnv *env, jobject object,
2506 jshort window, jint menu_event_id) 2563 jshort window, jint menu_event_id)
2507{ 2564{
2565 JNI_STACK_ALIGNMENT_PROLOGUE;
2566
2508 union android_event event; 2567 union android_event event;
2509 2568
2510 event.menu.type = ANDROID_CONTEXT_MENU; 2569 event.menu.type = ANDROID_CONTEXT_MENU;
@@ -2521,6 +2580,8 @@ NATIVE_NAME (sendExpose) (JNIEnv *env, jobject object,
2521 jshort window, jint x, jint y, 2580 jshort window, jint x, jint y,
2522 jint width, jint height) 2581 jint width, jint height)
2523{ 2582{
2583 JNI_STACK_ALIGNMENT_PROLOGUE;
2584
2524 union android_event event; 2585 union android_event event;
2525 2586
2526 event.xexpose.type = ANDROID_EXPOSE; 2587 event.xexpose.type = ANDROID_EXPOSE;
@@ -2543,12 +2604,16 @@ static void android_end_query (void);
2543JNIEXPORT void JNICALL 2604JNIEXPORT void JNICALL
2544NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object) 2605NATIVE_NAME (beginSynchronous) (JNIEnv *env, jobject object)
2545{ 2606{
2607 JNI_STACK_ALIGNMENT_PROLOGUE;
2608
2546 android_begin_query (); 2609 android_begin_query ();
2547} 2610}
2548 2611
2549JNIEXPORT void JNICALL 2612JNIEXPORT void JNICALL
2550NATIVE_NAME (endSynchronous) (JNIEnv *env, jobject object) 2613NATIVE_NAME (endSynchronous) (JNIEnv *env, jobject object)
2551{ 2614{
2615 JNI_STACK_ALIGNMENT_PROLOGUE;
2616
2552 android_end_query (); 2617 android_end_query ();
2553} 2618}
2554 2619
diff --git a/src/android.h b/src/android.h
index 01076c36b70..65389f84e6a 100644
--- a/src/android.h
+++ b/src/android.h
@@ -166,5 +166,21 @@ extern JNIEnv *android_java_env;
166 166
167#define NATIVE_NAME(name) Java_org_gnu_emacs_EmacsNative_##name 167#define NATIVE_NAME(name) Java_org_gnu_emacs_EmacsNative_##name
168 168
169/* Prologue which must be inserted before each JNI function.
170 See initEmacs for why. */
171
172#if defined __i386__
173extern void *unused_pointer;
174
175#define JNI_STACK_ALIGNMENT_PROLOGUE \
176 __attribute__ ((aligned (32))) char stack_align_buffer[32]; \
177 \
178 /* Trick GCC into not optimizing this variable away. */ \
179 unused_pointer = stack_align_buffer;
180
181#else /* !__i386__ */
182#define JNI_STACK_ALIGNMENT_PROLOGUE ((void) 0)
183#endif /* __i386__ */
184
169#endif 185#endif
170#endif /* _ANDROID_H_ */ 186#endif /* _ANDROID_H_ */
diff --git a/src/androidterm.c b/src/androidterm.c
index 07d9f90a356..42ce03d4e7d 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -4390,6 +4390,8 @@ android_copy_java_string (JNIEnv *env, jstring string, size_t *length)
4390JNIEXPORT void JNICALL 4390JNIEXPORT void JNICALL
4391NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window) 4391NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window)
4392{ 4392{
4393 JNI_STACK_ALIGNMENT_PROLOGUE;
4394
4393 union android_event event; 4395 union android_event event;
4394 4396
4395 event.ime.type = ANDROID_INPUT_METHOD; 4397 event.ime.type = ANDROID_INPUT_METHOD;
@@ -4409,6 +4411,8 @@ NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window)
4409JNIEXPORT void JNICALL 4411JNIEXPORT void JNICALL
4410NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window) 4412NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window)
4411{ 4413{
4414 JNI_STACK_ALIGNMENT_PROLOGUE;
4415
4412 union android_event event; 4416 union android_event event;
4413 4417
4414 event.ime.type = ANDROID_INPUT_METHOD; 4418 event.ime.type = ANDROID_INPUT_METHOD;
@@ -4429,6 +4433,8 @@ JNIEXPORT void JNICALL
4429NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window, 4433NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window,
4430 jstring completion_text, jint position) 4434 jstring completion_text, jint position)
4431{ 4435{
4436 JNI_STACK_ALIGNMENT_PROLOGUE;
4437
4432 union android_event event; 4438 union android_event event;
4433 unsigned short *text; 4439 unsigned short *text;
4434 size_t length; 4440 size_t length;
@@ -4461,6 +4467,8 @@ JNIEXPORT void JNICALL
4461NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window, 4467NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window,
4462 jstring commit_text, jint position) 4468 jstring commit_text, jint position)
4463{ 4469{
4470 JNI_STACK_ALIGNMENT_PROLOGUE;
4471
4464 union android_event event; 4472 union android_event event;
4465 unsigned short *text; 4473 unsigned short *text;
4466 size_t length; 4474 size_t length;
@@ -4494,6 +4502,8 @@ NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object,
4494 jshort window, jint left_length, 4502 jshort window, jint left_length,
4495 jint right_length) 4503 jint right_length)
4496{ 4504{
4505 JNI_STACK_ALIGNMENT_PROLOGUE;
4506
4497 union android_event event; 4507 union android_event event;
4498 4508
4499 event.ime.type = ANDROID_INPUT_METHOD; 4509 event.ime.type = ANDROID_INPUT_METHOD;
@@ -4514,6 +4524,8 @@ JNIEXPORT void JNICALL
4514NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object, 4524NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object,
4515 jshort window) 4525 jshort window)
4516{ 4526{
4527 JNI_STACK_ALIGNMENT_PROLOGUE;
4528
4517 union android_event event; 4529 union android_event event;
4518 4530
4519 event.ime.type = ANDROID_INPUT_METHOD; 4531 event.ime.type = ANDROID_INPUT_METHOD;
@@ -4667,6 +4679,8 @@ JNIEXPORT jstring JNICALL
4667NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window, 4679NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window,
4668 jint length, jint flags) 4680 jint length, jint flags)
4669{ 4681{
4682 JNI_STACK_ALIGNMENT_PROLOGUE;
4683
4670 struct android_conversion_query_context context; 4684 struct android_conversion_query_context context;
4671 jstring string; 4685 jstring string;
4672 4686
@@ -4709,6 +4723,8 @@ JNIEXPORT jstring JNICALL
4709NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window, 4723NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window,
4710 jint length, jint flags) 4724 jint length, jint flags)
4711{ 4725{
4726 JNI_STACK_ALIGNMENT_PROLOGUE;
4727
4712 struct android_conversion_query_context context; 4728 struct android_conversion_query_context context;
4713 jstring string; 4729 jstring string;
4714 4730
@@ -4752,6 +4768,8 @@ NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jshort window,
4752 jstring composing_text, 4768 jstring composing_text,
4753 jint new_cursor_position) 4769 jint new_cursor_position)
4754{ 4770{
4771 JNI_STACK_ALIGNMENT_PROLOGUE;
4772
4755 union android_event event; 4773 union android_event event;
4756 unsigned short *text; 4774 unsigned short *text;
4757 size_t length; 4775 size_t length;
@@ -4784,6 +4802,8 @@ JNIEXPORT void JNICALL
4784NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window, 4802NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window,
4785 jint start, jint end) 4803 jint start, jint end)
4786{ 4804{
4805 JNI_STACK_ALIGNMENT_PROLOGUE;
4806
4787 union android_event event; 4807 union android_event event;
4788 4808
4789 event.ime.type = ANDROID_INPUT_METHOD; 4809 event.ime.type = ANDROID_INPUT_METHOD;
@@ -4804,6 +4824,8 @@ JNIEXPORT void JNICALL
4804NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window, 4824NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window,
4805 jint start, jint end) 4825 jint start, jint end)
4806{ 4826{
4827 JNI_STACK_ALIGNMENT_PROLOGUE;
4828
4807 union android_event event; 4829 union android_event event;
4808 4830
4809 /* While IMEs want access to the entire selection, Emacs only 4831 /* While IMEs want access to the entire selection, Emacs only
@@ -4875,6 +4897,8 @@ android_get_selection (void *data)
4875JNIEXPORT jintArray JNICALL 4897JNIEXPORT jintArray JNICALL
4876NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window) 4898NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window)
4877{ 4899{
4900 JNI_STACK_ALIGNMENT_PROLOGUE;
4901
4878 struct android_get_selection_context context; 4902 struct android_get_selection_context context;
4879 jintArray array; 4903 jintArray array;
4880 jint contents[2]; 4904 jint contents[2];
@@ -4911,6 +4935,8 @@ JNIEXPORT void JNICALL
4911NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object, 4935NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object,
4912 jshort window, int action) 4936 jshort window, int action)
4913{ 4937{
4938 JNI_STACK_ALIGNMENT_PROLOGUE;
4939
4914 union android_event event; 4940 union android_event event;
4915 4941
4916 /* Undocumented behavior: performEditorAction is apparently expected 4942 /* Undocumented behavior: performEditorAction is apparently expected
@@ -5004,6 +5030,8 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
5004 jshort window, jobject request, 5030 jshort window, jobject request,
5005 jint flags) 5031 jint flags)
5006{ 5032{
5033 JNI_STACK_ALIGNMENT_PROLOGUE;
5034
5007 struct android_get_extracted_text_context context; 5035 struct android_get_extracted_text_context context;
5008 static struct android_extracted_text_request_class request_class; 5036 static struct android_extracted_text_request_class request_class;
5009 static struct android_extracted_text_class text_class; 5037 static struct android_extracted_text_class text_class;
@@ -5106,6 +5134,8 @@ JNIEXPORT jstring JNICALL
5106NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object, 5134NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object,
5107 jshort window) 5135 jshort window)
5108{ 5136{
5137 JNI_STACK_ALIGNMENT_PROLOGUE;
5138
5109 struct android_get_extracted_text_context context; 5139 struct android_get_extracted_text_context context;
5110 jstring string; 5140 jstring string;
5111 5141