From: Po Lu Date: Thu, 2 Feb 2023 02:18:18 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=096432858795fe62dfcbd035382d016eae2b2c93;p=emacs.git Update Android port * src/android.c (android_get_current_api_level): New function. * src/android.h: Export it. * src/sfntfont-android.c (init_sfntfont_android): Make device API level detection always work. --- diff --git a/src/android.c b/src/android.c index 598d002fb1c..57a95bcd4f9 100644 --- a/src/android.c +++ b/src/android.c @@ -5006,6 +5006,19 @@ android_restart_emacs (void) exit (0); } +/* Return a number from 1 to 33 describing the version of Android + Emacs is running on. + + This is different from __ANDROID_API__, as that describes the + minimum version of Android this build of Emacs will run on, and in + turn which APIs Emacs can safely use. */ + +int +android_get_current_api_level (void) +{ + return android_api_level; +} + #else /* ANDROID_STUBIFY */ diff --git a/src/android.h b/src/android.h index 9b2eca807cb..da5c4379800 100644 --- a/src/android.h +++ b/src/android.h @@ -90,6 +90,7 @@ extern void android_wait_event (void); extern void android_toggle_on_screen_keyboard (android_window, bool); extern void android_window_updated (android_window, unsigned long); extern _Noreturn void android_restart_emacs (void); +extern int android_get_current_api_level (void); diff --git a/src/sfntfont-android.c b/src/sfntfont-android.c index ab90a2e4ecd..d8f598fd330 100644 --- a/src/sfntfont-android.c +++ b/src/sfntfont-android.c @@ -734,8 +734,7 @@ init_sfntfont_android (void) /* Make sure to pick the right Sans Serif font depending on what version of Android the device is running. */ -#if HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL - if (android_get_device_api_level () >= 15) + if (android_get_current_api_level () >= 15) Vsfnt_default_family_alist = list3 (Fcons (build_string ("Monospace"), build_string ("Droid Sans Mono")), @@ -746,7 +745,6 @@ init_sfntfont_android (void) Fcons (build_string ("Sans Serif"), build_string ("Roboto"))); else -#endif Vsfnt_default_family_alist = list3 (Fcons (build_string ("Monospace"), build_string ("Droid Sans Mono")),