diff options
author | Jooyung Han <jooyung@google.com> | 2020-03-07 21:47:09 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2020-03-12 08:42:33 +0000 |
commit | c85cc13b5ac09045633945357a337eb0629696f4 (patch) | |
tree | 6344959806a4b603a9563e476ac50b16d1a19246 /cmds/idmap2 | |
parent | 9beacac0c9e0f0d239cb7564174374483be172a9 (diff) |
Use aidl::nullable for nullable type in C++
To reduce the discrepance between old code which still uses
std::unique_ptr and new code using std::optional.
This might help to avoid merge-conflicts between branches.
Bug: 144773267
Test: m
(cherry picked from commit ad62e8cbf5cf6083568f6f230ef7d73ad8776971)
Change-Id: Ie3196ee5cce17d77950eea9479d2cc1406e9e674
Merged-In: I33822bc76ef87637d5408849f64a0607e121792e
Exempt-From-Owner-Approval: approved from master
Diffstat (limited to 'cmds/idmap2')
-rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.cpp | 4 | ||||
-rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.h | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index 63c22ef6fb3e..02e92aeb9dc6 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.cpp +++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp @@ -113,7 +113,7 @@ 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::optional<std::string>* _aidl_return) { + aidl::nullable<std::string>* _aidl_return) { assert(_aidl_return); SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path; _aidl_return->reset(); @@ -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 = idmap_path; + *_aidl_return = aidl::make_nullable<std::string>(idmap_path); return ok(); } diff --git a/cmds/idmap2/idmap2d/Idmap2Service.h b/cmds/idmap2/idmap2d/Idmap2Service.h index 047353f52590..b6f5136fc801 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.h +++ b/cmds/idmap2/idmap2d/Idmap2Service.h @@ -19,9 +19,7 @@ #include <android-base/unique_fd.h> #include <binder/BinderService.h> - -#include <optional> -#include <string> +#include <binder/Nullable.h> #include "android/os/BnIdmap2.h" @@ -46,7 +44,7 @@ class Idmap2Service : public BinderService<Idmap2Service>, public BnIdmap2 { binder::Status createIdmap(const std::string& target_apk_path, const std::string& overlay_apk_path, int32_t fulfilled_policies, bool enforce_overlayable, int32_t user_id, - std::optional<std::string>* _aidl_return) override; + aidl::nullable<std::string>* _aidl_return) override; }; } // namespace android::os |