summaryrefslogtreecommitdiff
path: root/cmds/idmap2/idmap2d/Idmap2Service.cpp
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2020-01-23 13:29:22 +0900
committerJooyung Han <jooyung@google.com>2020-02-26 04:00:40 +0000
commit605e39f5fd66bd456b030b45801fc2ef39b2840e (patch)
treeb1b5b91c9a2a4091ebe721c9ad101f380d9900db /cmds/idmap2/idmap2d/Idmap2Service.cpp
parente78f40153c1018be65f811a22229521ed7a255bb (diff)
Use optional for nullable types
AIDL generates optional<T> for nullable T types for C++, which is more efficient and idomatic and easy to use. Bug: 144773267 Test: build/flash/boot Merged-In: I90cf2ce1193c479179687d71a5c1416f6cdf0b16 Change-Id: I90cf2ce1193c479179687d71a5c1416f6cdf0b16 (cherry picked from commit 53be7f4db497a05256407bd4c499a8fafc8e095d) Exempt-From-Owner-Approval: CP from master
Diffstat (limited to 'cmds/idmap2/idmap2d/Idmap2Service.cpp')
-rw-r--r--cmds/idmap2/idmap2d/Idmap2Service.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp
index 4aabf8399a25..33c88808247c 100644
--- a/cmds/idmap2/idmap2d/Idmap2Service.cpp
+++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp
@@ -113,10 +113,10 @@ Status Idmap2Service::verifyIdmap(const std::string& overlay_apk_path,
Status Idmap2Service::createIdmap(const std::string& target_apk_path,
const std::string& overlay_apk_path, int32_t fulfilled_policies,
bool enforce_overlayable, int32_t user_id ATTRIBUTE_UNUSED,
- std::unique_ptr<std::string>* _aidl_return) {
+ std::optional<std::string>* _aidl_return) {
assert(_aidl_return);
SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path;
- _aidl_return->reset(nullptr);
+ _aidl_return->reset();
const PolicyBitmask policy_bitmask = ConvertAidlArgToPolicyBitmask(fulfilled_policies);
@@ -155,7 +155,7 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path,
return error("failed to write to idmap path " + idmap_path);
}
- *_aidl_return = std::make_unique<std::string>(idmap_path);
+ *_aidl_return = idmap_path;
return ok();
}