diff options
author | Chris Morin | 2018-06-21 20:42:22 -0500 |
---|---|---|
committer | Chris Morin | 2018-06-21 20:54:28 -0500 |
commit | 39d124b92c058eeb041a404839c3a017b138a0fe (patch) | |
tree | 4ec031461c6010e541cd400075c098fc82baadad /init | |
parent | d41a1f9add9c1feb4aa8f38ad9850f39d715d8bf (diff) | |
download | platform-system-core-39d124b92c058eeb041a404839c3a017b138a0fe.tar.gz platform-system-core-39d124b92c058eeb041a404839c3a017b138a0fe.tar.xz platform-system-core-39d124b92c058eeb041a404839c3a017b138a0fe.zip |
init: Don't set ro.serialno when androidboot.serialno is not set
This functionality is useful for improving boottimes on the ARC++
project. Without this change, ro.serialno would be set to the empty
string when androidboot.serialno was unset in the kernel commandline.
Bug: 62039211
Test: boot with androidboot.serialno unset and ensure ro.serialno is
unset
Change-Id: Iaee339dfa3f0c871e5e9c1fc0534347f2b3e8a07
Diffstat (limited to 'init')
-rw-r--r-- | init/init.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/init/init.cpp b/init/init.cpp index b494bcc09..77c4fc49e 100644 --- a/init/init.cpp +++ b/init/init.cpp | |||
@@ -352,21 +352,23 @@ static void export_oem_lock_status() { | |||
352 | } | 352 | } |
353 | 353 | ||
354 | static void export_kernel_boot_props() { | 354 | static void export_kernel_boot_props() { |
355 | constexpr const char* UNSET = ""; | ||
355 | struct { | 356 | struct { |
356 | const char *src_prop; | 357 | const char *src_prop; |
357 | const char *dst_prop; | 358 | const char *dst_prop; |
358 | const char *default_value; | 359 | const char *default_value; |
359 | } prop_map[] = { | 360 | } prop_map[] = { |
360 | { "ro.boot.serialno", "ro.serialno", "", }, | 361 | { "ro.boot.serialno", "ro.serialno", UNSET, }, |
361 | { "ro.boot.mode", "ro.bootmode", "unknown", }, | 362 | { "ro.boot.mode", "ro.bootmode", "unknown", }, |
362 | { "ro.boot.baseband", "ro.baseband", "unknown", }, | 363 | { "ro.boot.baseband", "ro.baseband", "unknown", }, |
363 | { "ro.boot.bootloader", "ro.bootloader", "unknown", }, | 364 | { "ro.boot.bootloader", "ro.bootloader", "unknown", }, |
364 | { "ro.boot.hardware", "ro.hardware", "unknown", }, | 365 | { "ro.boot.hardware", "ro.hardware", "unknown", }, |
365 | { "ro.boot.revision", "ro.revision", "0", }, | 366 | { "ro.boot.revision", "ro.revision", "0", }, |
366 | }; | 367 | }; |
367 | for (size_t i = 0; i < arraysize(prop_map); i++) { | 368 | for (const auto& prop : prop_map) { |
368 | std::string value = GetProperty(prop_map[i].src_prop, ""); | 369 | std::string value = GetProperty(prop.src_prop, prop.default_value); |
369 | property_set(prop_map[i].dst_prop, (!value.empty()) ? value : prop_map[i].default_value); | 370 | if (value != UNSET) |
371 | property_set(prop.dst_prop, value); | ||
370 | } | 372 | } |
371 | } | 373 | } |
372 | 374 | ||