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.
This commit is contained in:
Po Lu 2023-02-02 10:18:18 +08:00
parent 5a3ce490b9
commit 0964328587
3 changed files with 15 additions and 3 deletions

View file

@ -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 */

View file

@ -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);

View file

@ -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")),