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

Commit ab0a190b authored by Nicolas Geoffray's avatar Nicolas Geoffray
Browse files

Use DEX2OATBOOTCLASSPATH in installd.

Bug: 119800099
Bug: 122937705
Test: dexopt_test
Change-Id: Ie31762910a51ddb1211eed6a24456f0a70379d9c
parent d7d075fb
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -293,6 +293,14 @@ class RunDex2Oat : public ExecVHelper {
                : "dalvik.vm.boot-dex2oat-threads";
        std::string dex2oat_threads_arg = MapPropertyToArg(threads_property, "-j%s");

        std::string bootclasspath;
        char* dex2oat_bootclasspath = getenv("DEX2OATBOOTCLASSPATH");
        if (dex2oat_bootclasspath != nullptr) {
            bootclasspath = StringPrintf("-Xbootclasspath:%s", dex2oat_bootclasspath);
        }
        // If DEX2OATBOOTCLASSPATH is not in the environment, dex2oat is going to query
        // BOOTCLASSPATH.

        const std::string dex2oat_isa_features_key =
                StringPrintf("dalvik.vm.isa.%s.features", instruction_set);
        std::string instruction_set_features_arg =
@@ -440,6 +448,7 @@ class RunDex2Oat : public ExecVHelper {
        AddArg(instruction_set_features_arg);

        AddRuntimeArg(boot_image);
        AddRuntimeArg(bootclasspath);
        AddRuntimeArg(dex2oat_Xms_arg);
        AddRuntimeArg(dex2oat_Xmx_arg);

@@ -1961,11 +1970,6 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins
        /* child -- drop privileges before continuing */
        drop_capabilities(uid);

        // Clear BOOTCLASSPATH.
        // Let dex2oat use the BCP from boot image, excluding updatable BCP
        // modules for AOT to avoid app recompilation after their upgrades.
        unsetenv("BOOTCLASSPATH");

        SetDex2OatScheduling(boot_complete);
        if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) {
            PLOG(ERROR) << "flock(" << out_oat_path << ") failed";