diff options
author | 2024-02-16 20:33:42 +0000 | |
---|---|---|
committer | 2024-02-26 12:06:25 +0000 | |
commit | 949c197585d383755d9f04c024507959b35e722d (patch) | |
tree | 4b451dc9f92a71545133c603730c5c685aadb134 | |
parent | 6d918753132c67fe967f79c7ce20fb3cf57c4587 (diff) |
Clarify the format and assumptions on the dex file locations.
libnativeloader now uses them more often to determine how to load
libraries based on the java caller location, and then it relies on them
being absolute paths.
Test: n/a - comment change only
Bug: 237577392
Change-Id: I6700c0182e3c942a76880307c5947bfca4c1d0d9
-rw-r--r-- | libdexfile/dex/dex_file.h | 12 | ||||
-rw-r--r-- | libdexfile/dex/dex_file_loader.h | 11 |
2 files changed, 22 insertions, 1 deletions
diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h index 8bcf1d803a..6bc6e4f4ca 100644 --- a/libdexfile/dex/dex_file.h +++ b/libdexfile/dex/dex_file.h @@ -935,7 +935,17 @@ class DexFile { // 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 6530303542..ec7f8ba977 100644 --- a/libdexfile/dex/dex_file_loader.h +++ b/libdexfile/dex/dex_file_loader.h @@ -327,6 +327,17 @@ class DexFileLoader { 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_; }; |