Remove idmap path 256 length limit
Overlay and target package paths can be longer than 256 characters.
Currently, the idmap will fail to be generated if either path
is longer than 256 characters.
This change removes the 256 character limit and makes parsing variable
length strings easier in libandroidfw.
Bug: 174676094
Test: idmap2_tests && libandroidfw_tests
Change-Id: Ic240cdb8700566b2ac2ade08da58bea852e4ae0c
diff --git a/cmds/idmap2/tests/IdmapTests.cpp b/cmds/idmap2/tests/IdmapTests.cpp
index 9b42a27..7be1602 100644
--- a/cmds/idmap2/tests/IdmapTests.cpp
+++ b/cmds/idmap2/tests/IdmapTests.cpp
@@ -35,7 +35,6 @@
#include "idmap2/LogInfo.h"
using android::Res_value;
-using ::testing::IsNull;
using ::testing::NotNull;
using PolicyFlags = android::ResTable_overlayable_policy_header::PolicyFlags;
@@ -66,29 +65,18 @@
std::unique_ptr<const IdmapHeader> header = IdmapHeader::FromBinaryStream(stream);
ASSERT_THAT(header, NotNull());
ASSERT_EQ(header->GetMagic(), 0x504d4449U);
- ASSERT_EQ(header->GetVersion(), 0x05U);
+ ASSERT_EQ(header->GetVersion(), 0x06U);
ASSERT_EQ(header->GetTargetCrc(), 0x1234U);
ASSERT_EQ(header->GetOverlayCrc(), 0x5678U);
ASSERT_EQ(header->GetFulfilledPolicies(), 0x11);
ASSERT_EQ(header->GetEnforceOverlayable(), true);
- ASSERT_EQ(header->GetTargetPath().to_string(), "targetX.apk");
- ASSERT_EQ(header->GetOverlayPath().to_string(), "overlayX.apk");
+ ASSERT_EQ(header->GetTargetPath(), "targetX.apk");
+ ASSERT_EQ(header->GetOverlayPath(), "overlayX.apk");
ASSERT_EQ(header->GetDebugInfo(), "debug");
}
-TEST(IdmapTests, FailToCreateIdmapHeaderFromBinaryStreamIfPathTooLong) {
- std::string raw(reinterpret_cast<const char*>(idmap_raw_data), idmap_raw_data_len);
- // overwrite the target path string, including the terminating null, with '.'
- for (size_t i = 0x18; i < 0x118; i++) {
- raw[i] = '.';
- }
- std::istringstream stream(raw);
- std::unique_ptr<const IdmapHeader> header = IdmapHeader::FromBinaryStream(stream);
- ASSERT_THAT(header, IsNull());
-}
-
TEST(IdmapTests, CreateIdmapDataHeaderFromBinaryStream) {
- const size_t offset = 0x224;
+ const size_t offset = idmap_raw_data_offset;
std::string raw(reinterpret_cast<const char*>(idmap_raw_data + offset),
idmap_raw_data_len - offset);
std::istringstream stream(raw);
@@ -100,7 +88,7 @@
}
TEST(IdmapTests, CreateIdmapDataFromBinaryStream) {
- const size_t offset = 0x224;
+ const size_t offset = idmap_raw_data_offset;
std::string raw(reinterpret_cast<const char*>(idmap_raw_data + offset),
idmap_raw_data_len - offset);
std::istringstream stream(raw);
@@ -136,13 +124,13 @@
ASSERT_THAT(idmap->GetHeader(), NotNull());
ASSERT_EQ(idmap->GetHeader()->GetMagic(), 0x504d4449U);
- ASSERT_EQ(idmap->GetHeader()->GetVersion(), 0x05U);
+ ASSERT_EQ(idmap->GetHeader()->GetVersion(), 0x06U);
ASSERT_EQ(idmap->GetHeader()->GetTargetCrc(), 0x1234U);
ASSERT_EQ(idmap->GetHeader()->GetOverlayCrc(), 0x5678U);
ASSERT_EQ(idmap->GetHeader()->GetFulfilledPolicies(), 0x11);
ASSERT_EQ(idmap->GetHeader()->GetEnforceOverlayable(), true);
- ASSERT_EQ(idmap->GetHeader()->GetTargetPath().to_string(), "targetX.apk");
- ASSERT_EQ(idmap->GetHeader()->GetOverlayPath().to_string(), "overlayX.apk");
+ ASSERT_EQ(idmap->GetHeader()->GetTargetPath(), idmap_raw_data_target_path);
+ ASSERT_EQ(idmap->GetHeader()->GetOverlayPath(), idmap_raw_data_overlay_path);
const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
ASSERT_EQ(dataBlocks.size(), 1U);
@@ -195,12 +183,12 @@
ASSERT_THAT(idmap->GetHeader(), NotNull());
ASSERT_EQ(idmap->GetHeader()->GetMagic(), 0x504d4449U);
- ASSERT_EQ(idmap->GetHeader()->GetVersion(), 0x05U);
+ ASSERT_EQ(idmap->GetHeader()->GetVersion(), 0x06U);
ASSERT_EQ(idmap->GetHeader()->GetTargetCrc(), android::idmap2::TestConstants::TARGET_CRC);
ASSERT_EQ(idmap->GetHeader()->GetOverlayCrc(), android::idmap2::TestConstants::OVERLAY_CRC);
ASSERT_EQ(idmap->GetHeader()->GetFulfilledPolicies(), PolicyFlags::PUBLIC);
ASSERT_EQ(idmap->GetHeader()->GetEnforceOverlayable(), true);
- ASSERT_EQ(idmap->GetHeader()->GetTargetPath().to_string(), target_apk_path);
+ ASSERT_EQ(idmap->GetHeader()->GetTargetPath(), target_apk_path);
ASSERT_EQ(idmap->GetHeader()->GetOverlayPath(), overlay_apk_path);
}
@@ -370,38 +358,19 @@
ASSERT_EQ(overlay_entries.size(), 0U);
}
-TEST(IdmapTests, FailToCreateIdmapFromApkAssetsIfPathTooLong) {
- std::string target_apk_path(GetTestDataPath());
- for (int i = 0; i < 32; i++) {
- target_apk_path += "/target/../";
- }
- target_apk_path += "/target/target.apk";
- ASSERT_GT(target_apk_path.size(), kIdmapStringLength);
- std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
- ASSERT_THAT(target_apk, NotNull());
-
- const std::string overlay_apk_path(GetTestDataPath() + "/overlay/overlay.apk");
- std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
- ASSERT_THAT(overlay_apk, NotNull());
-
- const auto result = Idmap::FromApkAssets(*target_apk, *overlay_apk, PolicyFlags::PUBLIC,
- /* enforce_overlayable */ true);
- ASSERT_FALSE(result);
-}
-
TEST(IdmapTests, IdmapHeaderIsUpToDate) {
fclose(stderr); // silence expected warnings from libandroidfw
- const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
- std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
- ASSERT_THAT(target_apk, NotNull());
+ const std::string target_apk_path = idmap_raw_data_target_path;
+ const std::string overlay_apk_path = idmap_raw_data_overlay_path;
+ const PolicyBitmask policies = idmap_raw_data_policies;
+ const uint32_t target_crc = idmap_raw_data_target_crc;
+ const uint32_t overlay_crc = idmap_raw_data_overlay_crc;
- const std::string overlay_apk_path(GetTestDataPath() + "/overlay/overlay.apk");
- std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
- ASSERT_THAT(overlay_apk, NotNull());
+ std::string raw(reinterpret_cast<const char*>(idmap_raw_data), idmap_raw_data_len);
+ std::istringstream raw_stream(raw);
- auto result = Idmap::FromApkAssets(*target_apk, *overlay_apk, PolicyFlags::PUBLIC,
- /* enforce_overlayable */ true);
+ auto result = Idmap::FromBinaryStream(raw_stream);
ASSERT_TRUE(result);
const auto idmap = std::move(*result);
@@ -411,8 +380,8 @@
std::unique_ptr<const IdmapHeader> header = IdmapHeader::FromBinaryStream(stream);
ASSERT_THAT(header, NotNull());
- ASSERT_TRUE(header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_TRUE(header->IsUpToDate(target_apk_path, overlay_apk_path, idmap_raw_data_target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
// magic: bytes (0x0, 0x03)
std::string bad_magic_string(stream.str());
@@ -425,8 +394,8 @@
IdmapHeader::FromBinaryStream(bad_magic_stream);
ASSERT_THAT(bad_magic_header, NotNull());
ASSERT_NE(header->GetMagic(), bad_magic_header->GetMagic());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
// version: bytes (0x4, 0x07)
std::string bad_version_string(stream.str());
@@ -439,8 +408,8 @@
IdmapHeader::FromBinaryStream(bad_version_stream);
ASSERT_THAT(bad_version_header, NotNull());
ASSERT_NE(header->GetVersion(), bad_version_header->GetVersion());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
// target crc: bytes (0x8, 0xb)
std::string bad_target_crc_string(stream.str());
@@ -453,8 +422,8 @@
IdmapHeader::FromBinaryStream(bad_target_crc_stream);
ASSERT_THAT(bad_target_crc_header, NotNull());
ASSERT_NE(header->GetTargetCrc(), bad_target_crc_header->GetTargetCrc());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
// overlay crc: bytes (0xc, 0xf)
std::string bad_overlay_crc_string(stream.str());
@@ -467,8 +436,8 @@
IdmapHeader::FromBinaryStream(bad_overlay_crc_stream);
ASSERT_THAT(bad_overlay_crc_header, NotNull());
ASSERT_NE(header->GetOverlayCrc(), bad_overlay_crc_header->GetOverlayCrc());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
// fulfilled policy: bytes (0x10, 0x13)
std::string bad_policy_string(stream.str());
@@ -481,8 +450,9 @@
IdmapHeader::FromBinaryStream(bad_policy_stream);
ASSERT_THAT(bad_policy_header, NotNull());
ASSERT_NE(header->GetFulfilledPolicies(), bad_policy_header->GetFulfilledPolicies());
- ASSERT_FALSE(bad_policy_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_policy_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies,
+ /* enforce_overlayable */ true));
// enforce overlayable: bytes (0x14)
std::string bad_enforce_string(stream.str());
@@ -492,30 +462,32 @@
IdmapHeader::FromBinaryStream(bad_enforce_stream);
ASSERT_THAT(bad_enforce_header, NotNull());
ASSERT_NE(header->GetEnforceOverlayable(), bad_enforce_header->GetEnforceOverlayable());
- ASSERT_FALSE(bad_enforce_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_enforce_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies,
+ /* enforce_overlayable */ true));
- // target path: bytes (0x18, 0x117)
+ // target path: bytes (0x1c, 0x27)
std::string bad_target_path_string(stream.str());
- bad_target_path_string[0x18] = '\0';
+ bad_target_path_string[0x1c] = '\0';
std::stringstream bad_target_path_stream(bad_target_path_string);
std::unique_ptr<const IdmapHeader> bad_target_path_header =
IdmapHeader::FromBinaryStream(bad_target_path_stream);
ASSERT_THAT(bad_target_path_header, NotNull());
ASSERT_NE(header->GetTargetPath(), bad_target_path_header->GetTargetPath());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies, /* enforce_overlayable */ true));
- // overlay path: bytes (0x118, 0x217)
+ // overlay path: bytes (0x2c, 0x37)
std::string bad_overlay_path_string(stream.str());
- bad_overlay_path_string[0x118] = '\0';
+ bad_overlay_path_string[0x33] = '\0';
std::stringstream bad_overlay_path_stream(bad_overlay_path_string);
std::unique_ptr<const IdmapHeader> bad_overlay_path_header =
IdmapHeader::FromBinaryStream(bad_overlay_path_stream);
ASSERT_THAT(bad_overlay_path_header, NotNull());
ASSERT_NE(header->GetOverlayPath(), bad_overlay_path_header->GetOverlayPath());
- ASSERT_FALSE(bad_magic_header->IsUpToDate(target_apk_path.c_str(), overlay_apk_path.c_str(),
- PolicyFlags::PUBLIC, /* enforce_overlayable */ true));
+ ASSERT_FALSE(bad_overlay_path_header->IsUpToDate(target_apk_path, overlay_apk_path, target_crc,
+ overlay_crc, policies,
+ /* enforce_overlayable */ true));
}
class TestVisitor : public Visitor {
diff --git a/cmds/idmap2/tests/RawPrintVisitorTests.cpp b/cmds/idmap2/tests/RawPrintVisitorTests.cpp
index 95bd9473..b7ea22a 100644
--- a/cmds/idmap2/tests/RawPrintVisitorTests.cpp
+++ b/cmds/idmap2/tests/RawPrintVisitorTests.cpp
@@ -65,7 +65,7 @@
(*idmap)->accept(&visitor);
ASSERT_CONTAINS_REGEX(ADDRESS "504d4449 magic\n", stream.str());
- ASSERT_CONTAINS_REGEX(ADDRESS "00000005 version\n", stream.str());
+ ASSERT_CONTAINS_REGEX(ADDRESS "00000006 version\n", stream.str());
ASSERT_CONTAINS_REGEX(
StringPrintf(ADDRESS "%s target crc\n", android::idmap2::TestConstants::TARGET_CRC_STRING),
stream.str());
@@ -85,7 +85,7 @@
ASSERT_CONTAINS_REGEX(ADDRESS "7f010000 overlay id: integer/int1\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "7f010000 target id: integer/int1\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "000000b4 string pool size\n", stream.str());
- ASSERT_CONTAINS_REGEX("000002bc: ........ string pool: ...\n", stream.str());
+ ASSERT_CONTAINS_REGEX("000001bc: ........ string pool\n", stream.str());
}
TEST(RawPrintVisitorTests, CreateRawPrintVisitorWithoutAccessToApks) {
@@ -102,7 +102,7 @@
(*idmap)->accept(&visitor);
ASSERT_CONTAINS_REGEX(ADDRESS "504d4449 magic\n", stream.str());
- ASSERT_CONTAINS_REGEX(ADDRESS "00000005 version\n", stream.str());
+ ASSERT_CONTAINS_REGEX(ADDRESS "00000006 version\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "00001234 target crc\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "00005678 overlay crc\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "00000011 fulfilled policies: public|signature\n", stream.str());
@@ -121,7 +121,7 @@
ASSERT_CONTAINS_REGEX(ADDRESS "7f020000 overlay id\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "7f030002 target id\n", stream.str());
ASSERT_CONTAINS_REGEX(ADDRESS "00000004 string pool size\n", stream.str());
- ASSERT_CONTAINS_REGEX("00000278: ........ string pool: ...\n", stream.str());
+ ASSERT_CONTAINS_REGEX("00000098: ........ string pool\n", stream.str());
}
} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/TestHelpers.h b/cmds/idmap2/tests/TestHelpers.h
index d0a8e3d..5c934a3 100644
--- a/cmds/idmap2/tests/TestHelpers.h
+++ b/cmds/idmap2/tests/TestHelpers.h
@@ -30,7 +30,7 @@
0x49, 0x44, 0x4d, 0x50,
// 0x4: version
- 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00,
// 0x8: target crc
0x34, 0x12, 0x00, 0x00,
@@ -44,125 +44,107 @@
// 0x14: enforce overlayable
0x01, 0x00, 0x00, 0x00,
- // 0x18: target path "targetX.apk"
- 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x58, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // 0x18: target path length
+ 0x0b, 0x00, 0x00, 0x00,
- // 0x118: overlay path "overlayX.apk"
- 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x58, 0x2e, 0x61, 0x70, 0x6b, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // 0x1c: target path "targetX.apk"
+ 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x58, 0x2e, 0x61, 0x70, 0x6b, 0x00,
- // 0x218: debug string
+ // 0x28: overlay path length
+ 0x0c, 0x00, 0x00, 0x00,
+
+ // 0x2c: overlay path "overlayX.apk"
+ 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x58, 0x2e, 0x61, 0x70, 0x6b,
+
+ // 0x38: debug string
// string length,
0x05, 0x00, 0x00, 0x00,
- // 0x21c string contents "debug\0\0\0" (padded to word alignment)
+ // 0x3c string contents "debug\0\0\0" (padded to word alignment)
0x64, 0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00,
// DATA HEADER
- // 0x224: target_package_id
+ // 0x44: target_package_id
0x7f,
- // 0x225: overlay_package_id
+ // 0x45: overlay_package_id
0x7f,
- // 0x226: padding
+ // 0x46: padding
0x00, 0x00,
- // 0x228: target_entry_count
+ // 0x48: target_entry_count
0x03, 0x00, 0x00, 0x00,
- // 0x22c: target_inline_entry_count
+ // 0x4c: target_inline_entry_count
0x01, 0x00, 0x00, 0x00,
- // 0x230: overlay_entry_count
+ // 0x50: overlay_entry_count
0x03, 0x00, 0x00, 0x00,
- // 0x234: string_pool_offset
+ // 0x54: string_pool_offset
0x00, 0x00, 0x00, 0x00,
// TARGET ENTRIES
- // 0x238: target id (0x7f020000)
+ // 0x58: target id (0x7f020000)
0x00, 0x00, 0x02, 0x7f,
- // 0x23c: overlay_id (0x7f020000)
+ // 0x5c: overlay_id (0x7f020000)
0x00, 0x00, 0x02, 0x7f,
- // 0x240: target id (0x7f030000)
+ // 0x60: target id (0x7f030000)
0x00, 0x00, 0x03, 0x7f,
- // 0x244: overlay_id (0x7f030000)
+ // 0x64: overlay_id (0x7f030000)
0x00, 0x00, 0x03, 0x7f,
- // 0x248: target id (0x7f030002)
+ // 0x68: target id (0x7f030002)
0x02, 0x00, 0x03, 0x7f,
- // 0x24c: overlay_id (0x7f030001)
+ // 0x6c: overlay_id (0x7f030001)
0x01, 0x00, 0x03, 0x7f,
// INLINE TARGET ENTRIES
- // 0x250: target_id
+ // 0x70: target_id
0x00, 0x00, 0x04, 0x7f,
- // 0x254: Res_value::size (value ignored by idmap)
+ // 0x74: Res_value::size (value ignored by idmap)
0x08, 0x00,
- // 0x256: Res_value::res0 (value ignored by idmap)
+ // 0x77: Res_value::res0 (value ignored by idmap)
0x00,
- // 0x257: Res_value::dataType (TYPE_INT_HEX)
+ // 0x78: Res_value::dataType (TYPE_INT_HEX)
0x11,
- // 0x258: Res_value::data
+ // 0x7c: Res_value::data
0x78, 0x56, 0x34, 0x12,
// OVERLAY ENTRIES
- // 0x25c: 0x7f020000 -> 0x7f020000
+ // 0x80: 0x7f020000 -> 0x7f020000
0x00, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x02, 0x7f,
- // 0x264: 0x7f030000 -> 0x7f030000
+ // 0x88: 0x7f030000 -> 0x7f030000
0x00, 0x00, 0x03, 0x7f, 0x00, 0x00, 0x03, 0x7f,
- // 0x26c: 0x7f030001 -> 0x7f030002
+ // 0x90: 0x7f030001 -> 0x7f030002
0x01, 0x00, 0x03, 0x7f, 0x02, 0x00, 0x03, 0x7f,
- // 0x274: string pool
+ // 0x94: string pool
// string length,
0x04, 0x00, 0x00, 0x00,
- // 0x278 string contents "test" (padded to word alignment)
+ // 0x98 string contents "test"
0x74, 0x65, 0x73, 0x74};
-const unsigned int idmap_raw_data_len = 0x27c;
+const unsigned int idmap_raw_data_len = 0x9c;
+const unsigned int idmap_raw_data_offset = 0x44;
+const unsigned int idmap_raw_data_target_crc = 0x1234;
+const unsigned int idmap_raw_data_overlay_crc = 0x5678;
+const unsigned int idmap_raw_data_policies = 0x11;
+inline const std::string idmap_raw_data_target_path = "targetX.apk";
+inline const std::string idmap_raw_data_overlay_path = "overlayX.apk";
std::string GetTestDataPath();