From 3aaecf0e678a241a25ac358dbf280a35a5c48efc Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Wed, 10 Aug 2022 15:35:28 +0100 Subject: ART services: optimize package - Add artd methods. This change adds two artd methods: `getDexoptNeeded` and `dexopt`, which are used for app compilation. Also, this CL replaces all `StringPrintf` with `_format`. Bug: 229268202 Test: m test-art-host-gtest-art_artd_tests Ignore-AOSP-First: ART Services. Change-Id: I51a42816750ff39c768658f739c7e6337cfe3e1c --- artd/path_utils.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'artd/path_utils.h') diff --git a/artd/path_utils.h b/artd/path_utils.h index 970143a9c7..41513876f1 100644 --- a/artd/path_utils.h +++ b/artd/path_utils.h @@ -19,19 +19,37 @@ #include "aidl/com/android/server/art/BnArtd.h" #include "android-base/result.h" +#include "base/file_utils.h" namespace art { namespace artd { +android::base::Result ValidateDexPath(const std::string& dex_path); + +android::base::Result BuildArtBinPath(const std::string& binary_name); + // Returns the absolute path to the OAT file built from the `ArtifactsPath`. android::base::Result BuildOatPath( const aidl::com::android::server::art::ArtifactsPath& artifacts_path); // Returns the path to the VDEX file that corresponds to the OAT file. -std::string OatPathToVdexPath(const std::string& oat_path); +inline std::string OatPathToVdexPath(const std::string& oat_path) { + return ReplaceFileExtension(oat_path, "vdex"); +} // Returns the path to the ART file that corresponds to the OAT file. -std::string OatPathToArtPath(const std::string& oat_path); +inline std::string OatPathToArtPath(const std::string& oat_path) { + return ReplaceFileExtension(oat_path, "art"); +} + +android::base::Result BuildDexMetadataPath( + const aidl::com::android::server::art::DexMetadataPath& dex_metadata_path); + +android::base::Result BuildDexMetadataPath( + const aidl::com::android::server::art::VdexPath& vdex_path); + +android::base::Result BuildVdexPath( + const aidl::com::android::server::art::VdexPath& vdex_path); } // namespace artd } // namespace art -- cgit v1.2.3-59-g8ed1b