aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-07-31 14:18:12 +0800
committerPo Lu2023-07-31 14:18:12 +0800
commit9cf166db63b7383a94dc47a6a5251c0dbe1dae9b (patch)
tree1ce988f64a4f259a8f78d95844fb38976947ae7d /src
parent5a8130ab967cb296d028539d10c749ee35f62e6a (diff)
downloademacs-9cf166db63b7383a94dc47a6a5251c0dbe1dae9b.tar.gz
emacs-9cf166db63b7383a94dc47a6a5251c0dbe1dae9b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/android.c12
-rw-r--r--src/androidvfs.c14
2 files changed, 21 insertions, 5 deletions
diff --git a/src/android.c b/src/android.c
index 8c0232a51f8..f60ff5acb54 100644
--- a/src/android.c
+++ b/src/android.c
@@ -1281,7 +1281,8 @@ NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object,
1281 jfloat pixel_density_y, 1281 jfloat pixel_density_y,
1282 jfloat scaled_density, 1282 jfloat scaled_density,
1283 jobject class_path, 1283 jobject class_path,
1284 jobject emacs_service_object) 1284 jobject emacs_service_object,
1285 jint api_level)
1285{ 1286{
1286 JNI_STACK_ALIGNMENT_PROLOGUE; 1287 JNI_STACK_ALIGNMENT_PROLOGUE;
1287 1288
@@ -1289,6 +1290,10 @@ NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object,
1289 pthread_t thread; 1290 pthread_t thread;
1290 const char *java_string; 1291 const char *java_string;
1291 1292
1293 /* Set the Android API level early, as it is used by
1294 `android_vfs_init'. */
1295 android_api_level = api_level;
1296
1292 /* This function should only be called from the main thread. */ 1297 /* This function should only be called from the main thread. */
1293 1298
1294 android_pixel_density_x = pixel_density_x; 1299 android_pixel_density_x = pixel_density_x;
@@ -1771,7 +1776,7 @@ android_init_emacs_cursor (void)
1771 1776
1772JNIEXPORT void JNICALL 1777JNIEXPORT void JNICALL
1773NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv, 1778NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
1774 jobject dump_file_object, jint api_level) 1779 jobject dump_file_object)
1775{ 1780{
1776 /* android_emacs_init is not main, so GCC is not nice enough to add 1781 /* android_emacs_init is not main, so GCC is not nice enough to add
1777 the stack alignment prologue. 1782 the stack alignment prologue.
@@ -1788,9 +1793,6 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
1788 const char *c_argument; 1793 const char *c_argument;
1789 char *dump_file; 1794 char *dump_file;
1790 1795
1791 /* Set the Android API level. */
1792 android_api_level = api_level;
1793
1794 android_java_env = env; 1796 android_java_env = env;
1795 1797
1796 nelements = (*env)->GetArrayLength (env, argv); 1798 nelements = (*env)->GetArrayLength (env, argv);
diff --git a/src/androidvfs.c b/src/androidvfs.c
index 9acc8f2b139..eeef5ea5db0 100644
--- a/src/androidvfs.c
+++ b/src/androidvfs.c
@@ -5976,6 +5976,14 @@ android_saf_new_opendir (struct android_vnode *vnode)
5976/* Semaphore posted upon the completion of an SAF operation. */ 5976/* Semaphore posted upon the completion of an SAF operation. */
5977static sem_t saf_completion_sem; 5977static sem_t saf_completion_sem;
5978 5978
5979#ifdef __clang__
5980#pragma clang diagnostic push
5981#pragma clang diagnostic ignored "-Wmissing-prototypes"
5982#else /* GNUC */
5983#pragma GCC diagnostic push
5984#pragma GCC diagnostic ignored "-Wmissing-prototypes"
5985#endif /* __clang__ */
5986
5979JNIEXPORT jint JNICALL 5987JNIEXPORT jint JNICALL
5980NATIVE_NAME (safSyncAndReadInput) (JNIEnv *env, jobject object) 5988NATIVE_NAME (safSyncAndReadInput) (JNIEnv *env, jobject object)
5981{ 5989{
@@ -6010,6 +6018,12 @@ NATIVE_NAME (safPostRequest) (JNIEnv *env, jobject object)
6010 sem_post (&saf_completion_sem); 6018 sem_post (&saf_completion_sem);
6011} 6019}
6012 6020
6021#ifdef __clang__
6022#pragma clang diagnostic pop
6023#else /* GNUC */
6024#pragma GCC diagnostic pop
6025#endif /* __clang__ */
6026
6013 6027
6014 6028
6015/* Root vnode. This vnode represents the root inode, and is a regular 6029/* Root vnode. This vnode represents the root inode, and is a regular