Expose whether a file was compressed before being loaded in memory.
This is useful when we want to write an APK and keep the same
compression parameters as the original APK.
Test: Unit tests pass.
Change-Id: I3afcae1c8727e429b08c9ac7359cf0789ff4abfc
diff --git a/tools/aapt2/io/ZipArchive.cpp b/tools/aapt2/io/ZipArchive.cpp
index 62b436f..debc484 100644
--- a/tools/aapt2/io/ZipArchive.cpp
+++ b/tools/aapt2/io/ZipArchive.cpp
@@ -59,6 +59,10 @@
const Source& ZipFile::GetSource() const { return source_; }
+bool ZipFile::WasCompressed() {
+ return zip_entry_.method != kCompressStored;
+}
+
ZipFileCollectionIterator::ZipFileCollectionIterator(
ZipFileCollection* collection)
: current_(collection->files_.begin()), end_(collection->files_.end()) {}