emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 09643285879 4/6: Update Android port


From: Po Lu
Subject: feature/android 09643285879 4/6: Update Android port
Date: Wed, 1 Feb 2023 21:31:28 -0500 (EST)

branch: feature/android
commit 096432858795fe62dfcbd035382d016eae2b2c93
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/android.c          | 13 +++++++++++++
 src/android.h          |  1 +
 src/sfntfont-android.c |  4 +---
 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)
   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")),



reply via email to

[Prev in Thread] Current Thread [Next in Thread]