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

Commit f84d9cab authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix the logic of parsing profilebootclasspath flags."

parents 66e5f1da b3c55fcf
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define LOG_NDEBUG 1

#include <android-base/macros.h>
#include <android-base/parsebool.h>
#include <android-base/properties.h>
#include <android/graphics/jni_runtime.h>
#include <android_runtime/AndroidRuntime.h>
@@ -52,6 +53,8 @@
using namespace android;
using android::base::GetBoolProperty;
using android::base::GetProperty;
using android::base::ParseBool;
using android::base::ParseBoolResult;

extern int register_android_os_Binder(JNIEnv* env);
extern int register_android_os_Process(JNIEnv* env);
@@ -701,17 +704,24 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p

    // Read if we are using the profile configuration, do this at the start since the last ART args
    // take precedence.
    property_get("dalvik.vm.profilebootclasspath", propBuf, "");
    std::string profile_boot_class_path_flag = propBuf;
    // Empty means the property is unset and we should default to the phenotype property.
    // The possible values are {"true", "false", ""}
    if (profile_boot_class_path_flag.empty()) {
        profile_boot_class_path_flag = server_configurable_flags::GetServerConfigurableFlag(
                RUNTIME_NATIVE_BOOT_NAMESPACE,
    std::string profile_boot_class_path_flag =
            server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE,
                                                                 PROFILE_BOOT_CLASS_PATH,
                                                                 /*default_value=*/"");
    bool profile_boot_class_path;
    switch (ParseBool(profile_boot_class_path_flag)) {
        case ParseBoolResult::kError:
            // Default to the system property.
            profile_boot_class_path =
                    GetBoolProperty("dalvik.vm.profilebootclasspath", /*default_value=*/false);
            break;
        case ParseBoolResult::kTrue:
            profile_boot_class_path = true;
            break;
        case ParseBoolResult::kFalse:
            profile_boot_class_path = false;
            break;
    }
    const bool profile_boot_class_path = (profile_boot_class_path_flag == "true");
    if (profile_boot_class_path) {
        addOption("-Xcompiler-option");
        addOption("--count-hotness-in-compiled-code");