summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2017-09-06 20:36:28 +0000
committer android-build-merger <android-build-merger@google.com> 2017-09-06 20:36:28 +0000
commita15992086c63c38cb61ed23af8c5507d413c4776 (patch)
tree19aa70fd16a3ab14e59a4cd07cdf0cb019e8923c
parent4f4218a3bedc4599ede5ae94250cc727897ca7fd (diff)
parent609887a9800073897ac962fb9627bd425b96b7b3 (diff)
Merge "idmap: include idmap version in check for stale file"
am: 609887a980 Change-Id: I4779cd92041fe33a95c0034c539c48989ca8e6df
-rw-r--r--cmds/idmap/create.cpp8
-rw-r--r--libs/androidfw/ResourceTypes.cpp7
-rw-r--r--libs/androidfw/include/androidfw/ResourceTypes.h1
3 files changed, 10 insertions, 6 deletions
diff --git a/cmds/idmap/create.cpp b/cmds/idmap/create.cpp
index 524db14f7aab..f415f8f5dd75 100644
--- a/cmds/idmap/create.cpp
+++ b/cmds/idmap/create.cpp
@@ -104,13 +104,17 @@ fail:
}
}
- uint32_t cached_target_crc, cached_overlay_crc;
+ uint32_t version, cached_target_crc, cached_overlay_crc;
String8 cached_target_path, cached_overlay_path;
- if (!ResTable::getIdmapInfo(buf, N, NULL, &cached_target_crc, &cached_overlay_crc,
+ if (!ResTable::getIdmapInfo(buf, N, &version, &cached_target_crc, &cached_overlay_crc,
&cached_target_path, &cached_overlay_path)) {
return true;
}
+ if (version != ResTable::IDMAP_CURRENT_VERSION) {
+ return true;
+ }
+
if (cached_target_path != target_apk_path) {
return true;
}
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 0782269d7de1..7a0ef2b770ce 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -59,7 +59,6 @@ namespace android {
#endif
#define IDMAP_MAGIC 0x504D4449
-#define IDMAP_CURRENT_VERSION 0x00000001
#define APP_PACKAGE_ID 0x7f
#define SYS_PACKAGE_ID 0x01
@@ -246,11 +245,11 @@ static bool assertIdmapHeader(const void* idmap, size_t size) {
}
const uint32_t version = htodl(*(reinterpret_cast<const uint32_t*>(idmap) + 1));
- if (version != IDMAP_CURRENT_VERSION) {
+ if (version != ResTable::IDMAP_CURRENT_VERSION) {
// We are strict about versions because files with this format are
// auto-generated and don't need backwards compatibility.
ALOGW("idmap: version mismatch in header (is 0x%08x, expected 0x%08x)",
- version, IDMAP_CURRENT_VERSION);
+ version, ResTable::IDMAP_CURRENT_VERSION);
return false;
}
return true;
@@ -6855,7 +6854,7 @@ status_t ResTable::createIdmap(const ResTable& overlay,
uint32_t* data = (uint32_t*)*outData;
*data++ = htodl(IDMAP_MAGIC);
- *data++ = htodl(IDMAP_CURRENT_VERSION);
+ *data++ = htodl(ResTable::IDMAP_CURRENT_VERSION);
*data++ = htodl(targetCrc);
*data++ = htodl(overlayCrc);
const char* paths[] = { targetPath, overlayPath };
diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h
index 7a6e37d41b7c..66c66c251d9b 100644
--- a/libs/androidfw/include/androidfw/ResourceTypes.h
+++ b/libs/androidfw/include/androidfw/ResourceTypes.h
@@ -1933,6 +1933,7 @@ public:
void** outData, size_t* outSize) const;
static const size_t IDMAP_HEADER_SIZE_BYTES = 4 * sizeof(uint32_t) + 2 * 256;
+ static const uint32_t IDMAP_CURRENT_VERSION = 0x00000001;
// Retrieve idmap meta-data.
//