• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Revisionfc1024f7fd19bf73f8f04ba52b1fda49cf4b4cd7 (tree)
Time2019-12-17 14:24:56
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

init: set ro.boot.hardware to product name

We don't set androidboot.hardware cmdline anymore.

Change Summary

Incremental Difference

--- a/init/init.cpp
+++ b/init/init.cpp
@@ -46,6 +46,7 @@
4646 #include <processgroup/processgroup.h>
4747 #include <processgroup/setup.h>
4848 #include <selinux/android.h>
49+#include <sys/system_properties.h>
4950
5051 #ifndef RECOVERY
5152 #include <binder/ProcessState.h>
@@ -404,9 +405,21 @@ static void export_kernel_boot_props() {
404405 { "ro.boot.mode", "ro.bootmode", "unknown", },
405406 { "ro.boot.baseband", "ro.baseband", "unknown", },
406407 { "ro.boot.bootloader", "ro.bootloader", "unknown", },
407- { "ro.boot.hardware", "ro.hardware", "unknown", },
408+ { "ro.boot.hardware", "ro.hardware", UNSET, },
408409 { "ro.boot.revision", "ro.revision", "0", },
409410 };
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+ }
410423 for (const auto& prop : prop_map) {
411424 std::string value = GetProperty(prop.src_prop, prop.default_value);
412425 if (value != UNSET)