diff options
author | 2024-05-24 08:27:25 -0700 | |
---|---|---|
committer | 2024-05-24 11:35:17 -0700 | |
commit | fe285426c4f9149537bdd7cb351b02ec102e6082 (patch) | |
tree | a50559e0969480b7f613fc086e380a290ee3d6b1 /libs/androidfw/Idmap.cpp | |
parent | e2447a31771717fe6259043760ba02484f09d4da (diff) | |
parent | ed6f98ac9f4049f370e1db86e1b4e141bb83f5cc (diff) |
Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: Ie71e752f0224aa239ba1350d50996ce4b510949a
Change-Id: Ib25c1abf055b0114e0494088df5585f65df27595
Diffstat (limited to 'libs/androidfw/Idmap.cpp')
-rw-r--r-- | libs/androidfw/Idmap.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libs/androidfw/Idmap.cpp b/libs/androidfw/Idmap.cpp index 5f98b8f8db43..982419059ead 100644 --- a/libs/androidfw/Idmap.cpp +++ b/libs/androidfw/Idmap.cpp @@ -18,8 +18,10 @@ #include "androidfw/Idmap.h" +#include "android-base/file.h" #include "android-base/logging.h" #include "android-base/stringprintf.h" +#include "android-base/utf8.h" #include "androidfw/misc.h" #include "androidfw/ResourceTypes.h" #include "androidfw/Util.h" @@ -250,7 +252,12 @@ std::optional<std::string_view> ReadString(const uint8_t** in_out_data_ptr, size } } // namespace -LoadedIdmap::LoadedIdmap(std::string&& idmap_path, const Idmap_header* header, +// O_PATH is a lightweight way of creating an FD, only exists on Linux +#ifndef O_PATH +#define O_PATH (0) +#endif + +LoadedIdmap::LoadedIdmap(const std::string& idmap_path, const Idmap_header* header, const Idmap_data_header* data_header, const Idmap_target_entry* target_entries, const Idmap_target_entry_inline* target_inline_entries, @@ -267,10 +274,10 @@ LoadedIdmap::LoadedIdmap(std::string&& idmap_path, const Idmap_header* header, configurations_(configs), overlay_entries_(overlay_entries), string_pool_(std::move(string_pool)), - idmap_path_(std::move(idmap_path)), + idmap_fd_(android::base::utf8::open(idmap_path.c_str(), O_RDONLY|O_CLOEXEC|O_BINARY|O_PATH)), overlay_apk_path_(overlay_apk_path), target_apk_path_(target_apk_path), - idmap_last_mod_time_(getFileModDate(idmap_path_.data())) {} + idmap_last_mod_time_(getFileModDate(idmap_fd_.get())) {} std::unique_ptr<LoadedIdmap> LoadedIdmap::Load(StringPiece idmap_path, StringPiece idmap_data) { ATRACE_CALL(); @@ -368,7 +375,7 @@ std::unique_ptr<LoadedIdmap> LoadedIdmap::Load(StringPiece idmap_path, StringPie } bool LoadedIdmap::IsUpToDate() const { - return idmap_last_mod_time_ == getFileModDate(idmap_path_.c_str()); + return idmap_last_mod_time_ == getFileModDate(idmap_fd_.get()); } } // namespace android |