diff options
author | Scott Lobdell <slobdell@google.com> | 2021-04-07 05:35:55 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-04-07 05:35:55 +0000 |
commit | ec6cfacad7283c60a33cfefacf5031247a2f81dc (patch) | |
tree | 5b473e86fc8ab0afc2241b6ac25875b25fa354bd /init/property_service.cpp | |
parent | 79aff2b0a0653fcafaf9099ad60075f2903e8de1 (diff) | |
parent | 268fff7088f0ab311c2de902178054ce40a42243 (diff) |
Merge "Merge SP1A.210329.001" into s-keystone-qcom-dev
Diffstat (limited to 'init/property_service.cpp')
-rw-r--r-- | init/property_service.cpp | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp index 477e98b87..4c33d422d 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -44,6 +44,7 @@ #include <mutex> #include <optional> #include <queue> +#include <string_view> #include <thread> #include <vector> @@ -1265,28 +1266,55 @@ static void ProcessKernelDt() { } } +constexpr auto ANDROIDBOOT_PREFIX = "androidboot."sv; + +// emulator specific, should be removed once emulator is migrated to +// bootconfig, see b/182291166. +static std::string RemapEmulatorPropertyName(const std::string_view qemu_key) { + if (StartsWith(qemu_key, "dalvik."sv) || StartsWith(qemu_key, "opengles."sv) || + StartsWith(qemu_key, "config."sv)) { + return std::string(qemu_key); + } else if (qemu_key == "uirenderer"sv) { + return "debug.hwui.renderer"s; + } else if (qemu_key == "media.ccodec"sv) { + return "debug.stagefright.ccodec"s; + } else { + return ""s; // TBD + } +} + 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.")) { - InitPropertySet("ro.boot." + key.substr(12), value); + constexpr auto qemu_prefix = "qemu."sv; + + if (StartsWith(key, ANDROIDBOOT_PREFIX)) { + InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value); + } else if (StartsWith(key, qemu_prefix)) { + InitPropertySet("ro.kernel." + key, value); // emulator specific, deprecated + + // emulator specific, should be retired once emulator migrates to + // androidboot. + const auto new_name = + RemapEmulatorPropertyName(std::string_view(key).substr(qemu_prefix.size())); + if (!new_name.empty()) { + InitPropertySet("ro.boot." + new_name, value); + } + } else if (key == "qemu") { + // emulator specific, should be retired once emulator migrates to + // androidboot. + InitPropertySet("ro.boot." + 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() { ImportBootconfig([&](const std::string& key, const std::string& value) { - if (StartsWith(key, "androidboot.")) { - InitPropertySet("ro.boot." + key.substr(12), value); + if (StartsWith(key, ANDROIDBOOT_PREFIX)) { + InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value); + } else if (key == "hardware") { + // "hardware" in bootconfig replaces "androidboot.hardware" kernel + // cmdline parameter + InitPropertySet("ro.boot." + key, value); } }); } |