aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-02 10:18:18 +0800
committerPo Lu2023-02-02 10:18:18 +0800
commit096432858795fe62dfcbd035382d016eae2b2c93 (patch)
tree963148032e9aa2dc10558d329476970600f2ab82 /src
parent5a3ce490b9a780745db1c86a40419909f87fca2e (diff)
downloademacs-096432858795fe62dfcbd035382d016eae2b2c93.tar.gz
emacs-096432858795fe62dfcbd035382d016eae2b2c93.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/android.c13
-rw-r--r--src/android.h1
-rw-r--r--src/sfntfont-android.c4
3 files changed, 15 insertions, 3 deletions
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)
5006 exit (0); 5006 exit (0);
5007} 5007}
5008 5008
5009/* Return a number from 1 to 33 describing the version of Android
5010 Emacs is running on.
5011
5012 This is different from __ANDROID_API__, as that describes the
5013 minimum version of Android this build of Emacs will run on, and in
5014 turn which APIs Emacs can safely use. */
5015
5016int
5017android_get_current_api_level (void)
5018{
5019 return android_api_level;
5020}
5021
5009 5022
5010 5023
5011#else /* ANDROID_STUBIFY */ 5024#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);
90extern void android_toggle_on_screen_keyboard (android_window, bool); 90extern void android_toggle_on_screen_keyboard (android_window, bool);
91extern void android_window_updated (android_window, unsigned long); 91extern void android_window_updated (android_window, unsigned long);
92extern _Noreturn void android_restart_emacs (void); 92extern _Noreturn void android_restart_emacs (void);
93extern int android_get_current_api_level (void);
93 94
94 95
95 96
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)
734 734
735 /* Make sure to pick the right Sans Serif font depending on what 735 /* Make sure to pick the right Sans Serif font depending on what
736 version of Android the device is running. */ 736 version of Android the device is running. */
737#if HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL 737 if (android_get_current_api_level () >= 15)
738 if (android_get_device_api_level () >= 15)
739 Vsfnt_default_family_alist 738 Vsfnt_default_family_alist
740 = list3 (Fcons (build_string ("Monospace"), 739 = list3 (Fcons (build_string ("Monospace"),
741 build_string ("Droid Sans Mono")), 740 build_string ("Droid Sans Mono")),
@@ -746,7 +745,6 @@ init_sfntfont_android (void)
746 Fcons (build_string ("Sans Serif"), 745 Fcons (build_string ("Sans Serif"),
747 build_string ("Roboto"))); 746 build_string ("Roboto")));
748 else 747 else
749#endif
750 Vsfnt_default_family_alist 748 Vsfnt_default_family_alist
751 = list3 (Fcons (build_string ("Monospace"), 749 = list3 (Fcons (build_string ("Monospace"),
752 build_string ("Droid Sans Mono")), 750 build_string ("Droid Sans Mono")),