Clarify the format and assumptions on the dex file locations. am: 949c197585 am: 42187d5886
Original change: https://android-review.googlesource.com/c/platform/art/+/2969535
Change-Id: I3a1cc3a90a35596369d65c93d4024e6930b63186
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h
index 8bcf1d8..6bc6e4f 100644
--- a/libdexfile/dex/dex_file.h
+++ b/libdexfile/dex/dex_file.h
@@ -935,7 +935,17 @@
// This is different to the "data section" in the standard dex header.
ArrayRef<const uint8_t> const data_;
- // Typically the dex file name when available, alternatively some identifying string.
+ // The full absolute path to the dex file, if it was loaded from disk.
+ //
+ // Can also be a path to a multidex container (typically apk), followed by
+ // DexFileLoader.kMultiDexSeparator (i.e. '!') and the file inside the
+ // container.
+ //
+ // On host this may not be an absolute path.
+ //
+ // On device libnativeloader uses this to determine the location of the java
+ // package or shared library, which decides where to load native libraries
+ // from.
//
// The ClassLinker will use this to match DexFiles the boot class
// path to DexCache::GetLocation when loading from an image.
diff --git a/libdexfile/dex/dex_file_loader.h b/libdexfile/dex/dex_file_loader.h
index 6530303..ec7f8ba 100644
--- a/libdexfile/dex/dex_file_loader.h
+++ b/libdexfile/dex/dex_file_loader.h
@@ -327,6 +327,17 @@
const File* file_ = &kInvalidFile;
std::optional<File> owned_file_; // May be used as backing storage for 'file_'.
std::shared_ptr<DexFileContainer> root_container_;
+
+ // The full absolute path to the dex file, if it was loaded from disk.
+ //
+ // Can also be a path to a multidex container (typically apk), followed by
+ // kMultiDexSeparator and the file inside the container.
+ //
+ // On host this may not be an absolute path.
+ //
+ // On device libnativeloader uses this to determine the location of the java
+ // package or shared library, which decides where to load native libraries
+ // from.
const std::string location_;
};