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

Commit 8948a862 authored by Victor Hsieh's avatar Victor Hsieh
Browse files

installd: move check of jitzygote out of RunDex2oat

This makes it easier to extract RunDex2oat to individual file for unit
test.

Bug: 161470356
Test: atest frameworks/native/cmds/installd/
Change-Id: Iec2b4cafc7c1fc8e82b6283ab396cfb084c0584d
parent db3e5bb0
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ class RunDex2Oat : public ExecVHelper {
               bool enable_hidden_api_checks,
               bool generate_compact_dex,
               int dex_metadata_fd,
               bool use_jitzygote_image,
               const char* compilation_reason) {
        // Get the relative path to the input file.
        const char* relative_input_file_name = get_location_from_path(input_file_name);
@@ -455,12 +456,7 @@ class RunDex2Oat : public ExecVHelper {
                GetBoolProperty(kMinidebugInfoSystemProperty, kMinidebugInfoSystemPropertyDefault);

        std::string boot_image;
        std::string use_jitzygote_image =
            server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE,
                                                                 ENABLE_JITZYGOTE_IMAGE,
                                                                 /*default_value=*/ "");

        if (use_jitzygote_image == "true" || IsBootClassPathProfilingEnable()) {
        if (use_jitzygote_image) {
          boot_image = StringPrintf("--boot-image=%s", kJitZygoteImage);
        } else {
          boot_image = MapPropertyToArg("dalvik.vm.boot-image", "--boot-image=%s");
@@ -2220,6 +2216,12 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins
        }
    }

    std::string jitzygote_flag = server_configurable_flags::GetServerConfigurableFlag(
        RUNTIME_NATIVE_BOOT_NAMESPACE,
        ENABLE_JITZYGOTE_IMAGE,
        /*default_value=*/ "");
    bool use_jitzygote_image = jitzygote_flag == "true" || IsBootClassPathProfilingEnable();

    LOG(VERBOSE) << "DexInv: --- BEGIN '" << dex_path << "' ---";

    RunDex2Oat runner(input_fd.get(),
@@ -2243,6 +2245,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins
                      enable_hidden_api_checks,
                      generate_compact_dex,
                      dex_metadata_fd.get(),
                      use_jitzygote_image,
                      compilation_reason);

    pid_t pid = fork();