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

Commit d656fe27 authored by David Sehr's avatar David Sehr Committed by Gerrit Code Review
Browse files

Merge "Control use of dex2oat64 by device property"

parents c7e949b7 6df89a6f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -429,8 +429,17 @@ class RunDex2Oat : public ExecVHelper {
            MapPropertyToArg("dalvik.vm.dex2oat-very-large", "--very-large-app-threshold=%s");



        // Decide whether to use dex2oat64.
        bool use_dex2oat64 = false;
        // Check whether the device even supports 64-bit ABIs.
        if (!GetProperty("ro.product.cpu.abilist64", "").empty()) {
          use_dex2oat64 = GetBoolProperty("dalvik.vm.dex2oat64.enabled", false);
        }
        const char* dex2oat_bin = select_execution_binary(
            kDex2oatPath, kDex2oatDebugPath, background_job_compile);
            (use_dex2oat64 ? kDex2oat64Path : kDex2oat32Path),
            (use_dex2oat64 ? kDex2oatDebug64Path : kDex2oatDebug32Path),
            background_job_compile);

        bool generate_minidebug_info = kEnableMinidebugInfo &&
                GetBoolProperty(kMinidebugInfoSystemProperty, kMinidebugInfoSystemPropertyDefault);
+4 −2
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@ static constexpr int DEX2OAT_FOR_FILTER = 3;

#define ANDROID_ART_APEX_BIN "/apex/com.android.art/bin"
// Location of binaries in the Android Runtime APEX.
static constexpr const char* kDex2oatPath = ANDROID_ART_APEX_BIN "/dex2oat";
static constexpr const char* kDex2oatDebugPath = ANDROID_ART_APEX_BIN "/dex2oatd";
static constexpr const char* kDex2oat32Path = ANDROID_ART_APEX_BIN "/dex2oat32";
static constexpr const char* kDex2oat64Path = ANDROID_ART_APEX_BIN "/dex2oat64";
static constexpr const char* kDex2oatDebug32Path = ANDROID_ART_APEX_BIN "/dex2oatd32";
static constexpr const char* kDex2oatDebug64Path = ANDROID_ART_APEX_BIN "/dex2oatd64";
static constexpr const char* kProfmanPath = ANDROID_ART_APEX_BIN "/profman";
static constexpr const char* kProfmanDebugPath = ANDROID_ART_APEX_BIN "/profmand";
static constexpr const char* kDexoptanalyzerPath = ANDROID_ART_APEX_BIN "/dexoptanalyzer";
+30 −0
Original line number Diff line number Diff line
@@ -749,6 +749,36 @@ TEST_F(DexoptTest, ResolveStartupConstStrings) {
    EXPECT_TRUE(found_enable);
}

TEST_F(DexoptTest, DexoptDex2oat64Enabled) {
    LOG(INFO) << "DexoptDex2oat64Enabled";
    const std::string property = "dalvik.vm.dex2oat64.enabled";
    const std::string previous_value = android::base::GetProperty(property, "");
    auto restore_property = android::base::make_scope_guard([=]() {
        android::base::SetProperty(property, previous_value);
    });
    std::string odex = GetPrimaryDexArtifact(app_oat_dir_.c_str(), apk_path_, "odex");
    // Disable the property and use dex2oat32.
    ASSERT_TRUE(android::base::SetProperty(property, "false")) << property;
    CompilePrimaryDexOk("speed-profile",
                        DEXOPT_IDLE_BACKGROUND_JOB | DEXOPT_PROFILE_GUIDED |
                                DEXOPT_GENERATE_APP_IMAGE,
                        app_oat_dir_.c_str(),
                        kTestAppGid,
                        DEX2OAT_FROM_SCRATCH,
                        /*binder_result=*/nullptr,
                        empty_dm_file_.c_str());
    // Enable the property and use dex2oat64.
    ASSERT_TRUE(android::base::SetProperty(property, "true")) << property;
    CompilePrimaryDexOk("speed-profile",
                        DEXOPT_IDLE_BACKGROUND_JOB | DEXOPT_PROFILE_GUIDED |
                                DEXOPT_GENERATE_APP_IMAGE,
                        app_oat_dir_.c_str(),
                        kTestAppGid,
                        DEX2OAT_FROM_SCRATCH,
                        /*binder_result=*/nullptr,
                        empty_dm_file_.c_str());
}

class PrimaryDexReCompilationTest : public DexoptTest {
  public:
    virtual void SetUp() {