termux-packages/packages/boinc/client-hostinfo_unix.cpp.patch

49 lines
1.7 KiB
Diff

diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
--- boinc/client/hostinfo_unix.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/hostinfo_unix.cpp 2022-09-11 21:07:05.211844109 +0800
@@ -169,6 +169,10 @@
#include <OS.h>
#endif
+#ifdef __ANDROID__
+#include <sys/system_properties.h> // PROP_VALUE_MAX
+#endif
+
// Some OS define _SC_PAGE_SIZE instead of _SC_PAGESIZE
#if defined(_SC_PAGE_SIZE) && !defined(_SC_PAGESIZE)
#define _SC_PAGESIZE _SC_PAGE_SIZE
@@ -1536,12 +1540,21 @@
#if HAVE_SYS_UTSNAME_H
struct utsname u;
uname(&u);
-#ifdef ANDROID
+#ifdef __ANDROID__
safe_strcpy(os_name, "Android");
#else
safe_strcpy(os_name, u.sysname);
-#endif //ANDROID
-#if defined(__EMX__) // OS2: version is in u.version
+#endif
+#ifdef __ANDROID__
+ // remove the need of query Android version through Java API
+ // which then process in client/gui_rpc_server_ops.cpp, handle_set_host_info()
+ char android_version[PROP_VALUE_MAX];
+ __system_property_get("ro.build.version.release", android_version);
+#ifdef __TERMUX__
+ if (strlen(android_version) == 0) { safe_strcpy(android_version, TERMUX_PKG_ANDROID_VERSION); }
+#endif
+ snprintf(os_version, sizeof(os_version), "%s (Android %s)", u.release, android_version);
+#elif defined(__EMX__) // OS2: version is in u.version
safe_strcpy(os_version, u.version);
#elif defined(__HAIKU__)
snprintf(os_version, sizeof(os_version), "%s, %s", u.release, u.version);
@@ -1698,7 +1711,7 @@
return false;
}
} tty_patterns[] = {
-#if defined(LINUX_LIKE_SYSTEM) and !defined(ANDROID)
+#if defined(LINUX_LIKE_SYSTEM) and !defined(__ANDROID__)
{ "/dev", "tty",
{"ttyS", "ttyACM"},
},