summaryrefslogtreecommitdiff
path: root/libs/androidfw/include
diff options
context:
space:
mode:
authorMÃ¥rten Kongstad <marten.kongstad@sony.com>2019-10-11 08:32:04 +0200
committerTodd Kennedy <toddke@google.com>2019-12-19 16:51:51 +0000
commitd7e8a534d0fbf0b0f8f27f59f90dbbeb0b5641db (patch)
tree01a28945f23ad8e7d97f571268c620ad9cfdc554 /libs/androidfw/include
parentd1ee549ad9fff3c923e04dab0f9181756860ffa9 (diff)
idmap2: add debug information to idmap file format
Add a new variable length string to the idmap file format. This string will hold debug information like fulfilled policies and any warnings triggered while generating the file. Bump the idmap version to 3. Adjust the idmap header definition in ResourceType.h to take the new string into account. Example debug info: $ idmap2 create \ --target-apk-path frameworks/base/cmds/idmap2/tests/data/target/target.apk \ --overlay-apk-path frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk \ --idmap-path /tmp/a.idmap \ --policy public \ --policy oem $ idmap2 dump --idmap-path /tmp/a.idmap target apk path : frameworks/base/cmds/idmap2/tests/data/target/target.apk overlay apk path : frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk I fulfilled_policies=oem|public enforce_overlayable=true W failed to find resource "integer/not_in_target" in target resources 0x7f010000 -> 0x7f010000 integer/int1 0x7f02000c -> 0x7f020000 string/str1 [...] $ idmap2 dump --idmap-path /tmp/a.idmap --verbose 00000000: 504d4449 magic 00000004: 00000003 version 00000008: 76a20829 target crc 0000000c: c054fb26 overlay crc 00000010: ........ target path: frameworks/base/cmds/idmap2/tests/data/target/target.apk 00000110: ........ overlay path: frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk 00000210: ........ debug info: ... 00000294: 7f target package id 00000295: 7f overlay package id [...] Also, tell cpplint to accept non-const references as function parameters: they make more sense as out-parameters than pointers that are assumed to be non-null. Also, switch to regular expressions in the RawPrintVisitorTests: no more manual fixups of the stream offsets! Tell cpplint that the <regex> header is OK to use. Bug: 140790707 Test: idmap2_tests Change-Id: Ib94684a3b4001240321801e21af8e132fbcf6609
Diffstat (limited to 'libs/androidfw/include')
-rw-r--r--libs/androidfw/include/androidfw/ResourceTypes.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h
index b20e6579fda7..b603326cec34 100644
--- a/libs/androidfw/include/androidfw/ResourceTypes.h
+++ b/libs/androidfw/include/androidfw/ResourceTypes.h
@@ -39,7 +39,7 @@
namespace android {
constexpr const static uint32_t kIdmapMagic = 0x504D4449u;
-constexpr const static uint32_t kIdmapCurrentVersion = 0x00000002u;
+constexpr const static uint32_t kIdmapCurrentVersion = 0x00000003u;
/**
* In C++11, char16_t is defined as *at least* 16 bits. We do a lot of
@@ -1724,6 +1724,11 @@ struct Idmap_header {
uint8_t target_path[256];
uint8_t overlay_path[256];
+
+ uint32_t debug_info_size;
+ uint8_t debug_info[0];
+
+ size_t Size() const;
};
struct Idmap_data_header {