Merge "idmap: include idmap version in check for stale file"
This commit is contained in:
@@ -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;
|
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)) {
|
&cached_target_path, &cached_overlay_path)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version != ResTable::IDMAP_CURRENT_VERSION) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (cached_target_path != target_apk_path) {
|
if (cached_target_path != target_apk_path) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ namespace android {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IDMAP_MAGIC 0x504D4449
|
#define IDMAP_MAGIC 0x504D4449
|
||||||
#define IDMAP_CURRENT_VERSION 0x00000001
|
|
||||||
|
|
||||||
#define APP_PACKAGE_ID 0x7f
|
#define APP_PACKAGE_ID 0x7f
|
||||||
#define SYS_PACKAGE_ID 0x01
|
#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));
|
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
|
// We are strict about versions because files with this format are
|
||||||
// auto-generated and don't need backwards compatibility.
|
// auto-generated and don't need backwards compatibility.
|
||||||
ALOGW("idmap: version mismatch in header (is 0x%08x, expected 0x%08x)",
|
ALOGW("idmap: version mismatch in header (is 0x%08x, expected 0x%08x)",
|
||||||
version, IDMAP_CURRENT_VERSION);
|
version, ResTable::IDMAP_CURRENT_VERSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -6855,7 +6854,7 @@ status_t ResTable::createIdmap(const ResTable& overlay,
|
|||||||
|
|
||||||
uint32_t* data = (uint32_t*)*outData;
|
uint32_t* data = (uint32_t*)*outData;
|
||||||
*data++ = htodl(IDMAP_MAGIC);
|
*data++ = htodl(IDMAP_MAGIC);
|
||||||
*data++ = htodl(IDMAP_CURRENT_VERSION);
|
*data++ = htodl(ResTable::IDMAP_CURRENT_VERSION);
|
||||||
*data++ = htodl(targetCrc);
|
*data++ = htodl(targetCrc);
|
||||||
*data++ = htodl(overlayCrc);
|
*data++ = htodl(overlayCrc);
|
||||||
const char* paths[] = { targetPath, overlayPath };
|
const char* paths[] = { targetPath, overlayPath };
|
||||||
|
|||||||
@@ -1933,6 +1933,7 @@ public:
|
|||||||
void** outData, size_t* outSize) const;
|
void** outData, size_t* outSize) const;
|
||||||
|
|
||||||
static const size_t IDMAP_HEADER_SIZE_BYTES = 4 * sizeof(uint32_t) + 2 * 256;
|
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.
|
// Retrieve idmap meta-data.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user