From 1a705d49431fd649e0218d0af8680ccbb7fd4b9e Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Tue, 9 Mar 2021 18:19:23 -0800 Subject: [PATCH] Populate only emulator specific properties into `ro.kernel.` `ro.kernel.` is an emulator specific prefix. Bug: 182291166 Test: presubmit Signed-off-by: Roman Kiryanov Change-Id: Ie4a19127f05f3074ccb02bd055711e9b70702ba6 --- init/property_service.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/init/property_service.cpp b/init/property_service.cpp index 7b7e9194c..ad448c82e 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -1166,21 +1166,13 @@ static void ProcessKernelDt() { constexpr auto ANDROIDBOOT_PREFIX = "androidboot."sv; static void ProcessKernelCmdline() { - bool for_emulator = false; ImportKernelCmdline([&](const std::string& key, const std::string& value) { - if (key == "qemu") { - for_emulator = true; - } else if (StartsWith(key, ANDROIDBOOT_PREFIX)) { + if (StartsWith(key, ANDROIDBOOT_PREFIX)) { InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value); + } else if (StartsWith(key, "qemu."sv) || (key == "qemu")) { + InitPropertySet("ro.kernel." + key, value); } }); - - if (for_emulator) { - ImportKernelCmdline([&](const std::string& key, const std::string& value) { - // In the emulator, export any kernel option with the "ro.kernel." prefix. - InitPropertySet("ro.kernel." + key, value); - }); - } } static void ProcessBootconfig() {