diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-04-10 15:53:05 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-04-10 15:53:05 +0000 |
commit | cca1593b23235f6491203506088e23fee84283e7 (patch) | |
tree | 23170fb1330dd74027bcb60b76602fef8660238f /cmds/idmap2 | |
parent | 32bb3440b49ceb7e380e3c34590e8fa80083deb3 (diff) | |
parent | 6cb79cdfb777e817c29e574aed1f2711996b578c (diff) |
Merge changes from topic "invalidate_idmap" into rvc-dev am: 6cb79cdfb7
Change-Id: Iec3d0e3bab28964442c5aada00c2586e284feb92
Diffstat (limited to 'cmds/idmap2')
-rw-r--r-- | cmds/idmap2/TEST_MAPPING | 5 | ||||
-rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.cpp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/cmds/idmap2/TEST_MAPPING b/cmds/idmap2/TEST_MAPPING index 26ccf038cba2..9e0fb84c7949 100644 --- a/cmds/idmap2/TEST_MAPPING +++ b/cmds/idmap2/TEST_MAPPING @@ -3,5 +3,10 @@ { "name" : "idmap2_tests" } + ], + "imports": [ + { + "path": "frameworks/base/services/core/java/com/android/server/om" + } ] } diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index 9cae926d56d7..b8f1a1c0ee72 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.cpp +++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp @@ -149,15 +149,21 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path, return error(idmap.GetErrorMessage()); } + // idmap files are mapped with mmap in libandroidfw. Deleting and recreating the idmap guarantees + // that existing memory maps will continue to be valid and unaffected. + unlink(idmap_path.c_str()); + umask(kIdmapFilePermissionMask); std::ofstream fout(idmap_path); if (fout.fail()) { return error("failed to open idmap path " + idmap_path); } + BinaryStreamVisitor visitor(fout); (*idmap)->accept(&visitor); fout.close(); if (fout.fail()) { + unlink(idmap_path.c_str()); return error("failed to write to idmap path " + idmap_path); } |