summaryrefslogtreecommitdiff
path: root/cmds/idmap2/idmap2d/Idmap2Service.cpp
diff options
context:
space:
mode:
authorhg.choi <hg.choi@lge.com>2020-01-15 17:12:48 +0900
committerRyan Mitchell <rtmitchell@google.com>2020-03-26 12:35:58 -0700
commita3a68132b5c5eed58813a631682dcbc79b9916e9 (patch)
treee135f9a96a2148dd32c5d80297499dc0d615e4ce /cmds/idmap2/idmap2d/Idmap2Service.cpp
parent393c9121cea9e03762b3e5460d523b9d5393f6f7 (diff)
Consider target path when verifyIdmap.
Updating new version package with changing resource id, Overlay idmap still retain same resource id and target path of prebuilt package. Consequentially overlay can not apply to new update resource id. As is : VerifyIdmap only verify uptodate of idmap. To be : Verify change of target path. Bug: 147794117 Bug: 150877400 Test: idmap2_tests Change-Id: I2ed6b5ba49aeb1b24625866daefea56c9766baef
Diffstat (limited to 'cmds/idmap2/idmap2d/Idmap2Service.cpp')
-rw-r--r--cmds/idmap2/idmap2d/Idmap2Service.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp
index 8f5e49d5b428..e55ea6c00545 100644
--- a/cmds/idmap2/idmap2d/Idmap2Service.cpp
+++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp
@@ -93,7 +93,8 @@ Status Idmap2Service::removeIdmap(const std::string& overlay_apk_path,
return ok();
}
-Status Idmap2Service::verifyIdmap(const std::string& overlay_apk_path,
+Status Idmap2Service::verifyIdmap(const std::string& target_apk_path,
+ const std::string& overlay_apk_path,
int32_t fulfilled_policies ATTRIBUTE_UNUSED,
bool enforce_overlayable ATTRIBUTE_UNUSED,
int32_t user_id ATTRIBUTE_UNUSED, bool* _aidl_return) {
@@ -103,10 +104,15 @@ Status Idmap2Service::verifyIdmap(const std::string& overlay_apk_path,
std::ifstream fin(idmap_path);
const std::unique_ptr<const IdmapHeader> header = IdmapHeader::FromBinaryStream(fin);
fin.close();
- *_aidl_return = header && header->IsUpToDate();
+ if (!header) {
+ *_aidl_return = false;
+ return error("failed to parse idmap header");
+ }
- // TODO(b/119328308): Check that the set of fulfilled policies of the overlay has not changed
+ *_aidl_return =
+ strcmp(header->GetTargetPath().data(), target_apk_path.data()) == 0 && header->IsUpToDate();
+ // TODO(b/119328308): Check that the set of fulfilled policies of the overlay has not changed
return ok();
}