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

Commit a48858e4 authored by Eric Biggers's avatar Eric Biggers
Browse files

run_dex2oat: remove FDE-specific code

run_dex2oat had special behavior when the device is running a minimal
framework for unlocking Full Disk Encryption (FDE), as indicated by the
vold.decrypt system property.  As FDE support was removed in Android 13
in favor of File Based Encryption (FBE), this code is no longer needed.

Bug: 208476087
Test: atest run_dex2oat_test
Change-Id: I2d7be81b0f4a9fc4378b01627708f53ea04455f2
parent b5c136e7
Loading
Loading
Loading
Loading
+7 −30
Original line number Diff line number Diff line
@@ -208,37 +208,14 @@ void RunDex2Oat::PrepareCompilerConfigFlags(const UniqueFile& input_vdex,
    }

    // Compute compiler filter.
    {
        std::string dex2oat_compiler_filter_arg;
        {
            // If we are booting without the real /data, don't spend time compiling.
            std::string vold_decrypt = GetProperty("vold.decrypt", "");
            bool skip_compilation = vold_decrypt == "trigger_restart_min_framework" ||
                    vold_decrypt == "1";

            bool have_dex2oat_relocation_skip_flag = false;
            if (skip_compilation) {
                dex2oat_compiler_filter_arg = "--compiler-filter=extract";
                have_dex2oat_relocation_skip_flag = true;
            } else if (compiler_filter != nullptr) {
                dex2oat_compiler_filter_arg = StringPrintf("--compiler-filter=%s",
                                                           compiler_filter);
            }
            if (have_dex2oat_relocation_skip_flag) {
                AddRuntimeArg("-Xnorelocate");
            }
        }

        if (dex2oat_compiler_filter_arg.empty()) {
            dex2oat_compiler_filter_arg = MapPropertyToArg("dalvik.vm.dex2oat-filter",
                                                           "--compiler-filter=%s");
    if (compiler_filter != nullptr) {
        AddArg(StringPrintf("--compiler-filter=%s", compiler_filter));
    } else {
        AddArg(MapPropertyToArg("dalvik.vm.dex2oat-filter", "--compiler-filter=%s"));
    }
        AddArg(dex2oat_compiler_filter_arg);

    if (compilation_reason != nullptr) {
        AddArg(std::string("--compilation-reason=") + compilation_reason);
    }
    }

    AddArg(MapPropertyToArg("dalvik.vm.dex2oat-max-image-block-size",
                            "--max-image-block-size=%s"));
+0 −18
Original line number Diff line number Diff line
@@ -441,24 +441,6 @@ TEST_F(RunDex2OatTest, Runtime) {
    VerifyExpectedFlags();
}

TEST_F(RunDex2OatTest, SkipRelocationInMinFramework) {
    setSystemProperty("vold.decrypt", "trigger_restart_min_framework");
    CallRunDex2Oat(RunDex2OatArgs::MakeDefaultTestArgs());

    SetExpectedFlagUsed("--compiler-filter", "=extract");
    SetExpectedFlagUsed("-Xnorelocate", "");
    VerifyExpectedFlags();
}

TEST_F(RunDex2OatTest, SkipRelocationIfDecryptedWithFullDiskEncryption) {
    setSystemProperty("vold.decrypt", "1");
    CallRunDex2Oat(RunDex2OatArgs::MakeDefaultTestArgs());

    SetExpectedFlagUsed("--compiler-filter", "=extract");
    SetExpectedFlagUsed("-Xnorelocate", "");
    VerifyExpectedFlags();
}

TEST_F(RunDex2OatTest, DalvikVmDex2oatFilter) {
    setSystemProperty("dalvik.vm.dex2oat-filter", "speed");
    auto args = RunDex2OatArgs::MakeDefaultTestArgs();