Revert "Revert "Full-stack integrity: check vdex contents.""
bug: 30972906
Initial revert due to 'check' file of the test needing updating for target tests.
This reverts commit a19b7649faf8780737be7ce3ec48a12d81c6d69f.
Change-Id: I455780bd88cd89ff80c9084d399e2beeb819b95f
diff --git a/runtime/dex/art_dex_file_loader.cc b/runtime/dex/art_dex_file_loader.cc
index 14386a3..c456764 100644
--- a/runtime/dex/art_dex_file_loader.cc
+++ b/runtime/dex/art_dex_file_loader.cc
@@ -85,7 +85,8 @@
bool ArtDexFileLoader::GetMultiDexChecksums(const char* filename,
std::vector<uint32_t>* checksums,
std::string* error_msg,
- int zip_fd) const {
+ int zip_fd,
+ bool* zip_file_only_contains_uncompressed_dex) const {
CHECK(checksums != nullptr);
uint32_t magic;
@@ -119,7 +120,17 @@
return false;
}
+ if (zip_file_only_contains_uncompressed_dex != nullptr) {
+ // Start by assuming everything is uncompressed.
+ *zip_file_only_contains_uncompressed_dex = true;
+ }
+
do {
+ if (zip_file_only_contains_uncompressed_dex != nullptr) {
+ if (!(zip_entry->IsUncompressed() && zip_entry->IsAlignedToDexHeader())) {
+ *zip_file_only_contains_uncompressed_dex = false;
+ }
+ }
checksums->push_back(zip_entry->GetCrc32());
zip_entry_name = GetMultiDexClassesDexName(i++);
zip_entry.reset(zip_archive->Find(zip_entry_name.c_str(), error_msg));
diff --git a/runtime/dex/art_dex_file_loader.h b/runtime/dex/art_dex_file_loader.h
index 3585381..7c7a59b 100644
--- a/runtime/dex/art_dex_file_loader.h
+++ b/runtime/dex/art_dex_file_loader.h
@@ -50,7 +50,8 @@
bool GetMultiDexChecksums(const char* filename,
std::vector<uint32_t>* checksums,
std::string* error_msg,
- int zip_fd = -1) const OVERRIDE;
+ int zip_fd = -1,
+ bool* only_contains_uncompressed_dex = nullptr) const OVERRIDE;
// Opens .dex file, backed by existing memory
std::unique_ptr<const DexFile> Open(const uint8_t* base,