diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-03-30 15:49:11 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-30 15:49:11 +0000 |
commit | bb99b2afce07017c9ffb4a4d44f9c7adc2fef826 (patch) | |
tree | 5836980b0a7036126ca345e6b8afe3e2bf89b5b7 /cmds/idmap2/idmap2d/Idmap2Service.cpp | |
parent | ac009ade580ef4e6527e95ecb8acde95fda02117 (diff) | |
parent | fa0f02a91c128ceb559f4578f1aec8c6981bc042 (diff) |
Merge "Consider target path when verifyIdmap." into rvc-dev am: fa0f02a91c
Change-Id: Iad2e29a73f4b7b11c84fa30fd376a5d25e3c197c
Diffstat (limited to 'cmds/idmap2/idmap2d/Idmap2Service.cpp')
-rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index 02e92aeb9dc6..9cae926d56d7 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(); } |