system/core
Revision | fc1024f7fd19bf73f8f04ba52b1fda49cf4b4cd7 (tree) |
---|---|
Time | 2019-12-17 14:24:56 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
init: set ro.boot.hardware to product name
We don't set androidboot.hardware cmdline anymore.
@@ -46,6 +46,7 @@ | ||
46 | 46 | #include <processgroup/processgroup.h> |
47 | 47 | #include <processgroup/setup.h> |
48 | 48 | #include <selinux/android.h> |
49 | +#include <sys/system_properties.h> | |
49 | 50 | |
50 | 51 | #ifndef RECOVERY |
51 | 52 | #include <binder/ProcessState.h> |
@@ -404,9 +405,21 @@ static void export_kernel_boot_props() { | ||
404 | 405 | { "ro.boot.mode", "ro.bootmode", "unknown", }, |
405 | 406 | { "ro.boot.baseband", "ro.baseband", "unknown", }, |
406 | 407 | { "ro.boot.bootloader", "ro.bootloader", "unknown", }, |
407 | - { "ro.boot.hardware", "ro.hardware", "unknown", }, | |
408 | + { "ro.boot.hardware", "ro.hardware", UNSET, }, | |
408 | 409 | { "ro.boot.revision", "ro.revision", "0", }, |
409 | 410 | }; |
411 | + const char *hardware = prop_map[4].src_prop; | |
412 | + if (GetProperty(hardware, UNSET).empty()) { | |
413 | + char line[PROP_NAME_MAX + PROP_VALUE_MAX + 2], value[PROP_VALUE_MAX]; | |
414 | + auto f = fopen("/system/build.prop", "r"); | |
415 | + while (fgets(line, sizeof(line), f) == line) { | |
416 | + if (sscanf(line, "ro.product.system.name=%s", value) > 0) { | |
417 | + property_set(hardware, value); | |
418 | + break; | |
419 | + } | |
420 | + } | |
421 | + fclose(f); | |
422 | + } | |
410 | 423 | for (const auto& prop : prop_map) { |
411 | 424 | std::string value = GetProperty(prop.src_prop, prop.default_value); |
412 | 425 | if (value != UNSET) |