idmap2: Set aidl_return to true on success
idmap2d did not set the aidl return value to true when
IdmapHeader::IsUpToDate succeeded. This regressed OMS initialization
time.
This change sets aidl_return to true when the header is up-to-date and
also replaces usages of `uint32_t` for fulfilled_policies with
`PolicyBitmask`.
Bug: 158491243
Bug: 158535227
Bug: 158468195
Test: enable/disable overlays and onserve that verify succeeds
Test: change the values of enforce overlayable and fulfilled policies
and confirm that idmap verify fails
Change-Id: If8febbfd0283d53211263690f85e2970706a33b7
diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp
index 0bea217..23c25a7 100644
--- a/cmds/idmap2/libidmap2/Idmap.cpp
+++ b/cmds/idmap2/libidmap2/Idmap.cpp
@@ -115,8 +115,7 @@
uint8_t enforce_overlayable;
if (!Read32(stream, &idmap_header->magic_) || !Read32(stream, &idmap_header->version_) ||
!Read32(stream, &idmap_header->target_crc_) || !Read32(stream, &idmap_header->overlay_crc_) ||
- !Read32(stream, &idmap_header->fulfilled_policies_) ||
- !Read8(stream, &enforce_overlayable) ||
+ !Read32(stream, &idmap_header->fulfilled_policies_) || !Read8(stream, &enforce_overlayable) ||
!ReadString256(stream, idmap_header->target_path_) ||
!ReadString256(stream, idmap_header->overlay_path_)) {
return nullptr;
@@ -134,7 +133,8 @@
}
Result<Unit> IdmapHeader::IsUpToDate(const char* target_path, const char* overlay_path,
- uint32_t fulfilled_policies, bool enforce_overlayable) const {
+ PolicyBitmask fulfilled_policies,
+ bool enforce_overlayable) const {
const std::unique_ptr<const ZipFile> target_zip = ZipFile::Open(target_path);
if (!target_zip) {
return Error("failed to open target %s", target_path);
@@ -161,7 +161,8 @@
Result<Unit> IdmapHeader::IsUpToDate(const char* target_path, const char* overlay_path,
uint32_t target_crc, uint32_t overlay_crc,
- uint32_t fulfilled_policies, bool enforce_overlayable) const {
+ PolicyBitmask fulfilled_policies,
+ bool enforce_overlayable) const {
if (magic_ != kIdmapMagic) {
return Error("bad magic: actual 0x%08x, expected 0x%08x", magic_, kIdmapMagic);
}
@@ -187,8 +188,7 @@
if (enforce_overlayable != enforce_overlayable_) {
return Error("bad enforce overlayable: idmap version %s, file system version %s",
- enforce_overlayable ? "true" : "false",
- enforce_overlayable_ ? "true" : "false");
+ enforce_overlayable ? "true" : "false", enforce_overlayable_ ? "true" : "false");
}
if (strcmp(target_path, target_path_) != 0) {