Remove changing uids/timestamps from zip/jar files
Pass -X to zip so that Unix UID/GID and extra timestamps aren't
saved into the zip files.
Add a new option to zipalign, -t, to replace all timestamps with static
timestamps (2008 Jan 1 00:00:00). Use this for all non-APK zip files.
APK zip timestamps are set based on the certificate date in SignApk.
Bug: 24201956
Change-Id: Ifb619fc499ba9d99fc624f2acd5f8de36d78ef8e
diff --git a/tools/zipalign/ZipFile.h b/tools/zipalign/ZipFile.h
index b99cda5..787576f 100644
--- a/tools/zipalign/ZipFile.h
+++ b/tools/zipalign/ZipFile.h
@@ -77,17 +77,17 @@
*
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/
- status_t add(const char* fileName, int compressionMethod,
+ status_t add(const char* fileName, int compressionMethod, bool removeTime,
ZipEntry** ppEntry)
{
- return add(fileName, fileName, compressionMethod, ppEntry);
+ return add(fileName, fileName, compressionMethod, removeTime, ppEntry);
}
status_t add(const char* fileName, const char* storageName,
- int compressionMethod, ZipEntry** ppEntry)
+ int compressionMethod, bool removeTime, ZipEntry** ppEntry)
{
return addCommon(fileName, NULL, 0, storageName,
ZipEntry::kCompressStored,
- compressionMethod, ppEntry);
+ compressionMethod, removeTime, ppEntry);
}
/*
@@ -96,11 +96,12 @@
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/
status_t addGzip(const char* fileName, const char* storageName,
- ZipEntry** ppEntry)
+ bool removeTime, ZipEntry** ppEntry)
{
return addCommon(fileName, NULL, 0, storageName,
ZipEntry::kCompressDeflated,
- ZipEntry::kCompressDeflated, ppEntry);
+ ZipEntry::kCompressDeflated,
+ removeTime, ppEntry);
}
/*
@@ -109,11 +110,11 @@
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/
status_t add(const void* data, size_t size, const char* storageName,
- int compressionMethod, ZipEntry** ppEntry)
+ int compressionMethod, bool removeTime, ZipEntry** ppEntry)
{
return addCommon(NULL, data, size, storageName,
ZipEntry::kCompressStored,
- compressionMethod, ppEntry);
+ compressionMethod, removeTime, ppEntry);
}
/*
@@ -124,7 +125,7 @@
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/
status_t add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
- int padding, ZipEntry** ppEntry);
+ int padding, bool removeTime, ZipEntry** ppEntry);
/*
* Add an entry by copying it from another zip file, recompressing with
@@ -133,7 +134,7 @@
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/
status_t addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
- ZipEntry** ppEntry);
+ bool removeTime, ZipEntry** ppEntry);
/*
* Mark an entry as having been removed. It is not actually deleted
@@ -232,7 +233,7 @@
/* common handler for all "add" functions */
status_t addCommon(const char* fileName, const void* data, size_t size,
const char* storageName, int sourceType, int compressionMethod,
- ZipEntry** ppEntry);
+ bool removeTime, ZipEntry** ppEntry);
/* copy all of "srcFp" into "dstFp" */
status_t copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32);