diff options
| author | 2019-01-23 15:59:50 +0000 | |
|---|---|---|
| committer | 2019-01-23 18:15:14 +0000 | |
| commit | 67a14f6584d6108c29b923ce6a77c0ed5cf347dc (patch) | |
| tree | 1a0763d6ddada67c3e53abbc696715e46df1af1b | |
| parent | 94b41806834afe4ae281bc1ad43cc3353ddbe15e (diff) | |
Refactor paths to Android Runtime binaries in directory `cmds/installd/`.
Have `dexopt` and `otapreopt` use the same set of definitions.
Test: A/B OTA update test (asit/dexoptota/self_full).
Bug: 113373927
Bug: 120796514
Change-Id: I94e55a831c68b67cb81cfa91281b2feb0cc4b365
| -rw-r--r-- | cmds/installd/dexopt.cpp | 12 | ||||
| -rw-r--r-- | cmds/installd/dexopt.h | 10 | ||||
| -rw-r--r-- | cmds/installd/otapreopt.cpp | 2 |
3 files changed, 14 insertions, 10 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp index 2112fda362..8136535ce5 100644 --- a/cmds/installd/dexopt.cpp +++ b/cmds/installd/dexopt.cpp @@ -332,8 +332,7 @@ class RunDex2Oat : public ExecVHelper { MapPropertyToArg("dalvik.vm.dex2oat-very-large", "--very-large-app-threshold=%s"); // If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat. - const char* dex2oat_bin = "/apex/com.android.runtime/bin/dex2oat"; - constexpr const char* kDex2oatDebugPath = "/apex/com.android.runtime/bin/dex2oatd"; + const char* dex2oat_bin = kDex2oatPath; // Do not use dex2oatd for release candidates (give dex2oat more soak time). bool is_release = android::base::GetProperty("ro.build.version.codename", "") == "REL"; if (is_debug_runtime() || @@ -662,10 +661,7 @@ class RunProfman : public ExecVHelper { const std::vector<std::string>& dex_locations, bool copy_and_update, bool store_aggregation_counters) { - const char* profman_bin = - is_debug_runtime() - ? "/apex/com.android.runtime/bin/profmand" - : "/apex/com.android.runtime/bin/profman"; + const char* profman_bin = is_debug_runtime() ? kProfmanDebugPath: kProfmanPath; if (copy_and_update) { CHECK_EQ(1u, profile_fds.size()); @@ -1481,9 +1477,7 @@ class RunDexoptAnalyzer : public ExecVHelper { const char* class_loader_context) { CHECK_GE(zip_fd, 0); const char* dexoptanalyzer_bin = - is_debug_runtime() - ? "/apex/com.android.runtime/bin/dexoptanalyzerd" - : "/apex/com.android.runtime/bin/dexoptanalyzer"; + is_debug_runtime() ? kDexoptanalyzerDebugPath : kDexoptanalyzerPath; std::string dex_file_arg = "--dex-file=" + dex_file; std::string oat_fd_arg = "--oat-fd=" + std::to_string(oat_fd); diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h index 0db11e1e7b..5902659e8b 100644 --- a/cmds/installd/dexopt.h +++ b/cmds/installd/dexopt.h @@ -32,6 +32,16 @@ static constexpr int DEX2OAT_FROM_SCRATCH = 1; static constexpr int DEX2OAT_FOR_BOOT_IMAGE = 2; static constexpr int DEX2OAT_FOR_FILTER = 3; +#define ANDROID_RUNTIME_APEX_BIN "/apex/com.android.runtime/bin" +// Location of binaries in the Android Runtime APEX. +static constexpr const char* kDex2oatPath = ANDROID_RUNTIME_APEX_BIN "/dex2oat"; +static constexpr const char* kDex2oatDebugPath = ANDROID_RUNTIME_APEX_BIN "/dex2oatd"; +static constexpr const char* kProfmanPath = ANDROID_RUNTIME_APEX_BIN "/profmand"; +static constexpr const char* kProfmanDebugPath = ANDROID_RUNTIME_APEX_BIN "/profmand"; +static constexpr const char* kDexoptanalyzerPath = ANDROID_RUNTIME_APEX_BIN "/dexoptanalyzer"; +static constexpr const char* kDexoptanalyzerDebugPath = ANDROID_RUNTIME_APEX_BIN "/dexoptanalyzerd"; +#undef ANDROID_RUNTIME_APEX_BIN + // Clear the reference profile identified by the given profile name. bool clear_primary_reference_profile(const std::string& pkgname, const std::string& profile_name); // Clear the current profile identified by the given profile name (for single user). diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp index 05c8538491..de7b2499b8 100644 --- a/cmds/installd/otapreopt.cpp +++ b/cmds/installd/otapreopt.cpp @@ -438,7 +438,7 @@ private: const char* isa) const { // This needs to be kept in sync with ART, see art/runtime/gc/space/image_space.cc. std::vector<std::string> cmd; - cmd.push_back("/apex/com.android.runtime/bin/dex2oat"); + cmd.push_back(kDex2oatPath); cmd.push_back(StringPrintf("--image=%s", art_path.c_str())); for (const std::string& boot_part : Split(boot_cp, ":")) { cmd.push_back(StringPrintf("--dex-file=%s", boot_part.c_str())); |