48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
|
diff -uNr boinc-client_release-7.18-7.18.1/client/hostinfo_network.cpp boinc-client_release-7.18-7.18.1.mod/client/hostinfo_network.cpp
|
||
|
--- boinc-client_release-7.18-7.18.1/client/hostinfo_network.cpp 2021-08-03 23:52:19.000000000 +0800
|
||
|
+++ boinc-client_release-7.18-7.18.1.mod/client/hostinfo_network.cpp 2021-12-29 18:50:29.025462827 +0800
|
||
|
@@ -44,6 +44,10 @@
|
||
|
#include <Carbon/Carbon.h>
|
||
|
#endif
|
||
|
|
||
|
+#ifdef __ANDROID__
|
||
|
+#include <sys/system_properties.h> // PROP_VALUE_MAX
|
||
|
+#endif
|
||
|
+
|
||
|
#include "error_numbers.h"
|
||
|
#include "file_names.h"
|
||
|
#include "mac_address.h"
|
||
|
@@ -58,17 +62,29 @@
|
||
|
#include "hostinfo.h"
|
||
|
|
||
|
// get domain name and IP address of this host
|
||
|
-// Android: if domain_name is empty, set it to android_xxxxxxxx
|
||
|
+// Android: if domain_name is empty, set it to "brand model xxxxxxxx"
|
||
|
+// else fallback to android_xxxxxxxx
|
||
|
//
|
||
|
int HOST_INFO::get_local_network_info() {
|
||
|
safe_strcpy(ip_addr, "");
|
||
|
|
||
|
-#ifdef ANDROID
|
||
|
+#ifdef __ANDROID__
|
||
|
if (strlen(domain_name) && strcmp(domain_name, "localhost")) return 0;
|
||
|
+ char android_brand[PROP_VALUE_MAX];
|
||
|
+ char android_model[PROP_VALUE_MAX];
|
||
|
char buf[256];
|
||
|
make_random_string("", buf);
|
||
|
buf[8] = 0;
|
||
|
- snprintf(domain_name, sizeof(domain_name), "android_%s", buf);
|
||
|
+ __system_property_get("ro.product.brand", android_brand);
|
||
|
+ __system_property_get("ro.product.model", android_model);
|
||
|
+ if (strlen(android_brand) && strlen(android_model)) {
|
||
|
+ snprintf(domain_name, sizeof(domain_name), "%s %s %s", android_brand, android_model, buf);
|
||
|
+ } else {
|
||
|
+ snprintf(domain_name, sizeof(domain_name), "android_%s", buf);
|
||
|
+ }
|
||
|
+ if (!cc_config.device_name.empty()) {
|
||
|
+ safe_strcpy(domain_name, cc_config.device_name.c_str());
|
||
|
+ }
|
||
|
return 0;
|
||
|
#endif
|
||
|
|