Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac6959e7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Populate more emulator properties to `ro.boot.`" am: 5d5e16db am:...

Merge "Populate more emulator properties to `ro.boot.`" am: 5d5e16db am: 669af0aa am: 68301b2d am: 752c3c7f

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624567

Change-Id: I56f20ff82c8f4504ca301a5f2aee24205c8d91ef
parents 0fd14122 752c3c7f
Loading
Loading
Loading
Loading
+27 −2
Original line number Diff line number Diff line
@@ -1165,12 +1165,37 @@ 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() {
    ImportKernelCmdline([&](const std::string& key, const std::string& 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."sv)) {
            InitPropertySet("ro.kernel." + key, 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.