[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 9d1285883c7 1/2: Include more information in Android bug
From: |
Po Lu |
Subject: |
feature/android 9d1285883c7 1/2: Include more information in Android bug reports |
Date: |
Fri, 17 Mar 2023 09:40:15 -0400 (EDT) |
branch: feature/android
commit 9d1285883c7318391e4bc1d50697b02b28ecc89f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Include more information in Android bug reports
* src/androidfns.c (Fx_server_vendor, Fx_server_version): New
functions.
(syms_of_androidfns): Define new functions.
* src/androidterm.c (android_set_build_fingerprint)
(syms_of_androidterm): Set new variable
Vandroid_build_manufacturer.
* src/xfns.c (Fx_server_vendor, Fx_server_version): Update doc
strings.
---
src/androidfns.c | 28 ++++++++++++++++++++++++++++
src/androidterm.c | 41 ++++++++++++++++++++++++++++++++++++++++-
src/xfns.c | 5 ++++-
3 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/src/androidfns.c b/src/androidfns.c
index e1d423ab3eb..3367ebdf755 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -1234,6 +1234,32 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells,
Sx_display_color_cells,
return make_fixnum (1 << nr_planes);
}
+DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
+ doc: /* SKIP: real doc in xfns.c. */)
+ (Lisp_Object terminal)
+{
+#ifdef ANDROID_STUBIFY
+ error ("Android cross-compilation stub called!");
+ return Qnil;
+#else
+ check_android_display_info (terminal);
+ return Vandroid_build_manufacturer;
+#endif
+}
+
+DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
+ doc: /* SKIP: real doc in xfns.c. */)
+ (Lisp_Object terminal)
+{
+#ifdef ANDROID_STUBIFY
+ error ("Android cross-compilation stub called!");
+ return Qnil;
+#else
+ check_android_display_info (terminal);
+ return list3i (android_get_current_api_level (), 0, 0);
+#endif
+}
+
DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens,
0, 1, 0, doc: /* SKIP: real doc in xfns.c. */)
(Lisp_Object terminal)
@@ -3114,6 +3140,8 @@ using the volume down button. */);
defsubr (&Sx_hide_tip);
defsubr (&Sandroid_detect_mouse);
defsubr (&Sandroid_toggle_on_screen_keyboard);
+ defsubr (&Sx_server_vendor);
+ defsubr (&Sx_server_version);
#ifndef ANDROID_STUBIFY
defsubr (&Sandroid_query_battery);
diff --git a/src/androidterm.c b/src/androidterm.c
index 0110c4b6dd8..1cf9bc4afde 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -5786,7 +5786,8 @@ android_term_init (void)
-/* Set Vandroid_build_fingerprint to a reasonable value. */
+/* Set Vandroid_build_fingerprint to a reasonable value, and also
+ Vandroid_build_manufacturer. */
static void
android_set_build_fingerprint (void)
@@ -5847,6 +5848,39 @@ android_set_build_fingerprint (void)
Vandroid_build_fingerprint = build_string_from_utf8 (data);
(*android_java_env)->ReleaseStringUTFChars (android_java_env,
string, data);
+
+ /* Now obtain Build.MANUFACTURER. */
+
+ ANDROID_DELETE_LOCAL_REF (string);
+ string = NULL;
+
+ field = (*android_java_env)->GetStaticFieldID (android_java_env,
+ class,
+ "MANUFACTURER",
+ "Ljava/lang/String;");
+ (*android_java_env)->ExceptionClear (android_java_env);
+
+ if (!field)
+ goto fail;
+
+ string
+ = (*android_java_env)->GetStaticObjectField (android_java_env,
+ class, field);
+ (*android_java_env)->ExceptionClear (android_java_env);
+
+ if (!string)
+ goto fail;
+
+ data = (*android_java_env)->GetStringUTFChars (android_java_env,
+ string, NULL);
+ (*android_java_env)->ExceptionClear (android_java_env);
+
+ if (!data)
+ goto fail;
+
+ Vandroid_build_manufacturer = build_string_from_utf8 (data);
+ (*android_java_env)->ReleaseStringUTFChars (android_java_env,
+ string, data);
}
if (string)
@@ -5861,6 +5895,7 @@ android_set_build_fingerprint (void)
ANDROID_DELETE_LOCAL_REF (class);
Vandroid_build_fingerprint = Qnil;
+ Vandroid_build_manufacturer = Qnil;
#endif
}
@@ -5899,6 +5934,10 @@ This is a string that uniquely identifies the version of
Android
Emacs is running on. */);
Vandroid_build_fingerprint = Qnil;
+ DEFVAR_LISP ("android-build-manufacturer", Vandroid_build_manufacturer,
+ doc: /* Name of the developer of the running version of Android. */);
+ Vandroid_build_manufacturer = Qnil;
+
/* Only defined so loadup.el loads scroll-bar.el. */
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
doc: /* SKIP: real doc in xterm.c. */);
diff --git a/src/xfns.c b/src/xfns.c
index 0e4a25de04a..b7000462e84 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5673,6 +5673,8 @@ that operating systems cannot be developed and
distributed noncommercially.)
The optional argument TERMINAL specifies which display to ask about.
For GNU and Unix systems, this queries the X server software.
+For Android systems, value is the manufacturer who developed the Android
+system that is being used.
For MS Windows and Nextstep the result is hard-coded.
TERMINAL should be a terminal object, a frame or a display name (a string).
@@ -5696,7 +5698,8 @@ Protocol used on TERMINAL and the 3rd number is the
distributor-specific
release number. For MS Windows, the 3 numbers report the OS major and
minor version and build number. For Nextstep, the first 2 numbers are
hard-coded and the 3rd represents the OS version. For Haiku, all 3
-numbers are hard-coded.
+numbers are hard-coded. For Android, the first number represents the
+Android API level, and the next two numbers are all zero.
See also the function `x-server-vendor'.