diff options
author | Andreas Gampe <agampe@google.com> | 2014-07-24 15:35:50 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-07-24 15:35:50 -0700 |
commit | cb8f9e8a2941971c049b26745ea713c859342d9b (patch) | |
tree | c1600a19f134f45ecb8f4feea8c543df751f348f /runtime/dex_file.h | |
parent | 80b3f96ec1e408f34b8e7b76b14774794fa1abd8 (diff) | |
download | android_art-cb8f9e8a2941971c049b26745ea713c859342d9b.tar.gz android_art-cb8f9e8a2941971c049b26745ea713c859342d9b.tar.bz2 android_art-cb8f9e8a2941971c049b26745ea713c859342d9b.zip |
ART: Account for multidex location strings in VMClassLoader
To look up resources, look in the unadorned location.
Bug: 16530747
Change-Id: Ia97e39366444f6666a78ade7298d3c22b4b79f8a
Diffstat (limited to 'runtime/dex_file.h')
-rw-r--r-- | runtime/dex_file.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 04f1cc1417..d64a030051 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -382,6 +382,20 @@ class DexFile { return location_; } + // For normal dex files, location and base location coincide. If a dex file is part of a multidex + // archive, the base location is the name of the originating jar/apk, stripped of any internal + // classes*.dex path. + const std::string GetBaseLocation() const { + if (IsMultiDexLocation(location_.c_str())) { + std::pair<const char*, const char*> pair = SplitMultiDexLocation(location_.c_str()); + std::string res(pair.first); + delete[] pair.first; + return res; + } else { + return location_; + } + } + // For DexFiles directly from .dex files, this is the checksum from the DexFile::Header. // For DexFiles opened from a zip files, this will be the ZipEntry CRC32 of classes.dex. uint32_t GetLocationChecksum() const { |