Add policies and enforce overlayable to header
If the fulfilled policies change without the contents of the target
and overlay APKs changing, the idmap for the overlay should be
regenerated. This change adds fulfilled policies and enforce
overlayable to the idmap header so that idmap2d can determine if the
polices or enforce overlayable changed from what was used to generate
the idmap.
Bug: 119328308
Test: idmap2_tests
Test: atest RegenerateIdmapTest
Change-Id: I96f970e82b5243be01b205ac2cb6ab249c6100bc
diff --git a/cmds/idmap2/tests/TestHelpers.h b/cmds/idmap2/tests/TestHelpers.h
index e899589..b599dcb 100644
--- a/cmds/idmap2/tests/TestHelpers.h
+++ b/cmds/idmap2/tests/TestHelpers.h
@@ -30,7 +30,7 @@
0x49, 0x44, 0x4d, 0x50,
// 0x4: version
- 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00,
// 0x8: target crc
0x34, 0x12, 0x00, 0x00,
@@ -38,7 +38,13 @@
// 0xc: overlay crc
0x78, 0x56, 0x00, 0x00,
- // 0x10: target path "targetX.apk"
+ // 0x10: fulfilled policies
+ 0x11, 0x00, 0x00, 0x00,
+
+ // 0x14: enforce overlayable
+ 0x01,
+
+ // 0x15: 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,
@@ -56,7 +62,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // 0x110: overlay path "overlayX.apk"
+ // 0x115: 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,
@@ -74,7 +80,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // 0x210: debug string
+ // 0x215: debug string
// string length, including terminating null
0x08, 0x00, 0x00, 0x00,
@@ -82,63 +88,63 @@
0x64, 0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00,
// DATA HEADER
- // 0x21c: target_package_id
+ // 0x221: target_package_id
0x7f,
- // 0x21d: overlay_package_id
+ // 0x222: overlay_package_id
0x7f,
- // 0x21e: target_entry_count
+ // 0x223: target_entry_count
0x03, 0x00, 0x00, 0x00,
- // 0x222: overlay_entry_count
+ // 0x227: overlay_entry_count
0x03, 0x00, 0x00, 0x00,
- // 0x226: string_pool_offset
+ // 0x22b: string_pool_offset
0x00, 0x00, 0x00, 0x00,
- // 0x22a: string_pool_byte_length
+ // 0x22f: string_pool_byte_length
0x00, 0x00, 0x00, 0x00,
// TARGET ENTRIES
- // 0x22e: 0x7f020000
- 0x00, 0x00, 0x02, 0x7f,
-
- // 0x232: TYPE_REFERENCE
- 0x01,
-
// 0x233: 0x7f020000
0x00, 0x00, 0x02, 0x7f,
- // 0x237: 0x7f030000
- 0x00, 0x00, 0x03, 0x7f,
-
- // 0x23b: TYPE_REFERENCE
+ // 0x237: TYPE_REFERENCE
0x01,
+ // 0x238: 0x7f020000
+ 0x00, 0x00, 0x02, 0x7f,
+
// 0x23c: 0x7f030000
0x00, 0x00, 0x03, 0x7f,
- // 0x240: 0x7f030002
- 0x02, 0x00, 0x03, 0x7f,
-
- // 0x244: TYPE_REFERENCE
+ // 0x240: TYPE_REFERENCE
0x01,
- // 0x245: 0x7f030001
+ // 0x241: 0x7f030000
+ 0x00, 0x00, 0x03, 0x7f,
+
+ // 0x245: 0x7f030002
+ 0x02, 0x00, 0x03, 0x7f,
+
+ // 0x249: TYPE_REFERENCE
+ 0x01,
+
+ // 0x24a: 0x7f030001
0x01, 0x00, 0x03, 0x7f,
// OVERLAY ENTRIES
- // 0x249: 0x7f020000 -> 0x7f020000
+ // 0x24e: 0x7f020000 -> 0x7f020000
0x00, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x02, 0x7f,
- // 0x251: 0x7f030000 -> 0x7f030000
+ // 0x256: 0x7f030000 -> 0x7f030000
0x00, 0x00, 0x03, 0x7f, 0x00, 0x00, 0x03, 0x7f,
- // 0x259: 0x7f030001 -> 0x7f030002
+ // 0x25e: 0x7f030001 -> 0x7f030002
0x01, 0x00, 0x03, 0x7f, 0x02, 0x00, 0x03, 0x7f};
-const unsigned int idmap_raw_data_len = 0x261;
+const unsigned int idmap_raw_data_len = 0x266;
std::string GetTestDataPath();